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

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

    1: using Microsoft.AspNetCore.Mvc.Rendering;
    2: using System.Reflection;
    3: using System.Text;
    4: using System.Text.RegularExpressions;
    5:  
    6: namespace Ia.Ftn.Wa.Models.Maintenance
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     ///
   12:     /// </summary>
   13:     /// 
   14:     /// <remarks> 
   15:     /// Copyright © 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     /// </remarks> 
   17:     public static class Script
   18:     {
   19:         ////////////////////////////////////////////////////////////////////////////
   20:  
   21:         /// <summary>
   22:         ///
   23:         /// </summary>
   24:         public static void ViewModel(ref Ia.Ftn.Wa.Models.Maintenance.ScriptViewModel scriptViewModel)
   25:         {
   26:         }
   27:  
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         public static void Post(ref Ia.Ftn.Wa.Models.Maintenance.ScriptViewModel scriptViewModel, string commandArgument)
   34:         {
   35:             var count = 0;
   36:             var result = string.Empty;
   37:             var sb = new StringBuilder();
   38:  
   39:             if (commandArgument == "11")
   40:             {
   41:                 Ia.Ftn.Cl.Models.Business.Maintenance.Script.InsertMissingAccessEntriesByUsingStatisticalAddressEstimationGeneratedFromServiceRequestOrderAddressesAndCurrentOntAndNetworkDesignDocumentPosition(ref sb, out count, ref result);
   42:             }
   43:             else if (commandArgument == "5")
   44:             {
   45:                 // below: ONTs with no subscriber DNs assigned
   46:                 //Ia.Ftn.Cl.Models.Data.Maintenance.RetrunONTsWithNoSubscriberDnsAssigned(ref sb, ref count);
   47:             }
   48:             else if (commandArgument == "6")
   49:             {
   50:                 // below: Connections with no IP assigned (IP = 0 or IP = null)
   51:                 //Ia.Ftn.Cl.Models.Data.Maintenance.RetrunConnectionsWithNoIPAssigned(ref sb, ref count);
   52:             }
   53:             else if (commandArgument == "8")
   54:             {
   55:                 // below: Numbers that have *disappeared* from Service Request but still have a trace in Service Request Service records
   56:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumbersThatHaveDisappearedFromServiceRequestButStillHaveTraceInServiceRequestServiceRecords(ref sb, ref count);
   57:             }
   58:  
   59:             else if (commandArgument == "39")
   60:             {
   61:                 // below: SIP IP range according to OLT as outlined in NDD (Network Design Document)
   62:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnSIPIPRangeAccordingToOLTAsOutlinedInNetworkDesignDocumentNDD(ref sb, ref count);
   63:             }
   64:  
   65:             else if (commandArgument == "43")
   66:             {
   67:                 // below: Different ONTs (according to service requests) connected to same IP
   68:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnListOfDifferentONTsConnectedToSameIPAccordingToServiceRequests(ref sb, ref count);
   69:             }
   70:  
   71:             /////////////////////////////////////////////////////////////////////////////////////
   72:  
   73:             else if (commandArgument == "100")
   74:             {
   75:                 // below: Number, connection, &amp; address information for all numbers in ONTs
   76:  
   77:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumberAndConnectionAndAddressInformationForAllNumbersInONTs(ref sb, ref count);
   78:             }
   79:             else if (commandArgument == "101")
   80:             {
   81:                 // below: Non SFU ONTs on the network
   82:  
   83:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNonSFUONTsOnTheNetwork(ref sb, ref count);
   84:             }
   85:  
   86:             else if (commandArgument == "104")
   87:             {
   88:                 // below: Duplicate addresses within field table
   89:  
   90:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnDuplicateAddressesWithinFieldTable(ref sb, ref count);
   91:             }
   92:  
   93:             else if (commandArgument == "105")
   94:             {
   95:                 // below: Numbers not is the list of officially allowed Dns to be registered: (dn)
   96:  
   97:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnDuplicateAddressesWithinFieldTable(ref sb, ref count);
   98:             }
   99:  
  100:             else if (commandArgument == "106")
  101:             {
  102:                 // below: PBX key numbers from Service Request Service
  103:  
  104:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnPBXKeyNumbersFromServiceRequestService(ref sb, ref count);
  105:             }
  106:  
  107:             else if (commandArgument == "108")
  108:             {
  109:                 // below: Number of Dn records in System, Service, Service_Active, and Service_Request_Service tables
  110:  
  111:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumberOfDnRecordsInSystemServiceService_ActiveAndService_Request_ServiceTables(ref sb, ref count);
  112:             }
  113:  
  114:             else if (commandArgument == "109")
  115:             {
  116:                 // below: Dn-Mobile number association from Report records
  117:  
  118:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnDnToMobileNumberAssociationFromReportRecords(ref sb, ref count);
  119:             }
  120:  
  121:             else if (commandArgument == "110")
  122:             {
  123:                 // below: Routing parameters extracted from log file 'sendToS12.history.COMT1'
  124:  
  125:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnRoutingParametersExtractedFromLogFile_sendToS12_history_COMT1(ref sb, ref count);
  126:             }
  127:  
  128:             else if (commandArgument == "111")
  129:             {
  130:                 // below: Number count of ONTs with non-trivial ont_serial numbers (neither 'ALCL00000000' nor NULL) in every PON
  131:  
  132:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumberCountOfONTsWithNonTrivialOnt_SerialNumbersInEveryPON(ref sb, ref count);
  133:             }
  134:  
  135:             else if (commandArgument == "112")
  136:             {
  137:                 // below: IPs of ONT Id positions that do not have corresponding field in supplier file
  138:  
  139:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnIPsOfONTIdPositionsThatDoNotHaveCorrespondingFieldInSupplierFile(ref sb, ref count);
  140:             }
  141:  
  142:             else if (commandArgument == "113")
  143:             {
  144:                 // below: Export Important Data to Text
  145:                 string[] sp2 = { "ia_field", "ia_standard", "ia_service_request_service", "ia_system", "ia_protocol" };
  146:  
  147:             }
  148:  
  149:             else if (commandArgument == "201")
  150:             {
  151:                 // below: ONTs with IPs that do not conform to the standard for their ONT ID
  152:  
  153:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTsWithIPsThatDoNotConformToTheStandardForTheirONTID(ref sb, ref count);
  154:             }
  155:             else if (commandArgument == "202")
  156:             {
  157:                 // below: Numbers with integrity issues
  158:  
  159:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumbersWithIntegrityIssues(ref sb, ref count);
  160:             }
  161:  
  162:             else if (commandArgument == "205")
  163:             {
  164:                 // below: IPs within protocol that belong to the second half of the GPON internal network numbering definition in NDD (Network Design Document)
  165:  
  166:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnIPsWithinProtocolThatBelongToTheSecondHalfOfTheGPONInternalNetworkNumberingDefinitionInTheNetworkDesignDocumentNDD(ref sb, ref count);
  167:             }
  168:  
  169:             else if (commandArgument == "208")
  170:             {
  171:                 // below: ONTs that have not applicable values in database (ont serial, state, or voip state is NULL)
  172:  
  173:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTsThatHaveNoApplicableValuesInDatabase(ref sb, ref count);
  174:             }
  175:  
  176:             else if (commandArgument == "209")
  177:             {
  178:                 // below: Numbers within System but not in Service Request Service
  179:  
  180:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumbersWithinSystemButNotInServiceRequestService(ref sb, ref count);
  181:             }
  182:  
  183:             else if (commandArgument == "210")
  184:             {
  185:                 // below: Differences between Supplier ONT ID address data and actual customer givin address for provisioned services
  186:  
  187:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnDifferencesBetweenSupplierONTIDAddressDataAndActualCustomerGivinAddressForProvisionedServices(ref sb, ref count);
  188:             }
  189:  
  190:             else if (commandArgument == "211")
  191:             {
  192:                 // below: ONT positions with same IP within AMS
  193:  
  194:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTPositionsWithSameIPWithinAMS(ref sb, ref count);
  195:             }
  196:  
  197:             else if (commandArgument == "212")
  198:             {
  199:                 // below: ONT record in Standard but not in Ont
  200:  
  201:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTRecordsInStandardButNotInOnt(ref sb, ref count);
  202:             }
  203:  
  204:             else if (commandArgument == "213")
  205:             {
  206:                 // below: ONT record in Ont but not in Standard
  207:  
  208:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTRecordsInOntButNotInStandard(ref sb, ref count);
  209:             }
  210:  
  211:             else if (commandArgument == "214")
  212:             {
  213:                 // below: Numbers within System, Service, or Service_Active but not in Service Request Service
  214:  
  215:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnNumbersWithinSystemOrServiceOrService_ActiveButNotInServiceRequestService(ref sb, ref count);
  216:             }
  217:  
  218:             else if (commandArgument == "215")
  219:             {
  220:                 // below: ONT serials within Supplier data that are different from the ONT serials retrieved from AMS for the same ONT positions (excluding 'ALCL00000000' serials)
  221:  
  222:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTSerialsWithinSupplierDataThatAreDifferentFromTheONTSerialsRetrievedFromAMSForTheSameONTPositionsExcludingALCL00000000Serials(ref sb, ref count);
  223:             }
  224:  
  225:             else if (commandArgument == "216")
  226:             {
  227:                 // below: ONT records in Ont_Voip but not in Ont
  228:  
  229:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnONTRecordsInOnt_VoipButNotInOnt(ref sb, ref count);
  230:             }
  231:  
  232:             else if (commandArgument == "217")
  233:             {
  234:                 // below: Duplicate ONT serials within Supplier data and the current corresponding AMS ONT serials
  235:  
  236:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnDuplicateONTSerialsWithinSupplierDataAndTheCurrentCorrespondingAMSONTSerials(ref sb, ref count);
  237:             }
  238:  
  239:             else if (commandArgument == "218")
  240:             {
  241:                 // below: Duplicate ONT serials within AMS
  242:  
  243:                 //Ia.Ftn.Cl.Models.Data.Maintenance.ReturnDuplicateONTSerialsWithinAMS(ref sb, ref count);
  244:             }
  245:  
  246:             // below: title of function
  247:             //scriptViewModel.TitleLabel = ((LinkButton)sender).Text;
  248:  
  249:  
  250:             if (result.Length > 0)
  251:             {
  252:                 scriptViewModel.Result.AddError(result);
  253:             }
  254:  
  255:             // below: title of function
  256:             //scriptViewModel.TitleLabel = ((LinkButton)sender).Text;
  257:  
  258:             if (sb != null)
  259:             {
  260:                 // below: remove last ' ' char
  261:                 if (sb.Length > 0)
  262:                 {
  263:                     sb.Remove(sb.Length - 1, 1);
  264:  
  265:                     scriptViewModel.CountLabel = "Total of <u>" + count + "</u> records satisfy process condition.";
  266:  
  267:                     scriptViewModel.ScriptLiteral = sb.ToString();
  268:                 }
  269:                 else
  270:                 {
  271:                     scriptViewModel.CountLabel = "Total of 0 (zero) records satisfy process condition.";
  272:                 }
  273:             }
  274:             else
  275:             {
  276:                 scriptViewModel.Result.AddError("Returned StringBuilder values is null.");
  277:             }
  278:         }
  279:  
  280:         ////////////////////////////////////////////////////////////////////////////
  281:         ////////////////////////////////////////////////////////////////////////////
  282:  
  283:         /// <summary>
  284:         ///
  285:         /// </summary>
  286:         public static void AccessViewModel(ref Ia.Ftn.Wa.Models.Maintenance.ScriptViewModel scriptViewModel)
  287:         {
  288:             var list = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList;
  289:  
  290:             scriptViewModel.OltSelectList = new SelectList(list, "Id", "AmsName");
  291:         }
  292:  
  293:         ////////////////////////////////////////////////////////////////////////////
  294:  
  295:         /// <summary>
  296:         ///
  297:         /// </summary>
  298:         public static void GenerateScript(ref Ia.Ftn.Wa.Models.Maintenance.ScriptViewModel scriptViewModel)
  299:         {
  300:             bool edServiceVoipIsOos;
  301:             int count, oltId;
  302:             string result;
  303:             StringBuilder sb;
  304:  
  305:             count = 0;
  306:             result = string.Empty;
  307:             sb = null;
  308:  
  309:             oltId = int.Parse(scriptViewModel.OltSelectedValue);
  310:  
  311:             edServiceVoipIsOos = scriptViewModel.SetEdServiceVoipOosSelectedValue == "1";
  312:  
  313:             if (!string.IsNullOrEmpty(scriptViewModel.OltSelectedValue))
  314:             {
  315:                 switch (scriptViewModel.OltSelectedValue)
  316:                 {
  317:                     case "3": Ia.Ftn.Wa.Models.Business.Maintenance.Script.PreprovisionAllOntsAsDefinedInNddDocumentWithinOlt(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  318:                     case "4": Ia.Ftn.Wa.Models.Business.Maintenance.Script.PreprovisionOntThatAreNotProvisionedAsDefinedInNddDocumentWithinAnOlt(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  319:                     case "5": break;
  320:                     case "6": break;
  321:                     case "7": Ia.Ftn.Wa.Models.Business.Maintenance.Script.DeleteAndReCreateVoipsAndOntpotsToHaveErrorsInMgcPrimaryAndOrSecondaryIpValuesWithinAOltToMakeThemMatchTheFtnDocumentMgcIpSpecification(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  322:                     case "8": Ia.Ftn.Wa.Models.Business.Maintenance.Script.DeleteAndReCreateVoipsAndOntpotsForAllPossibleCompleteSetOfOntsInAOltToSetVoipsMgcPrimaryAndSecondaryIpsAccordingToFtnDocument(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  323:                     case "9": Ia.Ftn.Wa.Models.Business.Maintenance.Script.CreateMissingOntpotsForDefinedOntsWithValidAccess(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  324:                     case "10": Ia.Ftn.Wa.Models.Business.Maintenance.Script.CreateOntPotsForAllPossibleCompleteSetOfOntWithValidAccess(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  325:                     case "11": Ia.Ftn.Wa.Models.Business.Maintenance.Script.PreprovisionAllOntsAsDefinedInNddDocumentWithinOltUsingConfigureCommand(oltId, edServiceVoipIsOos, ref sb, out count, ref result); break;
  326:                     default: break;
  327:                 }
  328:             }
  329:             else
  330:             {
  331:             }
  332:  
  333:             // below: title of function
  334:             //scriptViewModel.TitleLabel = ((Button)sender).Text;
  335:  
  336:             if (count > 0)
  337:             {
  338:                 // below: remove last ' ' char
  339:                 sb.Remove(sb.Length - 1, 1);
  340:  
  341:                 scriptViewModel.CountLabel = "Total of <u>" + count + "</u> script lines. ";
  342:  
  343:                 if (scriptViewModel.RemoveCommentSelectedValue == "1") Ia.Ftn.Cl.Models.Ui.Default.RemoveAllComments(ref sb);
  344:  
  345:                 scriptViewModel.ScriptLiteral = sb.ToString().Trim();
  346:             }
  347:             else
  348:             {
  349:                 scriptViewModel.CountLabel = "Total of 0 (zero) script lines. ";
  350:             }
  351:         }
  352:  
  353:         ////////////////////////////////////////////////////////////////////////////
  354:         ////////////////////////////////////////////////////////////////////////////
  355:     }
  356:  
  357:     ////////////////////////////////////////////////////////////////////////////
  358:     ////////////////////////////////////////////////////////////////////////////
  359: }