شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ams

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.Ngn.Cl.Model.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-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet 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 partial 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:              string s;
  47:              Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState bellcoreState;
  48:   
  49:              bellcoreState = (Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState)stateId;
  50:   
  51:              switch (bellcoreState)
  52:              {
  53:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.IsNr: s = "IS-NR"; break;
  54:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.OosAu: s = "OOS-AU"; break;
  55:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.OosAuma: s = "OOS-AUMA"; break;
  56:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.OosMa: s = "OOS-MA"; break;
  57:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.Undefined: s = "Undefined"; break;
  58:                  default: s = "Undefined"; break;
  59:              }
  60:   
  61:              return s;
  62:          }
  63:   
  64:          ////////////////////////////////////////////////////////////////////////////
  65:   
  66:          /// <summary>
  67:          ///
  68:          /// </summary>
  69:          public static string PlannedSoftware
  70:          {
  71:              get
  72:              {
  73:                  return "3FE50853AFXA35";
  74:              }
  75:          }
  76:   
  77:          ////////////////////////////////////////////////////////////////////////////
  78:   
  79:          /// <summary>
  80:          ///
  81:          /// </summary>
  82:          public static int NextVacantFlatTermIdForOnt(int familyTypeId, Ia.Ngn.Cl.Model.Ont ont)
  83:          {
  84:              int ft, gwId;
  85:              List<int> list;
  86:   
  87:              if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
  88:              {
  89:                  gwId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
  90:   
  91:                  list = Ia.Ngn.Cl.Model.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
  92:   
  93:                  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
  94:                  else
  95:                  {
  96:                      list = Ia.Cl.Model.Default.ExcludedNumberListFromNumberListWithinRange(list, Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType((Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)familyTypeId));
  97:   
  98:                      if (list.Count > 0) ft = list[0];
  99:                      else ft = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown; // something went wrong
 100:                  }
 101:              }
 102:              else ft = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown; // something went wrong
 103:   
 104:              return ft;
 105:          }
 106:   
 107:          ////////////////////////////////////////////////////////////////////////////
 108:   
 109:          /// <summary>
 110:          ///
 111:          /// </summary>
 112:          public static List<int> VacantFlatTermIdForOntList(int familyTypeId, Ia.Ngn.Cl.Model.Ont ont)
 113:          {
 114:              int gwId;
 115:              List<int> vacantList, usedList;
 116:   
 117:              if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
 118:              {
 119:                  gwId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
 120:   
 121:                  usedList = Ia.Ngn.Cl.Model.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
 122:   
 123:                  vacantList = Ia.Cl.Model.Default.ExcludedNumberListFromNumberListWithinRange(usedList, Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType((Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)familyTypeId));
 124:              }
 125:              else
 126:              {
 127:                  vacantList = new List<int>();
 128:              }
 129:   
 130:              return vacantList;
 131:          }
 132:   
 133:          ////////////////////////////////////////////////////////////////////////////
 134:   
 135:          /// <summary>
 136:          ///
 137:          /// </summary>
 138:          public static Ia.Ngn.Cl.Model.Ont OntFromGwId(int gwId)
 139:          {
 140:              string ip;
 141:              Ia.Ngn.Cl.Model.Ont ont;
 142:   
 143:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 144:              {
 145:                  ip = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.IpFromGatewayId(gwId);
 146:   
 147:                  ont = (from o in db.Onts where o.OntServiceVoips.First().Ip == ip select o).SingleOrDefault();
 148:              }
 149:   
 150:              return ont;
 151:          }
 152:   
 153:          ////////////////////////////////////////////////////////////////////////////
 154:          ////////////////////////////////////////////////////////////////////////////
 155:      }
 156:   
 157:      ////////////////////////////////////////////////////////////////////////////
 158:      ////////////////////////////////////////////////////////////////////////////
 159:  }