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

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

Fixed Telecommunications Network's Operations Support System Management Intranet (FTN OSS) support class for Fixed Telecommunications Network (FTN) data model

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4: using System.Text;
    5:  
    6: namespace Ia.Ftn.Cl.Models.Data
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     /// Fixed Telecommunications Network's Operations Support System Management Intranet (FTN OSS) support class for Fixed Telecommunications Network (FTN) data model
   12:     /// </summary>
   13:     /// 
   14:     /// <remarks> 
   15:     /// Copyright © 2014-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     /// </remarks> 
   17:     public class Ims
   18:     {
   19:         private static List<string> /*agcfGatewayRecordIp1sWithinWhichSubPartiesHaveServiceBundle2CategoryList, agcfGatewayRecordIp1sThatIndicateFsdb0List,*/ accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
   20:         private static List<string> nokiaAccessNameWithPbxList;
   21:  
   22:         private static readonly object objectLock = new object();
   23:  
   24:         ////////////////////////////////////////////////////////////////////////////
   25:  
   26:         /// <summary>
   27:         ///
   28:         /// </summary>
   29:         public Ims()
   30:         {
   31:         }
   32:  
   33:         ////////////////////////////////////////////////////////////////////////////
   34:  
   35:         /// <summary>
   36:         ///
   37:         /// </summary>
   38:         public static string DistributionOfHuaweiOntOverNokiaPrimarySwitchList()
   39:         {
   40:             StringBuilder sb;
   41:             List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList;
   42:             Dictionary<string, string> ipDictionary;
   43:             Dictionary<string, int> statisticDictionary;
   44:  
   45:             sb = new StringBuilder();
   46:             statisticDictionary = new Dictionary<string, int>();
   47:  
   48:             nddOntList = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList
   49:                           where o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei
   50:                           && o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia
   51:                           select o).ToList();
   52:  
   53:             ipDictionary = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.IpDictionary;
   54:  
   55:             foreach (Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont ont in nddOntList)
   56:             {
   57:                 if (ipDictionary.ContainsKey(ont.Ip))
   58:                 {
   59:                     if (statisticDictionary.ContainsKey(ont.PrimarySwitch))
   60:                     {
   61:                         statisticDictionary[ont.PrimarySwitch] = statisticDictionary[ont.PrimarySwitch] + 1;
   62:                     }
   63:                     else statisticDictionary[ont.PrimarySwitch] = 1;
   64:                 }
   65:             }
   66:  
   67:             if (statisticDictionary.Count > 0)
   68:             {
   69:                 foreach (KeyValuePair<string, int> kvp in statisticDictionary)
   70:                 {
   71:                     sb.Append(kvp.Key + ": " + kvp.Value);
   72:  
   73:                     sb.AppendLine();
   74:                 }
   75:             }
   76:  
   77:             return sb.ToString();
   78:         }
   79:  
   80:         ////////////////////////////////////////////////////////////////////////////
   81:         ////////////////////////////////////////////////////////////////////////////
   82:  
   83:         /// <summary>
   84:         ///
   85:         /// </summary>
   86:         public static List<string> AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List
   87:         {
   88:             get
   89:             {
   90:                 if (accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List == null || accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List.Count == 0)
   91:                 {
   92:                     lock (objectLock)
   93:                     {
   94:                         accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List = Ia.Ftn.Cl.Models.Data.Ims._AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
   95:                     }
   96:                 }
   97:  
   98:                 return accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
   99:             }
  100:         }
  101:  
  102:         ////////////////////////////////////////////////////////////////////////////
  103:  
  104:         /// <summary>
  105:         ///
  106:         /// </summary>
  107:         private static List<string> _AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List
  108:         {
  109:             get
  110:             {
  111:                 /*
  112:     -- debug bug temp SDQ.716.2 solution:
  113:     -- procedure to go from ip to accessId to emsOnt to ontsip to subparty and check bundle
  114: 
  115:     select distinct eo.Access_Id from EmsOnts eo
  116:     left outer join EmsOntSipInfoes eosi on eosi.EmsOnt_Id = eo.Id
  117:     left outer join EmsVoipPstnUsers evpu on evpu.EmsOnt_Id = eo.Id
  118:     left outer join SubParties sp on sp.PartyId = eosi.SIPUSERNAME
  119:     left outer join SubParties sp2 on sp2.PartyId = '+'+evpu.DN
  120:     where
  121:     sp.Id is not null and sp.Category = 'SERVICEBUNDLE2'
  122:     or 
  123:     sp2.Id is not null and sp2.Category = 'SERVICEBUNDLE2'
  124:                  */
  125:  
  126:                 using (var db = new Ia.Ftn.Cl.Db())
  127:                 {
  128:  
  129:                     accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List = (from eo in db.EmsOnts
  130:                                                                                                             join eosi in db.EmsOntSipInfoes on eo.Id equals eosi.EmsOnt.Id into eosis
  131:                                                                                                             from eosi in eosis.DefaultIfEmpty()
  132:  
  133:                                                                                                             join evpu in db.EmsVoipPstnUsers on eo.Id equals evpu.EmsOnt.Id into evpus
  134:                                                                                                             from evpu in evpus.DefaultIfEmpty()
  135:  
  136:                                                                                                             join sp in db.SubParties on eosi.SIPUSERNAME equals sp.PartyId into sps
  137:                                                                                                             from sp in sps.DefaultIfEmpty()
  138:  
  139:                                                                                                             join sp2 in db.SubParties on "+" + evpu.DN equals sp2.PartyId into sp2s
  140:                                                                                                             from sp2 in sp2s.DefaultIfEmpty()
  141:  
  142:                                                                                                             where sp != null && sp.Category == "SERVICEBUNDLE2" || sp2 != null && sp2.Category == "SERVICEBUNDLE2"
  143:                                                                                                             select eo.Access.Id).Distinct().ToList();
  144:                 }
  145:  
  146:                 return accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  147:             }
  148:         }
  149:  
  150:         ////////////////////////////////////////////////////////////////////////////
  151:         ////////////////////////////////////////////////////////////////////////////
  152:  
  153:         /// <summary>
  154:         ///
  155:         /// </summary>
  156:         public static List<string> NokiaAccessNameWithPbxList
  157:         {
  158:             get
  159:             {
  160:                 if (nokiaAccessNameWithPbxList == null || nokiaAccessNameWithPbxList.Count == 0)
  161:                 {
  162:                     lock (objectLock)
  163:                     {
  164:                         nokiaAccessNameWithPbxList = Ia.Ftn.Cl.Models.Data.Ims._NokiaAccessNameWithPbxList(10080); // 10,080 minutes = 1 week
  165:                     }
  166:                 }
  167:  
  168:                 return nokiaAccessNameWithPbxList;
  169:             }
  170:         }
  171:  
  172:         ////////////////////////////////////////////////////////////////////////////
  173:  
  174:         /// <summary>
  175:         ///
  176:         /// </summary>
  177:         private static List<string> _NokiaAccessNameWithPbxList(int minutesToKeepDataValid)
  178:         {
  179:             string title;
  180:             DateTime now, timestamp;
  181:  
  182:             now = DateTime.UtcNow.AddHours(3);
  183:  
  184:             title = "NokiaAccessNameWithPbxList";
  185:  
  186:             timestamp = Ia.Ftn.Cl.Models.Data.Miscellaneous.ReadUpdatedDateTime(title);// + "Timestamp");
  187:  
  188:             if (now.AddMinutes(-minutesToKeepDataValid) > timestamp)
  189:             {
  190:                 nokiaAccessNameWithPbxList = _NokiaAccessNameWithPbxList();
  191:                 Ia.Ftn.Cl.Models.Data.Miscellaneous.CreateOrUpdate(title, nokiaAccessNameWithPbxList);
  192:  
  193:                 timestamp = now;
  194:                 //Ia.Ftn.Cl.Model.Data.Miscellaneous.CreateOrUpdate(title + "Timestamp", timestamp);
  195:             }
  196:             else
  197:             {
  198:                 nokiaAccessNameWithPbxList = Ia.Ftn.Cl.Models.Data.Miscellaneous.Read<List<string>>(title);
  199:             }
  200:  
  201:             return nokiaAccessNameWithPbxList;
  202:         }
  203:  
  204:         ////////////////////////////////////////////////////////////////////////////
  205:  
  206:         /// <summary>
  207:         ///
  208:         /// </summary>
  209:         private static List<string> _NokiaAccessNameWithPbxList()
  210:         {
  211:             List<string> accessNameList;
  212:  
  213:             /* seriouse bug. calling OntList recursively
  214:              * 
  215:             var iplist = Ia.Ftn.Cl.Model.Data.Nokia.Ims.AgcfGatewayRecordIp1sWithinWhichSubPartiesHaveServiceBundle2CategoryList;
  216: 
  217:             var accessIdlist = Ia.Ftn.Cl.Model.Data.Ims.AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  218: 
  219:             accessNameList = new List<string>();
  220: 
  221:             foreach (var ip in iplist) accessNameList.Add(Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntIpToOntAccessNameDictionary[ip]);
  222: 
  223:             foreach (var accessId in accessIdlist) accessNameList.Add(Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary[accessId]);
  224:             */
  225:  
  226:             accessNameList = new List<string> { "ESH.44.16", "ZAH.133.3", "ZAH.133.11", "SDQ.716.2", "MBA.1305.4" };
  227:  
  228:             return accessNameList;
  229:         }
  230:  
  231:         ////////////////////////////////////////////////////////////////////////////
  232:         ////////////////////////////////////////////////////////////////////////////
  233:     }
  234:  
  235:     ////////////////////////////////////////////////////////////////////////////
  236:     ////////////////////////////////////////////////////////////////////////////
  237: }