)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Script (Ia.Ftn.Cl.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) class library model.

    1: using System.Collections;
    2: using System.Collections.Generic;
    3: using System.Data;
    4: using System.Linq;
    5: using System.Text;
    6:  
    7: namespace Ia.Ftn.Cl.Models.Business.Maintenance
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Script support class for Fixed Telecommunications Network (FTN) class library model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     /// </remarks> 
   18:     public class Script
   19:     {
   20:         ////////////////////////////////////////////////////////////////////////////
   21:  
   22:         /// <summary>
   23:         ///
   24:         /// </summary>
   25:         public Script() { }
   26:  
   27:         ////////////////////////////////////////////////////////////////////////////
   28:  
   29:         /// <summary>
   30:         ///
   31:         /// </summary>
   32:         public static void InsertMissingAccessEntriesByUsingStatisticalAddressEstimationGeneratedFromServiceRequestOrderAddressesAndCurrentOntAndNetworkDesignDocumentPosition(ref StringBuilder sb, out int count, ref string result)
   33:         {
   34:             string sa, accessName, address, level;
   35:             Hashtable hashTable, accessNameHashtable;
   36:             Dictionary<string, string> ontAccessIdToOntAccessNameDictionary, serviceOntIdDictionary;
   37:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
   38:             //Ia.Ftn.Cl.Model.Ont ont;
   39:             Ia.Ftn.Cl.Models.Business.ServiceAddress serviceAddress;
   40:             List<string> accessNameList;
   41:             List<Ia.Ftn.Cl.Models.Ont> ontList;
   42:             List<Ia.Ftn.Cl.Models.ServiceRequestService> serviceRequestServiceList;
   43:             List<Ia.Ftn.Cl.Models.Nokia.AgcfGatewayRecord> agcfGatewayRecordList;
   44:             List<Ia.Ftn.Cl.Models.Nokia.AgcfEndpoint> agcfEndpointList;
   45:  
   46:             sb = new StringBuilder();
   47:  
   48:             count = 0;
   49:             accessNameList = Ia.Ftn.Cl.Models.Data.Nokia.Ont.ReadNetworkDesignDocumentAccessNameListWithOntEquipmentIdNotNullAndAccessIsNullIncludeOntServiceVoips;
   50:  
   51:             ontAccessIdToOntAccessNameDictionary = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary;
   52:  
   53:             using (var db = new Ia.Ftn.Cl.Db())
   54:             {
   55:                 ontList = (from o in db.Onts where o.EquipmentId != null && o.Access == null select o).ToList();
   56:  
   57:                 serviceRequestServiceList = (from srs in db.ServiceRequestServices select srs).ToList();
   58:                 agcfGatewayRecordList = (from gr in db.AgcfGatewayRecords select gr).ToList();
   59:                 agcfEndpointList = (from e in db.AgcfEndpoints select e).ToList();
   60:  
   61:                 hashTable = Ia.Ftn.Cl.Models.Data.ServiceRequest.NumberToCustomerAddressHashtable(null);
   62:  
   63:                 serviceOntIdDictionary = (from o in ontList
   64:                                           join Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont n in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList on o.Id equals n.Id
   65:                                           join gr in agcfGatewayRecordList on n.Ip equals gr.IP1
   66:                                           join e in agcfEndpointList on gr.Id equals e.AgcfGatewayRecord.Id
   67:                                           join srs in serviceRequestServiceList on e.Dn equals "+965" + srs.Service
   68:                                           select new { srs.Service, o.Id }).ToDictionary(u => u.Service, u => u.Id);
   69:  
   70:                 accessNameHashtable = new Hashtable(serviceOntIdDictionary.Count);
   71:  
   72:                 foreach (KeyValuePair<string, string> kvp in serviceOntIdDictionary)
   73:                 {
   74:                     if (hashTable[kvp.Key] != null)
   75:                     {
   76:                         address = hashTable[kvp.Key].ToString();
   77:                         serviceAddress = Ia.Ftn.Cl.Models.Business.ServiceRequest.ServiceAddress(kvp.Key, address, out level);
   78:  
   79:                         if (ontAccessIdToOntAccessNameDictionary.ContainsKey(kvp.Value) && serviceAddress != null)
   80:                         {
   81:                             accessName = ontAccessIdToOntAccessNameDictionary[kvp.Value];
   82:                             accessNameHashtable[accessName] = serviceAddress;
   83:                         }
   84:                     }
   85:                 }
   86:             }
   87:  
   88:             foreach (string accessName0 in accessNameHashtable.Keys)
   89:             {
   90:                 serviceAddress = accessNameHashtable[accessName0] as Ia.Ftn.Cl.Models.Business.ServiceAddress;
   91:  
   92:                 nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByAccessName(accessName0);
   93:  
   94:                 if (nddOnt != null)
   95:                 {
   96:                     sa = Ia.Ftn.Cl.Models.Business.Access.SqlInsertCommand(nddOnt, serviceAddress.AreaId, serviceAddress.Block, serviceAddress.Street, serviceAddress.PremisesOld, serviceAddress.PremisesNew, serviceAddress.Paci);
   97:  
   98:                     sb.AppendLine(sa);
   99:  
  100:                     count++;
  101:                 }
  102:             }
  103:         }
  104:  
  105:         ////////////////////////////////////////////////////////////////////////////
  106:         ////////////////////////////////////////////////////////////////////////////   
  107:     }
  108:  
  109:     ////////////////////////////////////////////////////////////////////////////
  110:     ////////////////////////////////////////////////////////////////////////////   
  111: }