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

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;
   2:  using System.Web;
   3:  using System.Xml;
   4:  using System.Xml.Linq;
   5:  using System.IO;
   6:  using System.Configuration;
   7:  using System.Text;
   8:  using System.Text.RegularExpressions;
   9:  using System.Data;
  10:  using System.Data.SqlClient;
  11:  using System.Web.UI;
  12:  using System.Web.UI.WebControls;
  13:  using System.Collections;
  14:  using System.Collections.Generic;
  15:  using System.Reflection;
  16:  using System.Linq;
  17:   
  18:  namespace Ia.Ngn.Cl.Model.Data.Nokia
  19:  {
  20:      ////////////////////////////////////////////////////////////////////////////
  21:   
  22:      /// <summary publish="true">
  23:      /// Access Management System (AMS) support class for Nokia data model.
  24:      /// </summary>
  25:      /// 
  26:      /// <remarks> 
  27:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  28:      ///
  29:      /// 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
  30:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  31:      ///
  32:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  33:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  34:      /// 
  35:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  36:      /// 
  37:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  38:      /// </remarks> 
  39:      public partial class Ams
  40:      {
  41:          private static Dictionary<string, string> correlationTagDictionary = new Dictionary<string, string>(1000);
  42:   
  43:          public static Dictionary<string, string> CorrelationTagDictionary { get { return correlationTagDictionary; } set { correlationTagDictionary = value; } }
  44:   
  45:          ////////////////////////////////////////////////////////////////////////////
  46:   
  47:          /// <summary>
  48:          ///
  49:          /// </summary>
  50:          public Ams() { }
  51:   
  52:          ////////////////////////////////////////////////////////////////////////////
  53:   
  54:          /// <summary>
  55:          ///
  56:          /// </summary>
  57:          public static string BellcoreStateFromId(int stateId)
  58:          {
  59:              string s;
  60:              Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState bellcoreState;
  61:   
  62:              bellcoreState = (Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState)stateId;
  63:   
  64:              switch (bellcoreState)
  65:              {
  66:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.IsNr: s = "IS-NR"; break;
  67:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.OosAu: s = "OOS-AU"; break;
  68:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.OosAuma: s = "OOS-AUMA"; break;
  69:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.OosMa: s = "OOS-MA"; break;
  70:                  case Ia.Ngn.Cl.Model.Business.Nokia.Ams.BellcoreState.Undefined: s = "Undefined"; break;
  71:                  default: s = "Undefined"; break;
  72:              }
  73:   
  74:              return s;
  75:          }
  76:   
  77:          ////////////////////////////////////////////////////////////////////////////
  78:   
  79:          /// <summary>
  80:          ///
  81:          /// </summary>
  82:          public static string PlannedSoftware
  83:          {
  84:              get
  85:              {
  86:                  return "3FE50853AFXA35";
  87:              }
  88:          }
  89:   
  90:          ////////////////////////////////////////////////////////////////////////////
  91:   
  92:          /// <summary>
  93:          ///
  94:          /// </summary>
  95:          public static int NextVacantFlatTermIdForOnt(int familyTypeId, Ia.Ngn.Cl.Model.Ont ont)
  96:          {
  97:              int ft, gwId;
  98:              List<int> list;
  99:   
 100:              if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
 101:              {
 102:                  gwId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
 103:   
 104:                  list = Ia.Ngn.Cl.Model.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
 105:   
 106:                  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
 107:                  else
 108:                  {
 109:                      list = Ia.Cl.Model.Default.ExcludedNumberListFromNumberListWithinRange(list, Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType((Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)familyTypeId));
 110:   
 111:                      if (list.Count > 0) ft = list[0];
 112:                      else ft = 0; // something went wrong
 113:                  }
 114:              }
 115:              else
 116:              {
 117:                  ft = 0; // something went wrong
 118:              }
 119:   
 120:              return ft;
 121:          }
 122:   
 123:          ////////////////////////////////////////////////////////////////////////////
 124:   
 125:          /// <summary>
 126:          ///
 127:          /// </summary>
 128:          public static List<int> VacantFlatTermIdForOntList(int familyTypeId, Ia.Ngn.Cl.Model.Ont ont)
 129:          {
 130:              int gwId;
 131:              List<int> vacantList, usedList;
 132:   
 133:              if (ont.OntServiceVoips != null && ont.OntServiceVoips.Count > 0)
 134:              {
 135:                  gwId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(ont.OntServiceVoips.First().Ip);
 136:   
 137:                  usedList = Ia.Ngn.Cl.Model.Data.Nokia.AgcfEndpoint.UsedFlatTermIdListForGatewayId(gwId);
 138:   
 139:                  vacantList = Ia.Cl.Model.Default.ExcludedNumberListFromNumberListWithinRange(usedList, Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType((Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)familyTypeId));
 140:              }
 141:              else
 142:              {
 143:                  vacantList = new List<int>();
 144:              }
 145:   
 146:              return vacantList;
 147:          }
 148:   
 149:          ////////////////////////////////////////////////////////////////////////////
 150:   
 151:          /// <summary>
 152:          ///
 153:          /// </summary>
 154:          public static Ia.Ngn.Cl.Model.Ont OntFromGwId(int gwId)
 155:          {
 156:              string ip;
 157:              Ia.Ngn.Cl.Model.Ont ont;
 158:   
 159:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 160:              {
 161:                  ip = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.IpFromGatewayId(gwId);
 162:   
 163:                  ont = (from o in db.Onts where o.OntServiceVoips.First().Ip == ip select o).SingleOrDefault();
 164:              }
 165:   
 166:              return ont;
 167:          }
 168:   
 169:          ////////////////////////////////////////////////////////////////////////////
 170:          ////////////////////////////////////////////////////////////////////////////
 171:      }
 172:   
 173:      ////////////////////////////////////////////////////////////////////////////
 174:      ////////////////////////////////////////////////////////////////////////////
 175:  }