)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Script (Ia.Ftn.Cl.Model.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.Model.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:     ///
   18:     /// 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
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     public class Script
   29:     {
   30:         ////////////////////////////////////////////////////////////////////////////
   31:  
   32:         /// <summary>
   33:         ///
   34:         /// </summary>
   35:         public Script() { }
   36:  
   37:         ////////////////////////////////////////////////////////////////////////////
   38:  
   39:         /// <summary>
   40:         ///
   41:         /// </summary>
   42:         public static void InsertMissingAccessEntriesByUsingStatisticalAddressEstimationGeneratedFromServiceRequestOrderAddressesAndCurrentOntAndNetworkDesignDocumentPosition(ref StringBuilder sb, out int count, ref string result)
   43:         {
   44:             string sa, accessName, address, level;
   45:             Hashtable hashTable, accessNameHashtable;
   46:             Dictionary<string, string> ontAccessIdToOntAccessNameDictionary, serviceOntIdDictionary;
   47:             Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
   48:             //Ia.Ftn.Cl.Model.Ont ont;
   49:             Ia.Ftn.Cl.Model.Business.ServiceAddress serviceAddress;
   50:             List<string> accessNameList;
   51:             List<Ia.Ftn.Cl.Model.Ont> ontList;
   52:             List<Ia.Ftn.Cl.Model.ServiceRequestService> serviceRequestServiceList;
   53:             List<Ia.Ftn.Cl.Model.Nokia.AgcfGatewayRecord> agcfGatewayRecordList;
   54:             List<Ia.Ftn.Cl.Model.Nokia.AgcfEndpoint> agcfEndpointList;
   55:  
   56:             sb = new StringBuilder();
   57:  
   58:             count = 0;
   59:             accessNameList = Ia.Ftn.Cl.Model.Data.Nokia.Ont.ReadNetworkDesignDocumentAccessNameListWithOntEquipmentIdNotNullAndAccessIsNullIncludeOntServiceVoips;
   60:  
   61:             ontAccessIdToOntAccessNameDictionary = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary;
   62:  
   63:             using (var db = new Ia.Ftn.Cl.Model.Db())
   64:             {
   65:                 ontList = (from o in db.Onts where o.EquipmentId != null && o.Access == null select o).ToList();
   66:  
   67:                 serviceRequestServiceList = (from srs in db.ServiceRequestServices select srs).ToList();
   68:                 agcfGatewayRecordList = (from gr in db.AgcfGatewayRecords select gr).ToList();
   69:                 agcfEndpointList = (from e in db.AgcfEndpoints select e).ToList();
   70:  
   71:                 hashTable = Ia.Ftn.Cl.Model.Data.ServiceRequest.NumberToCustomerAddressHashtable(null);
   72:  
   73:                 serviceOntIdDictionary = (from o in ontList
   74:                                           join Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont n in Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntList on o.Id equals n.Id
   75:                                           join gr in agcfGatewayRecordList on n.Ip equals gr.IP1
   76:                                           join e in agcfEndpointList on gr.Id equals e.AgcfGatewayRecord.Id
   77:                                           join srs in serviceRequestServiceList on e.Dn equals "+965" + srs.Service
   78:                                           select new { srs.Service, o.Id }).ToDictionary(u => u.Service, u => u.Id);
   79:  
   80:                 accessNameHashtable = new Hashtable(serviceOntIdDictionary.Count);
   81:  
   82:                 foreach (KeyValuePair<string, string> kvp in serviceOntIdDictionary)
   83:                 {
   84:                     if (hashTable[kvp.Key] != null)
   85:                     {
   86:                         address = hashTable[kvp.Key].ToString();
   87:                         serviceAddress = Ia.Ftn.Cl.Model.Business.ServiceRequest.ServiceAddress(kvp.Key, address, out level);
   88:  
   89:                         if (ontAccessIdToOntAccessNameDictionary.ContainsKey(kvp.Value) && serviceAddress != null)
   90:                         {
   91:                             accessName = ontAccessIdToOntAccessNameDictionary[kvp.Value];
   92:                             accessNameHashtable[accessName] = serviceAddress;
   93:                         }
   94:                     }
   95:                 }
   96:             }
   97:  
   98:             foreach (string accessName0 in accessNameHashtable.Keys)
   99:             {
  100:                 serviceAddress = accessNameHashtable[accessName0] as Ia.Ftn.Cl.Model.Business.ServiceAddress;
  101:  
  102:                 nddOnt = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntByAccessName(accessName0);
  103:  
  104:                 if (nddOnt != null)
  105:                 {
  106:                     sa = Ia.Ftn.Cl.Model.Business.Access.SqlInsertCommand(nddOnt, serviceAddress.AreaId, serviceAddress.Block, serviceAddress.Street, serviceAddress.PremisesOld, serviceAddress.PremisesNew, serviceAddress.Paci);
  107:  
  108:                     sb.AppendLine(sa);
  109:  
  110:                     count++;
  111:                 }
  112:             }
  113:         }
  114:  
  115:         ////////////////////////////////////////////////////////////////////////////
  116:         ////////////////////////////////////////////////////////////////////////////   
  117:     }
  118:  
  119:     ////////////////////////////////////////////////////////////////////////////
  120:     ////////////////////////////////////////////////////////////////////////////   
  121: }