)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
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:     ///
   16:     /// 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
   17:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   18:     ///
   19:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   20:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   21:     /// 
   22:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   23:     /// 
   24:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   25:     /// </remarks> 
   26:     public class Ams
   27:     {
   28:         private static Dictionary<string, string> correlationTagDictionary = new Dictionary<string, string>(1000);
   29:  
   30:         public static Dictionary<string, string> CorrelationTagDictionary { get { return correlationTagDictionary; } set { correlationTagDictionary = value; } }
   31:  
   32:         ////////////////////////////////////////////////////////////////////////////
   33:  
   34:         /// <summary>
   35:         ///
   36:         /// </summary>
   37:         public Ams() { }
   38:  
   39:         ////////////////////////////////////////////////////////////////////////////
   40:  
   41:         /// <summary>
   42:         ///
   43:         /// </summary>
   44:         public static string BellcoreStateFromId(int stateId)
   45:         {
   46:             // see: ColoredBellcoreStateFromId()            
   47:             string s;
   48:             Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState bellcoreState;
   49:  
   50:             bellcoreState = (Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState)stateId;
   51:  
   52:             /*
   53:              * IS-NR: (In-Service and Normal) The entity is fully operational and will perform as provisioned.
   54:              * OOS-AU: (Out-of-Service and Autonomous) The entity is not operational because of an autonomous event.
   55:              * 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.
   56:              * OOS-MA: (Out-of-Service and Management) The entity has been manually removed from service.
   57:              */
   58:  
   59:             switch (bellcoreState)
   60:             {
   61:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.IsNr: s = "IS-NR"; break;
   62:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAu: s = "OOS-AU"; break;
   63:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAuma: s = "OOS-AUMA"; break;
   64:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosMa: s = "OOS-MA"; break;
   65:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.Undefined: s = "Unknown"; break;
   66:                 default: s = "Unknown"; break;
   67:             }
   68:  
   69:             return s;
   70:         }
   71:  
   72:         ////////////////////////////////////////////////////////////////////////////
   73:  
   74:         /// <summary>
   75:         ///
   76:         /// </summary>
   77:         public static string ColoredBellcoreStateFromId(int stateId)
   78:         {
   79:             // see: BellcoreStateFromId()
   80:             string s;
   81:             Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState bellcoreState;
   82:  
   83:             bellcoreState = (Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState)stateId;
   84:  
   85:             switch (bellcoreState)
   86:             {
   87:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.IsNr: s = "<span style=\"color:Green\">IS-NR</span>"; break;
   88:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAu: s = "<span style=\"color:Red\">OOS-AU</span>"; break;
   89:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosAuma: s = "<span style=\"color:Red\">OOS-AUMA</span>"; break;
   90:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.OosMa: s = "<span style=\"color:Red\">OOS-MA</span>"; break;
   91:                 case Ia.Ftn.Cl.Models.Business.Nokia.Ams.BellcoreState.Undefined: s = "<span style=\"color:Red\">Unknown</span>"; break;
   92:                 default: s = "Unknown"; break;
   93:             }
   94:  
   95:             return s;
   96:         }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:  
  100:         /// <summary>
  101:         ///
  102:         /// </summary>
  103:         public static string PlannedSoftware
  104:         {
  105:             get
  106:             {
  107:                 return "3FE50853AFXA35";
  108:             }
  109:         }
  110:  
  111:         ////////////////////////////////////////////////////////////////////////////
  112:  
  113:         /// <summary>
  114:         ///
  115:         /// </summary>
  116:         public static int NextVacantFlatTermIdForOnt(int familyTypeId, Ia.Ftn.Cl.Models.Ont ont)
  117:         {
  118:             int ft, gwId;
  119:             List<int> list;
  120:  
  121:             if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
  122:             {
  123:                 gwId = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
  124:  
  125:                 list = Ia.Ftn.Cl.Models.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
  126:  
  127:                 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
  128:                 else
  129:                 {
  130:                     list = Ia.Cl.Models.Default.ExcludedNumberListFromNumberListWithinRange(list, Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossibleNumberOfTdForOntFamilyType((Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)familyTypeId));
  131:  
  132:                     if (list.Count > 0) ft = list[0];
  133:                     else ft = Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown; // something went wrong
  134:                 }
  135:             }
  136:             else ft = Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown; // something went wrong
  137:  
  138:             return ft;
  139:         }
  140:  
  141:         ////////////////////////////////////////////////////////////////////////////
  142:  
  143:         /// <summary>
  144:         ///
  145:         /// </summary>
  146:         public static List<int> VacantFlatTermIdForOntList(int familyTypeId, Ia.Ftn.Cl.Models.Ont ont)
  147:         {
  148:             int gwId;
  149:             List<int> vacantList, usedList;
  150:  
  151:             if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
  152:             {
  153:                 gwId = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
  154:  
  155:                 usedList = Ia.Ftn.Cl.Models.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
  156:  
  157:                 vacantList = Ia.Cl.Models.Default.ExcludedNumberListFromNumberListWithinRange(usedList, Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossibleNumberOfTdForOntFamilyType((Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)familyTypeId));
  158:             }
  159:             else
  160:             {
  161:                 vacantList = new List<int>();
  162:             }
  163:  
  164:             return vacantList;
  165:         }
  166:  
  167:         ////////////////////////////////////////////////////////////////////////////
  168:  
  169:         /// <summary>
  170:         ///
  171:         /// </summary>
  172:         public static Ia.Ftn.Cl.Models.Ont OntFromGwId(int gwId)
  173:         {
  174:             string ip;
  175:             Ia.Ftn.Cl.Models.Ont ont;
  176:  
  177:             using (var db = new Ia.Ftn.Cl.Db())
  178:             {
  179:                 ip = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.IpFromGatewayId(gwId);
  180:  
  181:                 ont = (from o in db.Onts where o.OntServiceVoips.First().Ip == ip select o).SingleOrDefault();
  182:             }
  183:  
  184:             return ont;
  185:         }
  186:  
  187:         ////////////////////////////////////////////////////////////////////////////
  188:  
  189:         /// <summary>
  190:         ///
  191:         /// </summary>
  192:         public static List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> OntOntPotsCustomerNoEqualToSubPartyDisplayNameServiceList()
  193:         {
  194:             List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> list;
  195:  
  196:             using (var db = new Ia.Ftn.Cl.Db())
  197:             {
  198:                 list = (from sp in db.SubParties
  199:                         join e in db.AgcfEndpoints on sp.AgcfEndpoint.Id equals e.Id
  200:                         join gr in db.AgcfGatewayRecords on e.GwId equals gr.GwId
  201:                         join osv in db.OntServiceVoips on gr.IP1 equals osv.Ip
  202:                         join o in db.Onts on osv.Ont.Id equals o.Id
  203:                         join oop in db.OntOntPots on o.Id equals oop.Ont.Id
  204:                         where oop.Customer != sp.DisplayName && oop.Termination == "td" + e.FlatTermID.ToString()
  205:                         select new Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService
  206:                         {
  207:                             Service = sp.DisplayName,
  208:                             Termination = oop.Termination,
  209:                             OntId = o.Id,
  210:                             OntFamilyTypeId = o.FamilyTypeId
  211:                         }).ToList();
  212:             }
  213:  
  214:             return list;
  215:         }
  216:  
  217:         ////////////////////////////////////////////////////////////////////////////
  218:  
  219:         /// <summary>
  220:         ///
  221:         /// </summary>
  222:         public static List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> OntOntPotsCustomerExistsButSubPartyIsNullServiceList()
  223:         {
  224:             List<Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService> list;
  225:  
  226:             using (var db = new Ia.Ftn.Cl.Db())
  227:             {
  228:                 list = (from oop in db.OntOntPots
  229:                         join o in db.Onts on oop.Ont.Id equals o.Id
  230:                         join osv in db.OntServiceVoips on o.Id equals osv.Ont.Id
  231:                         join gr in db.AgcfGatewayRecords on osv.Ip equals gr.IP1
  232:                         join e in db.AgcfEndpoints on gr.GwId equals e.GwId
  233:                         join sp in db.SubParties on e.Id equals sp.AgcfEndpoint.Id into sp2
  234:                         from sp in sp2.DefaultIfEmpty()
  235:                         where sp == null //  oop.Customer != sp.DisplayName && oop.Termination == "td" + e.FlatTermID.ToString()
  236:                         select new Ia.Ftn.Cl.Models.Business.Nokia.OntOntPotsService
  237:                         {
  238:                             Service = oop.Customer,
  239:                             Termination = oop.Termination,
  240:                             OntId = o.Id,
  241:                             OntFamilyTypeId = o.FamilyTypeId
  242:                         }).ToList();
  243:             }
  244:  
  245:             return list;
  246:         }
  247:  
  248:         ////////////////////////////////////////////////////////////////////////////
  249:         ////////////////////////////////////////////////////////////////////////////
  250:     }
  251:  
  252:     ////////////////////////////////////////////////////////////////////////////
  253:     ////////////////////////////////////////////////////////////////////////////
  254: }