شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Script

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

Script support class for Next Generation Network (NGN) 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:  using System.Web.UI.WebControls;
   8:   
   9:  namespace Ia.Ngn.Ofn.Wa.Model.Business.Maintenance
  10:  {
  11:      ////////////////////////////////////////////////////////////////////////////
  12:   
  13:      /// <summary publish="true">
  14:      /// Script support class for Next Generation Network (NGN) web application (Intranet) model.
  15:      /// </summary>
  16:      /// 
  17:      /// <remarks> 
  18:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  19:      ///
  20:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  21:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  22:      ///
  23:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  24:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  25:      /// 
  26:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  27:      /// 
  28:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  29:      /// </remarks> 
  30:      public class Script
  31:      {
  32:          ////////////////////////////////////////////////////////////////////////////
  33:   
  34:          /// <summary>
  35:          ///
  36:          /// </summary>
  37:          public Script() { }
  38:   
  39:          ////////////////////////////////////////////////////////////////////////////
  40:   
  41:          /// <summary>
  42:          ///
  43:          /// </summary>
  44:          public static void PreprovisionOntThatAreNotProvisionedAsDefinedInNddDocumentWithinAnOlt(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  45:          {
  46:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt;
  47:              List<string> list;
  48:   
  49:              olt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == oltId select o).SingleOrDefault();
  50:   
  51:              list = Ia.Ngn.Cl.Model.Business.Nokia.Ams.AmsCommandsToPreprovisionOntThatAreNotProvisionedAsDefinedInNddDocumentWithinAnOltList(olt, false, edServiceVoipIsOos, out count);
  52:   
  53:              Ia.Ngn.Cl.Model.Ui.Default.ConvertArrayListContentToString(list, ref sb, ref result);
  54:          }
  55:   
  56:          ////////////////////////////////////////////////////////////////////////////
  57:   
  58:          /// <summary>
  59:          ///
  60:          /// </summary>
  61:          public static void PreprovisionAllOntsAsDefinedInNddDocumentWithinOlt(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  62:          {
  63:              List<string> list;
  64:   
  65:              list = Ia.Ngn.Cl.Model.Business.Nokia.Ams.AmsCommandsToPreprovisionAllOntsAsDefinedInNddDocumentWithinOltList(oltId, edServiceVoipIsOos, out count);
  66:   
  67:              Ia.Ngn.Cl.Model.Ui.Default.ConvertArrayListContentToString(list, ref sb, ref result);
  68:          }
  69:   
  70:          ////////////////////////////////////////////////////////////////////////////
  71:   
  72:          /// <summary>
  73:          ///
  74:          /// </summary>
  75:          public static void DeleteAndReCreateVoipsAndOntpotsForAllPossibleCompleteSetOfOntsInAOltToSetVoipsMgcPrimaryAndSecondaryIpsAccordingToNgnDocument(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
  76:          {
  77:              // below:
  78:              string sa;
  79:              Ia.Ngn.Cl.Model.Ont ont;
  80:              List<Ia.Ngn.Cl.Model.Ont> ontList;
  81:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList;
  82:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt;
  83:   
  84:              sb = new StringBuilder();
  85:   
  86:              count = 0;
  87:              olt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == oltId select o).SingleOrDefault();
  88:   
  89:              if (olt != null)
  90:              {
  91:                  ontList = Ia.Ngn.Cl.Model.Data.Nokia.Ont.ReadListIncludeOntServiceVoipsAndAccess((int)olt.Id);
  92:                  nddOntList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Pon.PonGroup.Olt.Id == oltId select o).ToList();
  93:   
  94:                  foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt in nddOntList)
  95:                  {
  96:                      ont = (from o in ontList where o.Access.Pon == nddOnt.Pon.Number && o.Access.Ont == nddOnt.Number select o).SingleOrDefault();
  97:   
  98:                      sa = Ia.Ngn.Cl.Model.Business.Nokia.Ams.CommandsToDeleteAndCreateServiceVoipUsingNdd(olt, ont, nddOnt, edServiceVoipIsOos);
  99:   
 100:                      sb.Append(sa);
 101:                      count++;
 102:                  }
 103:              }
 104:              else
 105:              {
 106:                  throw new Exception(@"Error: olt is null. ") { };
 107:              }
 108:          }
 109:   
 110:          ////////////////////////////////////////////////////////////////////////////
 111:   
 112:          /// <summary>
 113:          ///
 114:          /// </summary>
 115:          public static void DeleteAndReCreateVoipsAndOntpotsToHaveErrorsInMgcPrimaryAndOrSecondaryIpValuesWithinAOltToMakeThemMatchTheNgnDocumentMgcIpSpecification(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
 116:          {
 117:              // below:
 118:              bool b;
 119:              string sa;
 120:              Ia.Ngn.Cl.Model.Ont ont;
 121:              List<Ia.Ngn.Cl.Model.Ont> ontList;
 122:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList;
 123:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt;
 124:   
 125:              sb = new StringBuilder();
 126:   
 127:              count = 0;
 128:              olt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == oltId select o).SingleOrDefault();
 129:   
 130:              if (olt != null)
 131:              {
 132:                  ontList = Ia.Ngn.Cl.Model.Data.Nokia.Ont.ReadListIncludeOntServiceVoipsAndAccess((int)olt.Id);
 133:                  nddOntList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Pon.PonGroup.Olt.Id == oltId select o).ToList();
 134:   
 135:                  foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt in nddOntList)
 136:                  {
 137:                      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();
 138:   
 139:                      if (ont != null)
 140:                      {
 141:                          b = (from osv in ont.OntServiceVoips where osv.MgcIp != nddOnt.MgcIp || osv.MgcSecondaryIp != nddOnt.MgcSecondaryIp select true).SingleOrDefault();
 142:   
 143:                          if (b)
 144:                          {
 145:                              sa = Ia.Ngn.Cl.Model.Business.Nokia.Ams.CommandsToDeleteAndCreateServiceVoipUsingNdd(olt, ont, nddOnt, edServiceVoipIsOos);
 146:   
 147:                              sb.Append(sa);
 148:                              count++;
 149:                          }
 150:                          else
 151:                          {
 152:                          }
 153:                      }
 154:                      else
 155:                      {
 156:                      }
 157:                  }
 158:              }
 159:              else
 160:              {
 161:                  throw new Exception(@"Error: olt is null. ") { };
 162:              }
 163:          }
 164:   
 165:          ////////////////////////////////////////////////////////////////////////////
 166:   
 167:          /// <summary>
 168:          ///
 169:          /// </summary>
 170:          public static void CreateMissingOntpotsForDefinedOntsWithValidAccess(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
 171:          {
 172:              string sa;
 173:              ArrayList al;
 174:              Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType familyType;
 175:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 176:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt;
 177:              List<Ia.Ngn.Cl.Model.Ont> ontList, ontWithMissingPotsList;
 178:   
 179:              sb = new StringBuilder();
 180:   
 181:              count = 0;
 182:              olt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == oltId select o).Single();
 183:   
 184:              ontList = Ia.Ngn.Cl.Model.Data.Nokia.Ont.ListIncludeAccessAndOntOntPots(oltId);
 185:              ontWithMissingPotsList = new List<Ia.Ngn.Cl.Model.Ont>(ontList.Count);
 186:   
 187:              foreach (Ia.Ngn.Cl.Model.Ont ont in ontList)
 188:              {
 189:                  familyType = (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)ont.FamilyTypeId;
 190:   
 191:                  if (familyType != (int)Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined)
 192:                  {
 193:                      al = Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossiblePotsCardPortConfigurationForOntFamilyTypeArrayList(familyType);
 194:   
 195:                      if (ont.OntOntPotses.Count != al.Count && ont.Access != null) ontWithMissingPotsList.Add(ont);
 196:                  }
 197:              }
 198:   
 199:              if (ontWithMissingPotsList.Count > 0)
 200:              {
 201:                  foreach (Ia.Ngn.Cl.Model.Ont ont in ontWithMissingPotsList)
 202:                  {
 203:                      nddOnt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Id == ont.Id select o).SingleOrDefault();
 204:   
 205:                      sa = Ia.Ngn.Cl.Model.Business.Nokia.Ams.CommandsToCreateOntPots(olt, ont, nddOnt, edServiceVoipIsOos);
 206:   
 207:                      sb.Append(sa);
 208:                      count++;
 209:                  }
 210:              }
 211:              else
 212:              {
 213:                  result = @"Success: No missing POTS in network. ";
 214:              }
 215:          }
 216:   
 217:          ////////////////////////////////////////////////////////////////////////////
 218:   
 219:          /// <summary>
 220:          ///
 221:          /// </summary>
 222:          public static void CreateOntPotsForAllPossibleCompleteSetOfOntWithValidAccess(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
 223:          {
 224:              string sa;
 225:              Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType familyType;
 226:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 227:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt;
 228:              List<Ia.Ngn.Cl.Model.Ont> ontList;
 229:   
 230:              sb = new StringBuilder();
 231:   
 232:              count = 0;
 233:              olt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == oltId select o).Single();
 234:   
 235:              ontList = Ia.Ngn.Cl.Model.Data.Nokia.Ont.ListIncludeAccessAndOntOntPots(oltId);
 236:   
 237:              foreach (Ia.Ngn.Cl.Model.Ont ont in ontList)
 238:              {
 239:                  familyType = (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)ont.FamilyTypeId;
 240:   
 241:                  if (familyType == (int)Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Undefined)
 242:                      familyType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType.Sfu;
 243:   
 244:                  ont.FamilyTypeId = (int)familyType;
 245:   
 246:                  nddOnt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Id == ont.Id select o).SingleOrDefault();
 247:   
 248:                  sa = Ia.Ngn.Cl.Model.Business.Nokia.Ams.CommandsToCreateOntPots(olt, ont, nddOnt, edServiceVoipIsOos);
 249:   
 250:                  sb.Append(sa);
 251:                  count++;
 252:              }
 253:          }
 254:   
 255:          ////////////////////////////////////////////////////////////////////////////
 256:   
 257:          /// <summary>
 258:          ///
 259:          /// </summary>
 260:          public static void PreprovisionAllOntsAsDefinedInNddDocumentWithinOltUsingConfigureCommand(int oltId, bool edServiceVoipIsOos, ref StringBuilder sb, out int count, ref string result)
 261:          {
 262:              // below:
 263:              string sa;
 264:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList;
 265:   
 266:              count = 0;
 267:   
 268:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 269:              {
 270:                  sb = new StringBuilder();
 271:   
 272:                  nddOntList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Pon.PonGroup.Olt.Id == oltId select o).ToList();
 273:   
 274:                  foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt in nddOntList)
 275:                  {
 276:                      sa = Ia.Ngn.Cl.Model.Business.Nokia.Ams.CommandsToPreprovisionOntWithinOltUsingConfigureCommand(nddOnt, edServiceVoipIsOos);
 277:   
 278:                      sb.Append(sa);
 279:                      count++;
 280:                  }
 281:              }
 282:          }
 283:   
 284:          ////////////////////////////////////////////////////////////////////////////
 285:          ////////////////////////////////////////////////////////////////////////////   
 286:      }
 287:   
 288:      ////////////////////////////////////////////////////////////////////////////
 289:      ////////////////////////////////////////////////////////////////////////////   
 290:  }