)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Ims (Ia.Ftn.Cl.Model.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.Model.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:     ///
   17:     /// 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
   18:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   19:     ///
   20:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   21:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   22:     /// 
   23:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   24:     /// 
   25:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   26:     /// </remarks> 
   27:     public class Ims
   28:     {
   29:         private static List<string> /*agcfGatewayRecordIp1sWithinWhichSubPartiesHaveServiceBundle2CategoryList, agcfGatewayRecordIp1sThatIndicateFsdb0List,*/ accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
   30:         private static List<string> nokiaAccessNameWithPbxList;
   31:  
   32:         private static readonly object objectLock = new object();
   33:  
   34:         ////////////////////////////////////////////////////////////////////////////
   35:  
   36:         /// <summary>
   37:         ///
   38:         /// </summary>
   39:         public Ims()
   40:         {
   41:         }
   42:  
   43:         ////////////////////////////////////////////////////////////////////////////
   44:  
   45:         /// <summary>
   46:         ///
   47:         /// </summary>
   48:         public static string DistributionOfHuaweiOntOverNokiaPrimarySwitchList()
   49:         {
   50:             StringBuilder sb;
   51:             List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList;
   52:             Dictionary<string, string> ipDictionary;
   53:             Dictionary<string, int> statisticDictionary;
   54:  
   55:             sb = new StringBuilder();
   56:             statisticDictionary = new Dictionary<string, int>();
   57:  
   58:             nddOntList = (from o in Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntList
   59:                           where o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
   60:                           && o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
   61:                           select o).ToList();
   62:  
   63:             ipDictionary = Ia.Ftn.Cl.Model.Data.Nokia.AgcfGatewayRecord.IpDictionary;
   64:  
   65:             foreach (Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont ont in nddOntList)
   66:             {
   67:                 if (ipDictionary.ContainsKey(ont.Ip))
   68:                 {
   69:                     if (statisticDictionary.ContainsKey(ont.PrimarySwitch))
   70:                     {
   71:                         statisticDictionary[ont.PrimarySwitch] = statisticDictionary[ont.PrimarySwitch] + 1;
   72:                     }
   73:                     else statisticDictionary[ont.PrimarySwitch] = 1;
   74:                 }
   75:             }
   76:  
   77:             if (statisticDictionary.Count > 0)
   78:             {
   79:                 foreach (KeyValuePair<string, int> kvp in statisticDictionary)
   80:                 {
   81:                     sb.Append(kvp.Key + ": " + kvp.Value);
   82:  
   83:                     sb.AppendLine();
   84:                 }
   85:             }
   86:  
   87:             return sb.ToString();
   88:         }
   89:  
   90:         ////////////////////////////////////////////////////////////////////////////
   91:         ////////////////////////////////////////////////////////////////////////////
   92:  
   93:         /// <summary>
   94:         ///
   95:         /// </summary>
   96:         public static List<string> AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List
   97:         {
   98:             get
   99:             {
  100:                 if (accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List == null || accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List.Count == 0)
  101:                 {
  102:                     lock (objectLock)
  103:                     {
  104:                         accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List = Ia.Ftn.Cl.Model.Data.Ims._AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  105:                     }
  106:                 }
  107:  
  108:                 return accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  109:             }
  110:         }
  111:  
  112:         ////////////////////////////////////////////////////////////////////////////
  113:  
  114:         /// <summary>
  115:         ///
  116:         /// </summary>
  117:         private static List<string> _AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List
  118:         {
  119:             get
  120:             {
  121:                 /*
  122:     -- debug bug temp SDQ.716.2 solution:
  123:     -- procedure to go from ip to accessId to emsOnt to ontsip to subparty and check bundle
  124: 
  125:     select distinct eo.Access_Id from EmsOnts eo
  126:     left outer join EmsOntSipInfoes eosi on eosi.EmsOnt_Id = eo.Id
  127:     left outer join EmsVoipPstnUsers evpu on evpu.EmsOnt_Id = eo.Id
  128:     left outer join SubParties sp on sp.PartyId = eosi.SIPUSERNAME
  129:     left outer join SubParties sp2 on sp2.PartyId = '+'+evpu.DN
  130:     where
  131:     sp.Id is not null and sp.Category = 'SERVICEBUNDLE2'
  132:     or 
  133:     sp2.Id is not null and sp2.Category = 'SERVICEBUNDLE2'
  134:                  */
  135:  
  136:                 using (var db = new Ia.Ftn.Cl.Model.Db())
  137:                 {
  138:  
  139:                     accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List = (from eo in db.EmsOnts
  140:                                                                                                             join eosi in db.EmsOntSipInfoes on eo.Id equals eosi.EmsOnt.Id into eosis
  141:                                                                                                             from eosi in eosis.DefaultIfEmpty()
  142:  
  143:                                                                                                             join evpu in db.EmsVoipPstnUsers on eo.Id equals evpu.EmsOnt.Id into evpus
  144:                                                                                                             from evpu in evpus.DefaultIfEmpty()
  145:  
  146:                                                                                                             join sp in db.SubParties on eosi.SIPUSERNAME equals sp.PartyId into sps
  147:                                                                                                             from sp in sps.DefaultIfEmpty()
  148:  
  149:                                                                                                             join sp2 in db.SubParties on "+" + evpu.DN equals sp2.PartyId into sp2s
  150:                                                                                                             from sp2 in sp2s.DefaultIfEmpty()
  151:  
  152:                                                                                                             where sp != null && sp.Category == "SERVICEBUNDLE2" || sp2 != null && sp2.Category == "SERVICEBUNDLE2"
  153:                                                                                                             select eo.Access.Id).Distinct().ToList();
  154:                 }
  155:  
  156:                 return accessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  157:             }
  158:         }
  159:  
  160:         ////////////////////////////////////////////////////////////////////////////
  161:         ////////////////////////////////////////////////////////////////////////////
  162:  
  163:         /// <summary>
  164:         ///
  165:         /// </summary>
  166:         public static List<string> NokiaAccessNameWithPbxList
  167:         {
  168:             get
  169:             {
  170:                 if (nokiaAccessNameWithPbxList == null || nokiaAccessNameWithPbxList.Count == 0)
  171:                 {
  172:                     lock (objectLock)
  173:                     {
  174:                         nokiaAccessNameWithPbxList = Ia.Ftn.Cl.Model.Data.Ims._NokiaAccessNameWithPbxList(10080); // 10,080 minutes = 1 week
  175:                     }
  176:                 }
  177:  
  178:                 return nokiaAccessNameWithPbxList;
  179:             }
  180:         }
  181:  
  182:         ////////////////////////////////////////////////////////////////////////////
  183:  
  184:         /// <summary>
  185:         ///
  186:         /// </summary>
  187:         private static List<string> _NokiaAccessNameWithPbxList(int minutesToKeepDataValid)
  188:         {
  189:             string title;
  190:             DateTime now, timestamp;
  191:  
  192:             now = DateTime.UtcNow.AddHours(3);
  193:  
  194:             title = "NokiaAccessNameWithPbxList";
  195:  
  196:             timestamp = Ia.Ftn.Cl.Model.Data.Miscellaneous.ReadUpdatedDateTime(title);// + "Timestamp");
  197:  
  198:             if (now.AddMinutes(-minutesToKeepDataValid) > timestamp)
  199:             {
  200:                 nokiaAccessNameWithPbxList = _NokiaAccessNameWithPbxList();
  201:                 Ia.Ftn.Cl.Model.Data.Miscellaneous.CreateOrUpdate(title, nokiaAccessNameWithPbxList);
  202:  
  203:                 timestamp = now;
  204:                 //Ia.Ftn.Cl.Model.Data.Miscellaneous.CreateOrUpdate(title + "Timestamp", timestamp);
  205:             }
  206:             else
  207:             {
  208:                 nokiaAccessNameWithPbxList = Ia.Ftn.Cl.Model.Data.Miscellaneous.Read<List<string>>(title);
  209:             }
  210:  
  211:             return nokiaAccessNameWithPbxList;
  212:         }
  213:  
  214:         ////////////////////////////////////////////////////////////////////////////
  215:  
  216:         /// <summary>
  217:         ///
  218:         /// </summary>
  219:         private static List<string> _NokiaAccessNameWithPbxList()
  220:         {
  221:             List<string> accessNameList;
  222:  
  223:             /* seriouse bug. calling OntList recursively
  224:              * 
  225:             var iplist = Ia.Ftn.Cl.Model.Data.Nokia.Ims.AgcfGatewayRecordIp1sWithinWhichSubPartiesHaveServiceBundle2CategoryList;
  226: 
  227:             var accessIdlist = Ia.Ftn.Cl.Model.Data.Ims.AccessIdOfEmsOntSipInfoOrEmsVoipPstnUserWithSubPartiesWithCategoryServiceBundle2List;
  228: 
  229:             accessNameList = new List<string>();
  230: 
  231:             foreach (var ip in iplist) accessNameList.Add(Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntIpToOntAccessNameDictionary[ip]);
  232: 
  233:             foreach (var accessId in accessIdlist) accessNameList.Add(Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary[accessId]);
  234:             */
  235:  
  236:             accessNameList = new List<string> { "ESH.44.16", "ZAH.133.3", "ZAH.133.11", "SDQ.716.2", "MBA.1305.4" };
  237:  
  238:             return accessNameList;
  239:         }
  240:  
  241:         ////////////////////////////////////////////////////////////////////////////
  242:         ////////////////////////////////////////////////////////////////////////////
  243:     }
  244:  
  245:     ////////////////////////////////////////////////////////////////////////////
  246:     ////////////////////////////////////////////////////////////////////////////
  247: }