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

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

Access Management System (AMS) support class for Nokia data model.

    1: using System.Collections.Generic;
    2: using System.Data;
    3: using System.Linq;
    4:  
    5: namespace Ia.Ftn.Cl.Models.Data.Nokia
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// Access Management System (AMS) support class for Nokia data model.
   11:     /// </summary>
   12:     /// 
   13:     /// <remarks> 
   14:     /// Copyright © 2006-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   15:     /// </remarks> 
   16:     public class Ams
   17:     {
   18:         private static Dictionary<string, string> correlationTagDictionary = new Dictionary<string, string>(1000);
   19:  
   20:         public static Dictionary<string, string> CorrelationTagDictionary { get { return correlationTagDictionary; } set { correlationTagDictionary = value; } }
   21:  
   22:         ////////////////////////////////////////////////////////////////////////////
   23:  
   24:         /// <summary>
   25:         ///
   26:         /// </summary>
   27:         public Ams() { }
   28:  
   29:         ////////////////////////////////////////////////////////////////////////////
   30:  
   31:         /// <summary>
   32:         ///
   33:         /// </summary>
   34:         public static string BellcoreStateFromId(int stateId)
   35:         {
   36:             // see: ColoredBellcoreStateFromId()            
   37:             string s;
   38:             Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState bellcoreState;
   39:  
   40:             bellcoreState = (Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState)stateId;
   41:  
   42:             /*
   43:              * IS-NR: (In-Service and Normal) The entity is fully operational and will perform as provisioned.
   44:              * OOS-AU: (Out-of-Service and Autonomous) The entity is not operational because of an autonomous event.
   45:              * OOS-AUMA: (Out-of-Service and Autonomous Management) The entity is not operational because of an autonomous event and has also been manually removed from service.
   46:              * OOS-MA: (Out-of-Service and Management) The entity has been manually removed from service.
   47:              */
   48:  
   49:             switch (bellcoreState)
   50:             {
   51:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.IsNr: s = "IS-NR"; break;
   52:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAu: s = "OOS-AU"; break;
   53:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAuma: s = "OOS-AUMA"; break;
   54:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosMa: s = "OOS-MA"; break;
   55:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.Undefined: s = "Unknown"; break;
   56:                 default: s = "Unknown"; break;
   57:             }
   58:  
   59:             return s;
   60:         }
   61:  
   62:         ////////////////////////////////////////////////////////////////////////////
   63:  
   64:         /// <summary>
   65:         ///
   66:         /// </summary>
   67:         public static string ColoredBellcoreStateFromId(int stateId)
   68:         {
   69:             // see: BellcoreStateFromId()
   70:             string s;
   71:             Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState bellcoreState;
   72:  
   73:             bellcoreState = (Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState)stateId;
   74:  
   75:             switch (bellcoreState)
   76:             {
   77:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.IsNr: s = "<span style=\"color:Green\">IS-NR</span>"; break;
   78:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAu: s = "<span style=\"color:Red\">OOS-AU</span>"; break;
   79:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAuma: s = "<span style=\"color:Red\">OOS-AUMA</span>"; break;
   80:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosMa: s = "<span style=\"color:Red\">OOS-MA</span>"; break;
   81:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.Undefined: s = "<span style=\"color:Red\">Unknown</span>"; break;
   82:                 default: s = "Unknown"; break;
   83:             }
   84:  
   85:             return s;
   86:         }
   87:  
   88:         ////////////////////////////////////////////////////////////////////////////
   89:  
   90:         /// <summary>
   91:         ///
   92:         /// </summary>
   93:         public static string PlannedSoftware
   94:         {
   95:             get
   96:             {
   97:                 return "3FE50853AFXA35";
   98:             }
   99:         }
  100:  
  101:         ////////////////////////////////////////////////////////////////////////////
  102:  
  103:         /// <summary>
  104:         ///
  105:         /// </summary>
  106:         public static int NextVacantFlatTermIdForOnt(int familyTypeId, Ia.Ftn.Cl.Models.Ont ont)
  107:         {
  108:             int ft, gwId;
  109:             List<int> list;
  110:  
  111:             if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
  112:             {
  113:                 gwId = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
  114:  
  115:                 list = Ia.Ftn.Cl.Models.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
  116:  
  117:                 if (list.Count == 0) ft = 1; // this means agcfEndpoint does not exist for any number and the box is empty, and we should create agcfEndpoint at 1
  118:                 else
  119:                 {
  120:                     list = Ia.Cl.Models.Default.ExcludedNumberListFromNumberListWithinRange(list, Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossibleNumberOfTdForOntFamilyType((Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)familyTypeId));
  121:  
  122:                     if (list.Count > 0) ft = list[0];
  123:                     else ft = Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown; // something went wrong
  124:                 }
  125:             }
  126:             else ft = Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown; // something went wrong
  127:  
  128:             return ft;
  129:         }
  130:  
  131:         ////////////////////////////////////////////////////////////////////////////
  132:  
  133:         /// <summary>
  134:         ///
  135:         /// </summary>
  136:         public static List<int> VacantFlatTermIdForOntList(int familyTypeId, Ia.Ftn.Cl.Models.Ont ont)
  137:         {
  138:             int gwId;
  139:             List<int> vacantList, usedList;
  140:  
  141:             if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
  142:             {
  143:                 gwId = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
  144:  
  145:                 usedList = Ia.Ftn.Cl.Models.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
  146:  
  147:                 vacantList = Ia.Cl.Models.Default.ExcludedNumberListFromNumberListWithinRange(usedList, Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossibleNumberOfTdForOntFamilyType((Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)familyTypeId));
  148:             }
  149:             else
  150:             {
  151:                 vacantList = new List<int>();
  152:             }
  153:  
  154:             return vacantList;
  155:         }
  156:  
  157:         ////////////////////////////////////////////////////////////////////////////
  158:  
  159:         /// <summary>
  160:         ///
  161:         /// </summary>
  162:         public static Ia.Ftn.Cl.Models.Ont OntFromGwId(int gwId)
  163:         {
  164:             string ip;
  165:             Ia.Ftn.Cl.Models.Ont ont;
  166:  
  167:             using (var db = new Ia.Ftn.Cl.Db())
  168:             {
  169:                 ip = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.IpFromGatewayId(gwId);
  170:  
  171:                 ont = (from o in db.Onts where o.OntServiceVoips.First().Ip == ip select o).SingleOrDefault();
  172:             }
  173:  
  174:             return ont;
  175:         }
  176:  
  177:         ////////////////////////////////////////////////////////////////////////////
  178:  
  179:         /// <summary>
  180:         ///
  181:         /// </summary>
  182:         public static List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> OntOntPotsCustomerNoEqualToSubPartyDisplayNameServiceList()
  183:         {
  184:             List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> list;
  185:  
  186:             using (var db = new Ia.Ftn.Cl.Db())
  187:             {
  188:                 list = (from sp in db.SubParties
  189:                         join e in db.AgcfEndpoints on sp.AgcfEndpoint.Id equals e.Id
  190:                         join gr in db.AgcfGatewayRecords on e.GwId equals gr.GwId
  191:                         join osv in db.OntServiceVoips on gr.IP1 equals osv.Ip
  192:                         join o in db.Onts on osv.Ont.Id equals o.Id
  193:                         join oop in db.OntOntPots on o.Id equals oop.Ont.Id
  194:                         where oop.Customer != sp.DisplayName && oop.Termination == "td" + e.FlatTermID.ToString()
  195:                         select new Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService
  196:                         {
  197:                             Service = sp.DisplayName,
  198:                             Termination = oop.Termination,
  199:                             OntId = o.Id,
  200:                             OntFamilyTypeId = o.FamilyTypeId
  201:                         }).ToList();
  202:             }
  203:  
  204:             return list;
  205:         }
  206:  
  207:         ////////////////////////////////////////////////////////////////////////////
  208:  
  209:         /// <summary>
  210:         ///
  211:         /// </summary>
  212:         public static List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> OntOntPotsCustomerExistsButSubPartyIsNullServiceList()
  213:         {
  214:             List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> list;
  215:  
  216:             using (var db = new Ia.Ftn.Cl.Db())
  217:             {
  218:                 list = (from oop in db.OntOntPots
  219:                         join o in db.Onts on oop.Ont.Id equals o.Id
  220:                         join osv in db.OntServiceVoips on o.Id equals osv.Ont.Id
  221:                         join gr in db.AgcfGatewayRecords on osv.Ip equals gr.IP1
  222:                         join e in db.AgcfEndpoints on gr.GwId equals e.GwId
  223:                         join sp in db.SubParties on e.Id equals sp.AgcfEndpoint.Id into sp2
  224:                         from sp in sp2.DefaultIfEmpty()
  225:                         where sp == null //  oop.Customer != sp.DisplayName && oop.Termination == "td" + e.FlatTermID.ToString()
  226:                         select new Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService
  227:                         {
  228:                             Service = oop.Customer,
  229:                             Termination = oop.Termination,
  230:                             OntId = o.Id,
  231:                             OntFamilyTypeId = o.FamilyTypeId
  232:                         }).ToList();
  233:             }
  234:  
  235:             return list;
  236:         }
  237:  
  238:         ////////////////////////////////////////////////////////////////////////////
  239:         ////////////////////////////////////////////////////////////////////////////
  240:     }
  241:  
  242:     ////////////////////////////////////////////////////////////////////////////
  243:     ////////////////////////////////////////////////////////////////////////////
  244: }