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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ems

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

Access Management System (AMS) support class for Huawei's Next Generation Network (NGN) data model.

   1:  using System.Data;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Data.Huawei
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Access Management System (AMS) support class for Huawei's Next Generation Network (NGN) data model.
  11:      /// </summary>
  12:   
  13:      /// <remarks> 
  14:      /// Copyright © 2016-2018 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 Ems
  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 static int NextVacantTelForOnt(Ia.Ngn.Cl.Model.Huawei.EmsOnt emsOnt)
  38:          {
  39:              int telPort;
  40:              List<int> list;
  41:   
  42:              list = Ia.Ngn.Cl.Model.Data.Huawei.Ems.UsedTelListForEmsOntId(emsOnt.Id);
  43:   
  44:              if (list.Count == 0) telPort = 1; // this means OntSipInfo does not exist for any number and the box is empty, and we should create number at 1
  45:              else
  46:              {
  47:                  list = Ia.Cl.Model.Default.ExcludedNumberListFromNumberListWithinRange(list, Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleNumberOfTdForOntEquipmentType(emsOnt.EquipmentType));
  48:   
  49:                  if (list.Count > 0) telPort = list[0];
  50:                  else telPort = 0; // something went wrong
  51:              }
  52:   
  53:              return telPort;
  54:          }
  55:   
  56:          ////////////////////////////////////////////////////////////////////////////
  57:   
  58:          /// <summary>
  59:          ///
  60:          /// </summary>
  61:          public static Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn NextVacantMduFnSnPnForOnt(Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mdu, Ia.Ngn.Cl.Model.Huawei.EmsOnt emsOnt)
  62:          {
  63:              Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn fnSnPn;
  64:              List<Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn> usedList, possibleList, list;
  65:   
  66:              usedList = Ia.Ngn.Cl.Model.Data.Huawei.Ems.UsedEmsVoipPstnUserFnSnPnListForEmsOntId(emsOnt.Id);
  67:   
  68:              if (usedList.Count == 0)
  69:              {
  70:                  fnSnPn = new Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn(); // this means EmsVoipPstnUsers does not exist for any number and the box is empty, and we should create number at 0
  71:              }
  72:              else
  73:              {
  74:                  possibleList = mdu.PossibleFnSnPnList;
  75:   
  76:                  list = possibleList.Except(usedList).ToList();
  77:   
  78:                  if (list.Count > 0) fnSnPn = list[0];
  79:                  else fnSnPn = null; // something went wrong
  80:              }
  81:   
  82:              return fnSnPn;
  83:          }
  84:   
  85:          ////////////////////////////////////////////////////////////////////////////
  86:   
  87:          /// <summary>
  88:          ///
  89:          /// </summary>
  90:          private static List<int> UsedTelListForEmsOntId(string emsOntId)
  91:          {
  92:              List<int> list;
  93:   
  94:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  95:              {
  96:                  list = (from eosi in db.EmsOntSipInfos where eosi.EmsOnt.Id == emsOntId orderby eosi.TEL ascending select eosi.TEL).ToList<int>();
  97:              }
  98:   
  99:              return list;
 100:          }
 101:   
 102:          ////////////////////////////////////////////////////////////////////////////
 103:   
 104:          /// <summary>
 105:          ///
 106:          /// </summary>
 107:          private static List<Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn> UsedEmsVoipPstnUserFnSnPnListForEmsOntId(string emsOntId)
 108:          {
 109:              List<Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn> list;
 110:   
 111:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 112:              {
 113:                  list = (from evpu in db.EmsVoipPstnUsers
 114:                          where evpu.EmsOnt.Id == emsOntId
 115:                          select new Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn { Fn = evpu.FN, Sn = evpu.SN, Pn = evpu.PN }).ToList<Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn>();
 116:              }
 117:   
 118:              return list;
 119:          }
 120:   
 121:          ////////////////////////////////////////////////////////////////////////////
 122:          ////////////////////////////////////////////////////////////////////////////
 123:   
 124:          /// <summary>
 125:          ///
 126:          /// </summary>
 127:          public static void SendReadDevList(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, string devType)
 128:          {
 129:              string command;
 130:   
 131:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadDevListCommand(devType);
 132:   
 133:              ems.SendQueue.Enqueue(command);
 134:          }
 135:   
 136:          ////////////////////////////////////////////////////////////////////////////
 137:          ////////////////////////////////////////////////////////////////////////////
 138:   
 139:          /// <summary>
 140:          ///
 141:          /// </summary>
 142:          public static void SendReadBoardList(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, string dev)
 143:          {
 144:              string command;
 145:   
 146:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadBoardListCommand(dev);
 147:   
 148:              ems.SendQueue.Enqueue(command);
 149:          }
 150:   
 151:          ////////////////////////////////////////////////////////////////////////////
 152:   
 153:          /// <summary>
 154:          ///
 155:          /// </summary>
 156:          public static void SendReadOntList(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, int did)
 157:          {
 158:              string command;
 159:   
 160:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadOntListCommand(did);
 161:   
 162:              ems.SendQueue.Enqueue(command);
 163:          }
 164:   
 165:          ////////////////////////////////////////////////////////////////////////////
 166:          ////////////////////////////////////////////////////////////////////////////
 167:   
 168:          /// <summary>
 169:          ///
 170:          /// </summary>
 171:          public static void SendReadPortList(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, string dev, int fn, int sn)
 172:          {
 173:              string command;
 174:   
 175:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadPortListCommand(dev, fn, sn);
 176:   
 177:              ems.SendQueue.Enqueue(command);
 178:          }
 179:   
 180:          ////////////////////////////////////////////////////////////////////////////
 181:          ////////////////////////////////////////////////////////////////////////////
 182:   
 183:          /// <summary>
 184:          ///
 185:          /// </summary>
 186:          public static void SendCreateOntSipInfo(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, string service, int telPort)
 187:          {
 188:              string command;
 189:   
 190:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.CreateOrModifyOntSipInfoCommand(nddOnt, service, telPort);
 191:   
 192:              ems.SendQueue.Enqueue(command);
 193:          }
 194:   
 195:          ////////////////////////////////////////////////////////////////////////////
 196:   
 197:          /// <summary>
 198:          ///
 199:          /// </summary>
 200:          public static void SendReadOntSipInfo(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt)
 201:          {
 202:              string command;
 203:   
 204:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadOntSipInfoCommand(nddOnt);
 205:   
 206:              ems.SendQueue.Enqueue(command);
 207:          }
 208:   
 209:          ////////////////////////////////////////////////////////////////////////////
 210:   
 211:          /// <summary>
 212:          ///
 213:          /// </summary>
 214:          public static void SendVacateOntSipInfo(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, string service, int telPort)
 215:          {
 216:              string command;
 217:   
 218:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.VacateOntSipInfoCommand(nddOnt, service, telPort);
 219:   
 220:              ems.SendQueue.Enqueue(command);
 221:          }
 222:   
 223:          ////////////////////////////////////////////////////////////////////////////
 224:          ////////////////////////////////////////////////////////////////////////////
 225:   
 226:          /// <summary>
 227:          ///
 228:          /// </summary>
 229:          public static void SendCreateVoipPstnUser(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mduDev, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, string service, int sn, int telPort)
 230:          {
 231:              string command;
 232:   
 233:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.CreateOrModifyVoipPstnUserCommand(mduDev, nddOnt, service, sn, telPort);
 234:   
 235:              ems.SendQueue.Enqueue(command);
 236:          }
 237:   
 238:          ////////////////////////////////////////////////////////////////////////////
 239:   
 240:          /// <summary>
 241:          ///
 242:          /// </summary>
 243:          public static void SendReadVoipPstnUser(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mduDev, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, int sn, int telPort)
 244:          {
 245:              string command;
 246:   
 247:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadVoipPstnUserCommand(mduDev, nddOnt, sn, telPort);
 248:   
 249:              ems.SendQueue.Enqueue(command);
 250:          }
 251:   
 252:          ////////////////////////////////////////////////////////////////////////////
 253:   
 254:          /// <summary>
 255:          ///
 256:          /// </summary>
 257:          public static void SendDeleteVoipPstnUser(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mduDev, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, string service, int sn, int telPort)
 258:          {
 259:              string command;
 260:   
 261:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.DeleteVoipPstnUserCommand(mduDev, nddOnt, service, sn, telPort);
 262:   
 263:              ems.SendQueue.Enqueue(command);
 264:          }
 265:   
 266:          ////////////////////////////////////////////////////////////////////////////
 267:          ////////////////////////////////////////////////////////////////////////////
 268:   
 269:          /// <summary>
 270:          ///
 271:          /// </summary>
 272:          public static void SendCreateVoipPstnAccount(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mduDev, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, string service, int sn, int telPort)
 273:          {
 274:              string command;
 275:   
 276:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.CreateOrModifyVoipPstnAccountCommand(mduDev, nddOnt, service, sn, telPort);
 277:   
 278:              ems.SendQueue.Enqueue(command);
 279:          }
 280:   
 281:          ////////////////////////////////////////////////////////////////////////////
 282:   
 283:          /// <summary>
 284:          ///
 285:          /// </summary>
 286:          public static void SendReadVoipPstnAccount(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt)
 287:          {
 288:              string command;
 289:   
 290:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.ReadVoipPstnAccountCommand(nddOnt);
 291:   
 292:              ems.SendQueue.Enqueue(command);
 293:          }
 294:   
 295:          ////////////////////////////////////////////////////////////////////////////
 296:   
 297:          /// <summary>
 298:          ///
 299:          /// </summary>
 300:          public static void SendVacateVoipPstnAccount(Ia.Ngn.Cl.Model.Client.Huawei.Ems ems, Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mduDev, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, string service, int sn, int telPort)
 301:          {
 302:              string command;
 303:   
 304:              command = Ia.Ngn.Cl.Model.Business.Huawei.Ems.VacateVoipPstnAccountCommand(mduDev, nddOnt, service, sn, telPort);
 305:   
 306:              ems.SendQueue.Enqueue(command);
 307:          }
 308:   
 309:          ////////////////////////////////////////////////////////////////////////////
 310:          ////////////////////////////////////////////////////////////////////////////   
 311:      }
 312:   
 313:      ////////////////////////////////////////////////////////////////////////////
 314:      ////////////////////////////////////////////////////////////////////////////   
 315:  }