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

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) class library model.

   1:  using System;
   2:  using System.Web;
   3:  using System.Xml;
   4:  using System.Xml.Linq;
   5:  using System.IO;
   6:  using System.Configuration;
   7:  using System.Text;
   8:  using System.Text.RegularExpressions;
   9:  using System.Data;
  10:  using System.Data.SqlClient;
  11:  using System.Web.UI;
  12:  using System.Web.UI.WebControls;
  13:  using System.Collections;
  14:  using System.Collections.Generic;
  15:  using System.Linq;
  16:   
  17:  namespace Ia.Ngn.Cl.Model.Business.Maintenance
  18:  {
  19:      ////////////////////////////////////////////////////////////////////////////
  20:   
  21:      /// <summary publish="true">
  22:      /// Script support class for Next Generation Network (NGN) class library model.
  23:      /// </summary>
  24:      /// 
  25:      /// <remarks> 
  26:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  27:      ///
  28:      /// 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
  29:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  30:      ///
  31:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  32:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  33:      /// 
  34:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  35:      /// 
  36:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  37:      /// </remarks> 
  38:      public class Script
  39:      {
  40:          ////////////////////////////////////////////////////////////////////////////
  41:   
  42:          /// <summary>
  43:          ///
  44:          /// </summary>
  45:          public Script() { }
  46:   
  47:          ////////////////////////////////////////////////////////////////////////////
  48:   
  49:          /// <summary>
  50:          ///
  51:          /// </summary>
  52:          public static void InsertMissingAccessEntriesByUsingStatisticalAddressEstimationGeneratedFromServiceRequestOrderAddressesAndCurrentOntAndNetworkDesignDocumentPosition(ref StringBuilder sb, out int count, ref string result)
  53:          {
  54:              string sa, accessName, address, level;
  55:              Hashtable hashTable, accessNameHashtable;
  56:              Dictionary<string, string> ontAccessIdToOntAccessNameDictionary, serviceOntIdDictionary;
  57:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
  58:              //Ia.Ngn.Cl.Model.Ont ont;
  59:              Ia.Ngn.Cl.Model.Business.ServiceAddress serviceAddress;
  60:              List<string> accessNameList;
  61:              List<Ia.Ngn.Cl.Model.Ont> ontList;
  62:              List<Ia.Ngn.Cl.Model.ServiceRequestService> serviceRequestServiceList;
  63:              List<Ia.Ngn.Cl.Model.Nokia.AgcfGatewayRecord> agcfGatewayRecordList;
  64:              List<Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint> agcfEndpointList;
  65:   
  66:              sb = new StringBuilder();
  67:   
  68:              count = 0;
  69:              accessNameList = Ia.Ngn.Cl.Model.Data.Nokia.Ont.ReadNetworkDesignDocumentAccessNameListWithOntEquipmentIdNotNullAndAccessIsNullIncludeOntServiceVoips;
  70:   
  71:              ontAccessIdToOntAccessNameDictionary = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary;
  72:   
  73:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  74:              {
  75:                  ontList = (from o in db.Onts where o.EquipmentId != null && o.Access == null select o).ToList();
  76:   
  77:                  serviceRequestServiceList = (from srs in db.ServiceRequestServices select srs).ToList();
  78:                  agcfGatewayRecordList = (from gr in db.AgcfGatewayRecords select gr).ToList();
  79:                  agcfEndpointList = (from e in db.AgcfEndpoints select e).ToList();
  80:   
  81:                  hashTable = Ia.Ngn.Cl.Model.Data.ServiceRequest.NumberToCustomerAddressHashtable(null);
  82:   
  83:                  serviceOntIdDictionary = (from o in ontList
  84:                                            join Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList on o.Id equals n.Id
  85:                                            join gr in agcfGatewayRecordList on n.Ip equals gr.IP1
  86:                                            join e in agcfEndpointList on gr.Id equals e.AgcfGatewayRecord.Id
  87:                                            join srs in serviceRequestServiceList on e.Dn equals "+965" + srs.Service
  88:                                            select new { srs.Service, o.Id }).ToDictionary(u => u.Service, u => u.Id);
  89:   
  90:                  accessNameHashtable = new Hashtable(serviceOntIdDictionary.Count);
  91:   
  92:                  foreach (KeyValuePair<string, string> kvp in serviceOntIdDictionary)
  93:                  {
  94:                      if (hashTable[kvp.Key] != null)
  95:                      {
  96:                          address = hashTable[kvp.Key].ToString();
  97:                          serviceAddress = Ia.Ngn.Cl.Model.Business.ServiceRequest.StatisticalServiceAddress(kvp.Key, address, out level);
  98:   
  99:                          if (ontAccessIdToOntAccessNameDictionary.ContainsKey(kvp.Value) && serviceAddress != null)
 100:                          {
 101:                              accessName = ontAccessIdToOntAccessNameDictionary[kvp.Value];
 102:                              accessNameHashtable[accessName] = serviceAddress;
 103:                          }
 104:                      }
 105:                  }
 106:              }
 107:   
 108:              foreach (string an in accessNameHashtable.Keys)
 109:              {
 110:                  serviceAddress = accessNameHashtable[an] as Ia.Ngn.Cl.Model.Business.ServiceAddress;
 111:   
 112:                  nddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Access.Name == an select n).SingleOrDefault();
 113:   
 114:                  if (nddOnt != null)
 115:                  {
 116:                      sa = Ia.Ngn.Cl.Model.Business.Access.SqlInsertCommand(nddOnt, serviceAddress.AreaId, serviceAddress.Block, serviceAddress.Street, serviceAddress.PremisesOld, serviceAddress.PremisesNew, serviceAddress.Paci);
 117:   
 118:                      sb.AppendLine(sa);
 119:   
 120:                      count++;
 121:                  }
 122:              }
 123:          }
 124:   
 125:          ////////////////////////////////////////////////////////////////////////////
 126:          ////////////////////////////////////////////////////////////////////////////   
 127:      }
 128:   
 129:      ////////////////////////////////////////////////////////////////////////////
 130:      ////////////////////////////////////////////////////////////////////////////   
 131:  }