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

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

Script support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.

    1: using System;
    2: using System.Collections;
    3: using System.Collections.Generic;
    4: using System.Data;
    5: using System.Linq;
    6: using System.Text;
    7:  
    8: namespace Ia.Ftn.Wa.Models.Business.Maintenance
    9: {
   10:     ////////////////////////////////////////////////////////////////////////////
   11:  
   12:     /// <summary publish="true">
   13:     /// Script support class for Fixed Telecommunications Network (FTN) web application (Intranet) model.
   14:     /// </summary>
   15:     /// 
   16:     /// <remarks> 
   17:     /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   18:     /// </remarks> 
   19:     public class Script
   20:     {
   21:         ////////////////////////////////////////////////////////////////////////////
   22:  
   23:         /// <summary>
   24:         ///
   25:         /// </summary>
   26:         public Script() { }
   27:  
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         public static void PreprovisionOntThatAreNotProvisionedAsDefinedInNddDocumentWithinAnOlt(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
   34:         {
   35:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Olt olt;
   36:             List<string> list;
   37:  
   38:             olt = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList 
   39:                    where o.Id == oltId 
   40:                    select o).SingleOrDefault();
   41:  
   42:             list = Ia.Ftn.Cl.Models.Business.Nokia.Ams.AmsCommandsToPreprovisionOntThatAreNotProvisionedAsDefinedInNddDocumentWithinAnOltList(olt, false, edServiceVoipIsOos, out count);
   43:  
   44:             Ia.Ftn.Cl.Models.Ui.Default.ConvertArrayListContentToString(list, ref sb, ref result);
   45:         }
   46:  
   47:         ////////////////////////////////////////////////////////////////////////////
   48:  
   49:         /// <summary>
   50:         ///
   51:         /// </summary>
   52:         public static void PreprovisionAllOntsAsDefinedInNddDocumentWithinOlt(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
   53:         {
   54:             List<string> list;
   55:  
   56:             list = Ia.Ftn.Cl.Models.Business.Nokia.Ams.AmsCommandsToPreprovisionAllOntsAsDefinedInNddDocumentWithinOltList(oltId, edServiceVoipIsOos, out count);
   57:  
   58:             Ia.Ftn.Cl.Models.Ui.Default.ConvertArrayListContentToString(list, ref sb, ref result);
   59:         }
   60:  
   61:         ////////////////////////////////////////////////////////////////////////////
   62:  
   63:         /// <summary>
   64:         ///
   65:         /// </summary>
   66:         public static void DeleteAndReCreateVoipsAndOntpotsForAllPossibleCompleteSetOfOntsInAOltToSetVoipsMgcPrimaryAndSecondaryIpsAccordingToFtnDocument(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
   67:         {
   68:             // below:
   69:             string sa;
   70:             Ia.Ftn.Cl.Models.Ont ont;
   71:             List<Ia.Ftn.Cl.Models.Ont> ontList;
   72:             List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList;
   73:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Olt olt;
   74:  
   75:             sb = new StringBuilder();
   76:  
   77:             count = 0;
   78:             olt = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList 
   79:                    where o.Id == oltId 
   80:                    select o).SingleOrDefault();
   81:  
   82:             if (olt != null)
   83:             {
   84:                 ontList = Ia.Ftn.Cl.Models.Data.Nokia.Ont.ReadListIncludeOntServiceVoipsAndAccess((int)olt.Id);
   85:  
   86:                 nddOntList = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList 
   87:                               where o.Pon.PonGroup.Olt.Id == oltId 
   88:                               select o).ToList();
   89:  
   90:                 foreach (Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt in nddOntList)
   91:                 {
   92:                     ont = (from o in ontList where o.Access.Pon == nddOnt.Pon.Number && o.Access.Ont == nddOnt.Number select o).SingleOrDefault();
   93:  
   94:                     sa = Ia.Ftn.Cl.Models.Business.Nokia.Ams.CommandsToDeleteAndCreateServiceVoipUsingNdd(olt, ont, nddOnt, edServiceVoipIsOos);
   95:  
   96:                     sb.Append(sa);
   97:                     count++;
   98:                 }
   99:             }
  100:             else
  101:             {
  102:                 throw new Exception(@"Error: olt is null. ") { };
  103:             }
  104:         }
  105:  
  106:         ////////////////////////////////////////////////////////////////////////////
  107:  
  108:         /// <summary>
  109:         ///
  110:         /// </summary>
  111:         public static void DeleteAndReCreateVoipsAndOntpotsToHaveErrorsInMgcPrimaryAndOrSecondaryIpValuesWithinAOltToMakeThemMatchTheFtnDocumentMgcIpSpecification(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  112:         {
  113:             // below:
  114:             bool b;
  115:             string sa;
  116:             Ia.Ftn.Cl.Models.Ont ont;
  117:             List<Ia.Ftn.Cl.Models.Ont> ontList;
  118:             List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList;
  119:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Olt olt;
  120:  
  121:             sb = new StringBuilder();
  122:  
  123:             count = 0;
  124:             olt = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList 
  125:                    where o.Id == oltId 
  126:                    select o).SingleOrDefault();
  127:  
  128:             if (olt != null)
  129:             {
  130:                 ontList = Ia.Ftn.Cl.Models.Data.Nokia.Ont.ReadListIncludeOntServiceVoipsAndAccess((int)olt.Id);
  131:  
  132:                 nddOntList = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList 
  133:                               where o.Pon.PonGroup.Olt.Id == oltId 
  134:                               select o).ToList();
  135:  
  136:                 foreach (Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt in nddOntList)
  137:                 {
  138:                     ont = (from a in ontList where a.Access.Olt == nddOnt.Pon.PonGroup.Olt.Id && a.Access.Pon == nddOnt.Pon.Number && a.Access.Ont == nddOnt.Number select a).SingleOrDefault();
  139:  
  140:                     if (ont != null)
  141:                     {
  142:                         b = (from osv in ont.OntServiceVoips where osv.MgcIp != nddOnt.MgcIp || osv.MgcSecondaryIp != nddOnt.MgcSecondaryIp select true).SingleOrDefault();
  143:  
  144:                         if (b)
  145:                         {
  146:                             sa = Ia.Ftn.Cl.Models.Business.Nokia.Ams.CommandsToDeleteAndCreateServiceVoipUsingNdd(olt, ont, nddOnt, edServiceVoipIsOos);
  147:  
  148:                             sb.Append(sa);
  149:                             count++;
  150:                         }
  151:                         else
  152:                         {
  153:                         }
  154:                     }
  155:                     else
  156:                     {
  157:                     }
  158:                 }
  159:             }
  160:             else
  161:             {
  162:                 throw new Exception(@"Error: olt is null. ") { };
  163:             }
  164:         }
  165:  
  166:         ////////////////////////////////////////////////////////////////////////////
  167:  
  168:         /// <summary>
  169:         ///
  170:         /// </summary>
  171:         public static void CreateMissingOntpotsForDefinedOntsWithValidAccess(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  172:         {
  173:             string sa;
  174:             Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType familyType;
  175:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
  176:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Olt olt;
  177:             List<Ia.Ftn.Cl.Models.Ont> ontList, ontWithMissingPotsList;
  178:  
  179:             sb = new StringBuilder();
  180:  
  181:             count = 0;
  182:             olt = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList 
  183:                    where o.Id == oltId 
  184:                    select o).Single();
  185:  
  186:             ontList = Ia.Ftn.Cl.Models.Data.Nokia.Ont.ListIncludeAccessAndOntOntPots(oltId);
  187:             ontWithMissingPotsList = new List<Ia.Ftn.Cl.Models.Ont>(ontList.Count);
  188:  
  189:             foreach (Ia.Ftn.Cl.Models.Ont ont in ontList)
  190:             {
  191:                 familyType = (Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)ont.FamilyTypeId;
  192:  
  193:                 if (familyType != (int)Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType.Undefined)
  194:                 {
  195:                     var list = Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossiblePotsCardPortConfigurationForOntFamilyTypeList(familyType);
  196:  
  197:                     if (ont.OntOntPotses.Count != list.Count && ont.Access != null) ontWithMissingPotsList.Add(ont);
  198:                 }
  199:             }
  200:  
  201:             if (ontWithMissingPotsList.Count > 0)
  202:             {
  203:                 foreach (Ia.Ftn.Cl.Models.Ont ont in ontWithMissingPotsList)
  204:                 {
  205:                     nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntIdToOntDictionary.ContainsKey(ont.Id) ? Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntIdToOntDictionary[ont.Id] : null;
  206:  
  207:                     sa = Ia.Ftn.Cl.Models.Business.Nokia.Ams.CommandsToCreateOntPots(olt, ont, nddOnt, edServiceVoipIsOos);
  208:  
  209:                     sb.Append(sa);
  210:                     count++;
  211:                 }
  212:             }
  213:             else
  214:             {
  215:                 result = @"Success: No missing POTS in network. ";
  216:             }
  217:         }
  218:  
  219:         ////////////////////////////////////////////////////////////////////////////
  220:  
  221:         /// <summary>
  222:         ///
  223:         /// </summary>
  224:         public static void CreateOntPotsForAllPossibleCompleteSetOfOntWithValidAccess(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  225:         {
  226:             string sa;
  227:             Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType familyType;
  228:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
  229:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Olt olt;
  230:             List<Ia.Ftn.Cl.Models.Ont> ontList;
  231:  
  232:             sb = new StringBuilder();
  233:  
  234:             count = 0;
  235:             olt = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList 
  236:                    where o.Id == oltId 
  237:                    select o).Single();
  238:  
  239:             ontList = Ia.Ftn.Cl.Models.Data.Nokia.Ont.ListIncludeAccessAndOntOntPots(oltId);
  240:  
  241:             foreach (Ia.Ftn.Cl.Models.Ont ont in ontList)
  242:             {
  243:                 familyType = (Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)ont.FamilyTypeId;
  244:  
  245:                 if (familyType == (int)Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType.Undefined)
  246:                     familyType = Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType.Sfu;
  247:  
  248:                 ont.FamilyTypeId = (int)familyType;
  249:  
  250:                 nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntIdToOntDictionary.ContainsKey(ont.Id) ? Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntIdToOntDictionary[ont.Id] : null;
  251:  
  252:                 sa = Ia.Ftn.Cl.Models.Business.Nokia.Ams.CommandsToCreateOntPots(olt, ont, nddOnt, edServiceVoipIsOos);
  253:  
  254:                 sb.Append(sa);
  255:                 count++;
  256:             }
  257:         }
  258:  
  259:         ////////////////////////////////////////////////////////////////////////////
  260:  
  261:         /// <summary>
  262:         ///
  263:         /// </summary>
  264:         public static void PreprovisionAllOntsAsDefinedInNddDocumentWithinOltUsingConfigureCommand(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  265:         {
  266:             // below:
  267:             string sa;
  268:             List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList;
  269:  
  270:             count = 0;
  271:  
  272:             using (var db = new Ia.Ftn.Cl.Db())
  273:             {
  274:                 sb = new StringBuilder();
  275:  
  276:                 nddOntList = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList 
  277:                               where o.Pon.PonGroup.Olt.Id == oltId 
  278:                               select o).ToList();
  279:  
  280:                 foreach (Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt in nddOntList)
  281:                 {
  282:                     sa = Ia.Ftn.Cl.Models.Business.Nokia.Ams.CommandsToPreprovisionOntWithinOltUsingConfigureCommand(nddOnt, edServiceVoipIsOos);
  283:  
  284:                     sb.Append(sa);
  285:                     count++;
  286:                 }
  287:             }
  288:         }
  289:  
  290:         ////////////////////////////////////////////////////////////////////////////
  291:         ////////////////////////////////////////////////////////////////////////////   
  292:     }
  293:  
  294:     ////////////////////////////////////////////////////////////////////////////
  295:     ////////////////////////////////////////////////////////////////////////////   
  296: }