)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Default (Ia.Ftn.Cl.Models.Ui.Administration)

Public general use code classes and xml files that we've compiled and used over the years:

Administration support class for Fixed Telecommunications Network (FTN) ui model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Data;
    4: using System.Linq;
    5: using System.Text;
    6:  
    7: namespace Ia.Ftn.Cl.Models.Ui.Administration
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Administration support class for Fixed Telecommunications Network (FTN) ui model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     /// </remarks> 
   18:     public class Default
   19:     {
   20:         ////////////////////////////////////////////////////////////////////////////
   21:  
   22:         /// <summary>
   23:         ///
   24:         /// </summary>
   25:         public Default() { }
   26:  
   27:         /////////////////////////////////////////////////////////////////////////////////
   28:  
   29:         /// <summary>
   30:         ///
   31:         /// </summary>
   32:         public static Ia.Cl.Models.Result EmailStatusReport(string name, string email)
   33:         {
   34:             //bool b;
   35:             int withinLastNMinutes;
   36:             string content, subject;
   37:             DateTime now;
   38:  
   39:             withinLastNMinutes = 20;
   40:             now = DateTime.UtcNow.AddHours(3);
   41:  
   42:             // subject can't have \r\n
   43:             subject = "Daily Fixed Telecommunications Network's Operations Support System (FTN OSS) Status Report (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
   44:  
   45:             content = "Daily Fixed Telecommunications Network's Operations Support System (FTN OSS) Status Report: " + now.ToString("yyyy-MM-dd HH:mm") + "\r\n"
   46:                 + "\r\n"
   47:                 + "Status:\r\n"
   48:                 + "\r\n"
   49:                 + "\r\n"
   50:                 + "System Monitor:\r\n"
   51:                 + "\r\n"
   52:                 + "System application status within the last " + withinLastNMinutes + " minutes:\r\n"
   53:                 + "\r\n"
   54:                 + "Application name(assembly) active status\r\n"
   55:                 + "\r\n"
   56:                 + Ia.Ftn.Cl.Models.Business.Heartbeat.HearbeatsWithinLastNMinutesTextAsync(withinLastNMinutes).Result + "\r\n"
   57:                 + "\r\n"
   58:                 + "\r\n"
   59:                 + "\r\n"
   60:  
   61:                + @"For help send ""help"" in an email." + "\r\n";
   62:  
   63:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(name, email, subject, content);
   64:         }
   65:  
   66:         /////////////////////////////////////////////////////////////////////////////////
   67:  
   68:         /// <summary>
   69:         ///
   70:         /// </summary>
   71:         public static Ia.Cl.Models.Result EmailListWithOntListProvisionedAndReadyButDoNotExistInCustomerDepartmentDatabaseReport(string name, string email)
   72:         {
   73:             //bool b;
   74:             string content, subject;
   75:             DataTable accessDataTable;
   76:             DateTime now;
   77:  
   78:             now = DateTime.UtcNow.AddHours(3);
   79:  
   80:             subject = "Table of latest 100 ONTs that are provisioned and ready within FTN access network but do not exist in the Customer Department's database (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
   81:  
   82:             accessDataTable = Ia.Ftn.Cl.Models.Ui.Access.ReadListWithOntListProvisionedAndReadyButDoNotExistInCustomerDepartmentDatabaseDataTable(100);
   83:  
   84:             content = "Table of latest 100 ONTs that are provisioned and ready within FTN access network but do not exist in the Customer Department's database (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
   85:  
   86:             content += "\r\n";
   87:             content += "\r\n";
   88:  
   89:             content += Ia.Cl.Models.Default.GenerateTabSeparatedTextFromDataTable(accessDataTable);
   90:  
   91:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(name, email, subject, content);
   92:         }
   93:  
   94:         /////////////////////////////////////////////////////////////////////////////////
   95:  
   96:         /// <summary>
   97:         ///
   98:         /// </summary>
   99:         public static Ia.Cl.Models.Result EmailStatisticReport(string name, string email)
  100:         {
  101:             //bool b;
  102:             string subject;
  103:             StringBuilder stringBuilder;
  104:             DateTime now;
  105:             List<Ia.Ftn.Cl.Models.Business.Administration.Statistic.Site> siteList;
  106:             List<Ia.Ftn.Cl.Models.Business.Administration.Statistic.KuwaitArea> serviceList;
  107:  
  108:             now = DateTime.UtcNow.AddHours(3);
  109:             stringBuilder = new StringBuilder();
  110:  
  111:             subject = "Statistics of Site, Access, and Service usage within the Fixed Telecommunications Network's Operations Support System (FTN OSS) (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  112:  
  113:             siteList = Ia.Ftn.Cl.Models.Data.Administration.SiteStatistics();
  114:             serviceList = Ia.Ftn.Cl.Models.Data.Administration.ServiceAccessStatisticWithinKuwaitFtnArea();
  115:  
  116:             stringBuilder.AppendLine("Statistics of Site, Access, and Service usage within the Fixed Telecommunications Network's Operations Support System (FTN OSS) (" + now.ToString("yyyy-MM-dd HH:mm") + ")");
  117:  
  118:             stringBuilder.AppendLine();
  119:             stringBuilder.AppendLine("============================================================");
  120:  
  121:             foreach (var s in siteList)
  122:             {
  123:                 stringBuilder.AppendLine(s.ToSimpleTextString());
  124:             }
  125:  
  126:             stringBuilder.AppendLine("============================================================");
  127:  
  128:             foreach (var s in serviceList)
  129:             {
  130:                 stringBuilder.AppendLine(s.ToSimpleTextString());
  131:             }
  132:  
  133:             stringBuilder.AppendLine();
  134:  
  135:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(name, email, subject, stringBuilder.ToString());
  136:         }
  137:  
  138:         /////////////////////////////////////////////////////////////////////////////////
  139:  
  140:         /// <summary>
  141:         ///
  142:         /// </summary>
  143:         public static Ia.Cl.Models.Result EmailListOfNumberOfAgcfGatewayRecordInGroupOfMgcIp(string name, string email)
  144:         {
  145:             string content, subject;
  146:             Dictionary<string, int> dictionary;
  147:             DateTime now;
  148:  
  149:             now = DateTime.UtcNow.AddHours(3);
  150:  
  151:             subject = "List of the number of AGCF gateway records in groups of MGC IP (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  152:  
  153:             dictionary = Ia.Ftn.Cl.Models.Business.Nokia.Ims.NumberOfAgcfGatewayRecordInGroupOfMgcIpDictionary.OrderBy(u => u.Key).ToDictionary(u => u.Key, u => u.Value);
  154:  
  155:             content = "List of the number of AGCF gateway records in groups of MGC IP  (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  156:  
  157:             content += "\r\n";
  158:             content += "\r\n";
  159:  
  160:             content += Ia.Cl.Models.Default.GenerateTabSeparatedTextFromDictionary(dictionary);
  161:  
  162:             content += "\r\n";
  163:             content += "Total number of AGCF gateway records: " + dictionary.Sum(u => u.Value) + ". ";
  164:  
  165:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(name, email, subject, content);
  166:         }
  167:  
  168:         /////////////////////////////////////////////////////////////////////////////////
  169:  
  170:         /// <summary>
  171:         ///
  172:         /// </summary>
  173:         public static Ia.Cl.Models.Result EmailNokiaReport(string name, string email)
  174:         {
  175:             string content, subject;
  176:             DateTime now;
  177:             List<string> list;
  178:             SortedDictionary<string, int> sortedDictionary;
  179:  
  180:             now = DateTime.UtcNow.AddHours(3);
  181:  
  182:             // subject can't have \r\n
  183:             subject = "Weekly Fixed Telecommunications Network's Operations Support System (FTN OSS) Nokia Report (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  184:  
  185:             content = "Weekly Fixed Telecommunications Network's Operations Support System (FTN OSS) Nokia Report: " + now.ToString("yyyy-MM-dd HH:mm") + "\r\n"
  186:                 + "Status: Normal\r\n";
  187:  
  188:             content += "\r\n";
  189:             content += "\r\n";
  190:  
  191:  
  192:             content += "List of the number of AGCF gateway records in groups of MGC IP: ";
  193:  
  194:             content += "\r\n";
  195:             content += "\r\n";
  196:  
  197:             sortedDictionary = new SortedDictionary<string, int>(Ia.Ftn.Cl.Models.Business.Nokia.Ims.NumberOfAgcfGatewayRecordInGroupOfMgcIpDictionary);
  198:  
  199:             content += Ia.Cl.Models.Default.GenerateTabSeparatedTextFromDictionary(sortedDictionary);
  200:  
  201:             content += "\r\n";
  202:             content += "\r\n";
  203:  
  204:  
  205:             content += "List of the number of AGCF gateway records in IMS pairs of MGC IP: ";
  206:  
  207:             content += "\r\n";
  208:             content += "\r\n";
  209:  
  210:             foreach (Ia.Ftn.Cl.Models.Business.Nokia.Ims.ImsBasicService imsBasicService in Ia.Ftn.Cl.Models.Business.Nokia.Ims.ImsBasicServiceList)
  211:             {
  212:                 content += imsBasicService.MgcIp + ", " + imsBasicService.MgcSecondaryIp + "\t" + (sortedDictionary[imsBasicService.MgcIp] + sortedDictionary[imsBasicService.MgcSecondaryIp]);
  213:                 content += "\r\n";
  214:             }
  215:  
  216:             content += "\r\n";
  217:             content += "\r\n";
  218:  
  219:  
  220:             content += "Number of Nokia H.248 subscribers per FSDB: ";
  221:  
  222:             content += "\r\n";
  223:             content += "\r\n";
  224:  
  225:             list = Ia.Ftn.Cl.Models.Business.Nokia.Ims.NumberOfNokiaH248SubsribersPerFsdb();
  226:  
  227:             content += string.Join("\r\n", list.ToArray());
  228:             content += "\r\n";
  229:  
  230:             content += "\r\n";
  231:             content += "\r\n";
  232:  
  233:  
  234:             content += "Number of Nokia SIP subscribers per FSDB: ";
  235:  
  236:             content += "\r\n";
  237:             content += "\r\n";
  238:  
  239:             list = Ia.Ftn.Cl.Models.Business.Nokia.Ims.NumberOfNokiaSipSubsribersPerFsdb();
  240:  
  241:             content += string.Join("\r\n", list.ToArray());
  242:             content += "\r\n";
  243:  
  244:             content += "\r\n";
  245:             content += "\r\n";
  246:  
  247:  
  248:             content += "Service and access name list where subscriber's AlternateOtasRealm group number is not equal to subparties AssocOtasRealm group number: ";
  249:  
  250:             content += "\r\n";
  251:             content += "\r\n";
  252:  
  253:             list.Clear();
  254:  
  255:             foreach (var s in Ia.Ftn.Cl.Models.Data.Nokia.Ims.ServiceWhereSubscriberAlternateOtasRealmGroupNumberDoesNotEqualSubPartyAssocOtasRealmGroupNumberList())
  256:             {
  257:                 list.Add(Ia.Ftn.Cl.Models.Business.NumberFormatConverter.Service(s));
  258:             }
  259:  
  260:             if (list.Count > 0)
  261:             {
  262:                 content += string.Join("\r\n", list.ToArray());
  263:             }
  264:             else content += "None";
  265:  
  266:             content += "\r\n";
  267:  
  268:             content += "\r\n";
  269:             content += "\r\n";
  270:  
  271:  
  272:             content += "AGCF gateway records within NDD ONT list with wrong secondary IP: ";
  273:  
  274:             content += "\r\n";
  275:             content += "\r\n";
  276:  
  277:             list.Clear();
  278:  
  279:             var agcfGatewayRecordsWithinNddOntListWithWrongSecondaryIpList = Ia.Ftn.Cl.Models.Data.Nokia.Ims.AgcfGatewayRecordsWithinNddOntListWithWrongSecondaryIpList();
  280:  
  281:             foreach (var w in agcfGatewayRecordsWithinNddOntListWithWrongSecondaryIpList)
  282:             {
  283:                 list.Add(w.GwId.ToString());
  284:             }
  285:  
  286:             content += string.Join(", ", list.ToArray());
  287:  
  288:             content += "\r\n";
  289:             content += "\r\n";
  290:             content += "\r\n";
  291:  
  292:  
  293:             content += "SubParties' PrimaryPUIDCPEProfileNumber count distribution: ";
  294:  
  295:             content += "\r\n";
  296:             content += "\r\n";
  297:  
  298:             list.Clear();
  299:  
  300:             foreach (KeyValuePair<int, int> w in Ia.Ftn.Cl.Models.Data.Nokia.SubParty.PrimaryPuidCpeProfileNumberCountDistributionDictionary)
  301:             {
  302:                 list.Add(w.Key + "\t" + w.Value);
  303:             }
  304:  
  305:             content += string.Join("\r\n", list.ToArray());
  306:  
  307:             content += "\r\n";
  308:             content += "\r\n";
  309:  
  310:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(name, email, subject, content);
  311:         }
  312:  
  313:         /////////////////////////////////////////////////////////////////////////////////
  314:  
  315:         /// <summary>
  316:         ///
  317:         /// </summary>
  318:         public static Ia.Cl.Models.Result EmailHuaweiReport(string name, string email)
  319:         {
  320:             string content, subject;
  321:             DateTime now;
  322:  
  323:             now = DateTime.UtcNow.AddHours(3);
  324:  
  325:             // subject can't have \r\n
  326:             subject = "Weekly Fixed Telecommunications Network's Operations Support System (FTN OSS) Huawei Report (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  327:  
  328:             content = "Weekly Fixed Telecommunications Network's Operations Support System (FTN OSS) Huawei Report: " + now.ToString("yyyy-MM-dd HH:mm") + "\r\n"
  329:                 + "Status:.\r\n";
  330:  
  331:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(name, email, subject, content);
  332:         }
  333:  
  334:         /////////////////////////////////////////////////////////////////////////////////
  335:  
  336:         /// <summary>
  337:         ///
  338:         /// </summary>
  339:         public static Ia.Cl.Models.Result EmailListOfPreviouslyPstnDomainServicesMigratedOrProvisionedIntoImsFiberOrImsMsanServicesInAllowedToBeMigratedOltsReport(string emailRecipientName, string email)
  340:         {
  341:             return EmailListOfPreviouslyPstnDomainServicesMigratedOrProvisionedIntoImsFiberOrImsMsanServicesInAllowedToBeMigratedOltsReport(string.Empty, emailRecipientName, email);
  342:         }
  343:  
  344:         /////////////////////////////////////////////////////////////////////////////////
  345:  
  346:         /// <summary>
  347:         ///
  348:         /// </summary>
  349:         public static Ia.Cl.Models.Result EmailListOfPreviouslyPstnDomainServicesMigratedOrProvisionedIntoImsFiberOrImsMsanServicesInAllowedToBeMigratedOltsReport(string pstnName, string emailRecipientName, string email)
  350:         {
  351:             string title, content, subject;
  352:             StringBuilder stringBuilder;
  353:             DateTime now;
  354:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn pstn;
  355:             Dictionary<string, Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Site> dictionary;
  356:  
  357:             now = DateTime.UtcNow.AddHours(3);
  358:  
  359:             var dictionary0 = Ia.Ftn.Cl.Models.Data.Service.ImsServiceToOntAndMsanSiteInAllowedToBeMigratedOltAndDomainDictionary;
  360:  
  361:             if (string.IsNullOrEmpty(pstnName))
  362:             {
  363:                 // all sites
  364:  
  365:                 dictionary = dictionary0;
  366:  
  367:                 title = "قائمة بأرقام المقاسم المحلية المرحّلة إلى شبكة الألياف الضوئية والأرقام التي تتبع نطاق المقاسم المحلية وتم تركيبها حديثاً على أجهزة نهايات رقمية أو أمسان";
  368:  
  369:                 subject = title + " " + now.ToString("yyyy-MM-dd HH:mm");
  370:  
  371:                 content = title + "\r\n";
  372:                 content += "\r\n";
  373:                 content += "List of local PSTN domain services migrated or provisioned into IMS fiber or IMS MSAN services";
  374:                 content += "\r\n";
  375:                 content += "\r\n";
  376:                 content += now.ToString("yyyy-MM-dd HH:mm");
  377:  
  378:                 content += "\r\n";
  379:                 content += "\r\n";
  380:             }
  381:             else
  382:             {
  383:                 pstn = (from s in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PstnList where s.Name == pstnName select s).Single();
  384:  
  385:                 dictionary = (from d in dictionary0
  386:                               where d.Value == pstn.Site && pstn.DomainList.Any(u => d.Key.StartsWith(u.ToString()))
  387:                               select d).ToDictionary(u => u.Key, u => u.Value);
  388:  
  389:                 title = "قائمة بأرقام مقسم " + pstn.ArabicName + " المرحّلة إلى شبكة الألياف الضوئية والأرقام التي تتبع نطاق المقسم وتم تركيبها حديثاً على أجهزة نهايات رقمية أو أمسان";
  390:  
  391:                 subject = title + " " + now.ToString("yyyy-MM-dd HH:mm");
  392:  
  393:                 content = title + "\r\n";
  394:                 content += "\r\n";
  395:                 content += "List of " + pstn.Name + " PSTN domain services migrated or provisioned into IMS fiber or IMS MSAN services";
  396:                 content += "\r\n";
  397:                 content += "\r\n";
  398:                 content += now.ToString("yyyy-MM-dd HH:mm");
  399:  
  400:                 content += "\r\n";
  401:                 content += "\r\n";
  402:             }
  403:  
  404:             stringBuilder = new StringBuilder(dictionary.Count * 64);
  405:  
  406:             if (dictionary.Count > 0)
  407:             {
  408:                 stringBuilder.AppendLine("List count: " + dictionary.Count);
  409:                 stringBuilder.AppendLine(" ");
  410:  
  411:                 stringBuilder.Append(string.Join(", ", dictionary.Keys));
  412:             }
  413:             else
  414:             {
  415:                 stringBuilder.AppendLine("List count: zero");
  416:                 stringBuilder.AppendLine(" ");
  417:             }
  418:  
  419:             content += stringBuilder.ToString().Trim();
  420:  
  421:             content += "\r\n";
  422:             content += "\r\n";
  423:  
  424:             return Ia.Ftn.Cl.Models.Ui.Mail.SendPlainMail(emailRecipientName, email, subject, content);
  425:         }
  426:  
  427:         /////////////////////////////////////////////////////////////////////////////////
  428:         /////////////////////////////////////////////////////////////////////////////////
  429:  
  430:         /// <summary>
  431:         ///
  432:         /// </summary>
  433:         public static void StatisticsListForTelegramBotApi(Ia.Ftn.Cl.Models.Business.Administration.Framework framework, string opcode, out string subject, out string content)
  434:         {
  435:             string inputType, horizontalRule;
  436:             StringBuilder stringBuilder;
  437:             DateTime now;
  438:  
  439:             inputType = string.Empty;
  440:             horizontalRule = " ";
  441:  
  442:             now = DateTime.UtcNow.AddHours(3);
  443:  
  444:             // subject can't have \r\n
  445:             subject = string.Empty; // "Fixed Telecommunications Network's Operations Support System (FTN OSS) TNMD list: ";
  446:  
  447:             if (Ia.Ftn.Cl.Models.Business.Authority.FrameworkCanReadStatistics(framework))
  448:             {
  449:                 opcode = opcode.ToLower();
  450:  
  451:                 StatisticListForTelegramBotApiAndMailSimpleText(opcode, inputType, horizontalRule, out stringBuilder);
  452:  
  453:                 stringBuilder.AppendLine(horizontalRule);
  454:                 stringBuilder.AppendLine(Ia.Ftn.Cl.Models.Data.Help.Text(Ia.Ftn.Cl.Models.Data.Help.TelegramString.NeedHelpSendCommandSlashHelp));
  455:                 stringBuilder.AppendLine(horizontalRule);
  456:                 stringBuilder.AppendLine();
  457:  
  458:                 content = stringBuilder.ToString();
  459:             }
  460:             else
  461:             {
  462:                 content = "\r\n";
  463:                 content += "You are not authorized to modify this value. ";
  464:                 content += "\r\n";
  465:             }
  466:         }
  467:  
  468:         ////////////////////////////////////////////////////////////////////////////
  469:  
  470:         /// <summary>
  471:         ///
  472:         /// </summary>
  473:         public static void StatisticListForTelegramBotApiAndMailSimpleText(string opcode, string inputType, string horizontalRule, out StringBuilder contentStringBuilder)
  474:         {
  475:             StringBuilder stringBuilder;
  476:             DateTime now;
  477:             List<Ia.Ftn.Cl.Models.Business.Administration.Statistic.KuwaitArea> statisticList;
  478:  
  479:             stringBuilder = new StringBuilder();
  480:             now = DateTime.UtcNow.AddHours(3);
  481:  
  482:             //stringBuilder.AppendLine("Fixed Telecommunications Network's Operations Support System (FTN OSS) Find Result: " + now.ToString("yyyy-MM-dd HH:mm"));
  483:  
  484:             //stringBuilder.AppendLine(@"Opcode: """ + opcode + @""".");
  485:             //responseContent += @"Operand: """ + operand + @"""." + "\r\n";
  486:             //stringBuilder.AppendLine();
  487:  
  488:             if (opcode.Contains("statistics"))
  489:             {
  490:                 statisticList = Ia.Ftn.Cl.Models.Data.Administration.ServiceAccessStatisticWithinKuwaitFtnAreaCachedDaily;
  491:  
  492:                 if (statisticList != null && statisticList.Count > 0)
  493:                 {
  494:                     stringBuilder.AppendLine(horizontalRule);
  495:                     stringBuilder.AppendLine("Statistics:");
  496:                     stringBuilder.AppendLine();
  497:                     foreach (var s in statisticList) stringBuilder.AppendLine(s.ToSimpleTextString());
  498:                     stringBuilder.AppendLine(horizontalRule);
  499:                     stringBuilder.AppendLine();
  500:                 }
  501:                 else
  502:                 {
  503:                     stringBuilder.AppendLine(horizontalRule);
  504:                     stringBuilder.AppendLine();
  505:                 }
  506:             }
  507:             else
  508:             {
  509:                 stringBuilder.AppendLine(horizontalRule);
  510:                 stringBuilder.AppendLine("Error: opcode: [" + opcode + "] is unrecognized. ");
  511:                 stringBuilder.AppendLine(horizontalRule);
  512:                 stringBuilder.AppendLine();
  513:             }
  514:  
  515:             contentStringBuilder = stringBuilder.Replace(Environment.NewLine + horizontalRule, horizontalRule);
  516:         }
  517:  
  518:         ////////////////////////////////////////////////////////////////////////////
  519:         ////////////////////////////////////////////////////////////////////////////    
  520:     }
  521:  
  522:     ////////////////////////////////////////////////////////////////////////////
  523:     ////////////////////////////////////////////////////////////////////////////   
  524: }