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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Service

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

Service support class for Next Generation Network (NGN) data model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Data;
   4:  using System.IO;
   5:  using System.Linq;
   6:  using System.Reflection;
   7:  using System.Web;
   8:  using System.Xml.Linq;
   9:  using System.Text.RegularExpressions;
  10:   
  11:  namespace Ia.Ngn.Cl.Model.Data
  12:  {
  13:      ////////////////////////////////////////////////////////////////////////////
  14:   
  15:      /// <summary publish="true">
  16:      /// Service support class for Next Generation Network (NGN) data model.
  17:      /// </summary>
  18:      /// 
  19:      /// <remarks> 
  20:      /// Copyright © 2006-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  21:      ///
  22:      /// 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
  23:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  24:      ///
  25:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  26:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  27:      /// 
  28:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  29:      /// 
  30:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  31:      /// </remarks> 
  32:      public partial class Service
  33:      {
  34:          private static XDocument xDocument;
  35:          private static List<Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea> kuwaitNgnAreaList;
  36:          private static List<int> domainList, pstnDomainList, axePstnDomainList, ewsdPstnDomainList, migrationDomainList, nokiaSwitchDomainList, huaweiSwitchDomainList;
  37:          private static List<Ia.Ngn.Cl.Model.Business.Service.ServiceType> serviceTypeList;
  38:          private static Dictionary<string, int> serviceIdPositionDictionary;
  39:          private static List<int> serviceList = new List<int>();
  40:   
  41:          private static readonly object objectLock = new object();
  42:   
  43:          ////////////////////////////////////////////////////////////////////////////
  44:   
  45:          /// <summary>
  46:          ///
  47:          /// </summary>
  48:          public Service() { }
  49:   
  50:   
  51:          ////////////////////////////////////////////////////////////////////////////
  52:   
  53:          /// <summary>
  54:          ///
  55:          /// </summary>
  56:          public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> GponServiceToOntRouterVendorInAllowedToBeMigratedOltDictionary
  57:          {
  58:              get
  59:              {
  60:                  string service, accessId;
  61:                  Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> dictionary;
  62:   
  63:                  var gponServiceToAccessIdInAllowedToBeMigratedOltDictionary = Ia.Ngn.Cl.Model.Data.Service2.GponServiceToAccessIdInAllowedToBeMigratedOltDictionary;
  64:   
  65:                  var allowedToBeMigratedAccessIdToOntDictionary = Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedAccessIdToOntDictionary;
  66:   
  67:                  dictionary = new Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor>();
  68:   
  69:                  foreach (KeyValuePair<string, string> kvp in gponServiceToAccessIdInAllowedToBeMigratedOltDictionary)
  70:                  {
  71:                      service = kvp.Key;
  72:                      accessId = kvp.Value;
  73:   
  74:                      dictionary[service] = allowedToBeMigratedAccessIdToOntDictionary[accessId].Pon.PonGroup.Olt.Odf.Router.Vendor;
  75:                  }
  76:   
  77:                  return dictionary;
  78:              }
  79:          }
  80:   
  81:          ////////////////////////////////////////////////////////////////////////////
  82:   
  83:          /// <summary>
  84:          ///
  85:          /// </summary>
  86:          public static List<string> ServiceThatDoNotExistInServiceRequestServiceServiceIdList()
  87:          {
  88:              List<string> list;
  89:   
  90:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  91:              {
  92:                  list = (from s in db.Service2
  93:                          join srs in db.ServiceRequestServices on s.Id equals srs.Id into gj
  94:                          from subsrs in gj.DefaultIfEmpty()
  95:                          where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && subsrs.Id == null
  96:                          select s.Id).ToList();
  97:              }
  98:   
  99:              return list;
 100:          }
 101:   
 102:          ////////////////////////////////////////////////////////////////////////////
 103:   
 104:          /// <summary>
 105:          ///
 106:          /// </summary>
 107:          public static void DifferenceBetweenServiceAndServiceRequestOntDetailsOfTheCustomerDepartmentDatabase(out List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> toInsertIntoCustomerDepartment, out List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> toRemoveFromCustomerDepartment)
 108:          {
 109:              List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> toRemoveBecauseServicePositionIsUndefinedList, toRemoveFromCustomerDepartmentBecauseDoesNotExistInService, toOverwriteByRemovingFirstInCustomerDepartment;
 110:              Dictionary<string, int> serviceIdPositionDictionary;
 111:   
 112:              toRemoveBecauseServicePositionIsUndefinedList = new List<Business.ServiceServiceRequestOnt>();
 113:   
 114:              serviceIdPositionDictionary = Ia.Ngn.Cl.Model.Data.Service.ServiceIdPositionDictionary;
 115:   
 116:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 117:              {
 118:                  // insert into db:
 119:                  /*
 120:  select distinct s.Id, s.Service, s.ServiceType, sro.Id from Service2 s
 121:  inner join ServiceRequestOnts sro on s.Access_Id = sro.Access_Id
 122:  left outer join ServiceRequestOntDetails srod on sro.Id = srod.ServiceRequestOnt_Id
 123:  where srod.Id is null and s.Access_Id is not null and sro.Access_Id is not null 
 124:  order by s.Service
 125:  */
 126:                  toInsertIntoCustomerDepartment = (from s in db.Service2
 127:                                                    join sro in db.ServiceRequestOnts on s.Access.Id equals sro.Access.Id
 128:                                                    join srod in db.ServiceRequestOntDetails on sro.Id equals srod.ServiceRequestOnt.Id
 129:                                                    into gj
 130:                                                    from srodgj in gj.DefaultIfEmpty()
 131:                                                    where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && srodgj.Id == null && s.Access != null && sro.Access != null
 132:                                                    select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
 133:                                                    {
 134:                                                        ServiceId = s.Id,
 135:                                                        Service = s.Service,
 136:                                                        ServiceType = s.ServiceType,
 137:                                                        ServiceRequestOnt = sro
 138:                                                    }).Distinct().ToList();
 139:   
 140:                  foreach (var v in toInsertIntoCustomerDepartment)
 141:                  {
 142:                      if (serviceIdPositionDictionary.ContainsKey(v.ServiceId))
 143:                      {
 144:                          v.ServicePosition = serviceIdPositionDictionary[v.ServiceId];
 145:                      }
 146:                      else
 147:                      {
 148:                          toRemoveBecauseServicePositionIsUndefinedList.Add(v);
 149:                      }
 150:                  }
 151:   
 152:                  // I will remove the following from list because the service position is not defined
 153:                  foreach (var v in toRemoveBecauseServicePositionIsUndefinedList) toInsertIntoCustomerDepartment.Remove(v);
 154:   
 155:                  toInsertIntoCustomerDepartment = toInsertIntoCustomerDepartment.OrderBy(u => u.Service).ToList();
 156:   
 157:   
 158:                  // remove from db:
 159:   
 160:                  toOverwriteByRemovingFirstInCustomerDepartment = (from s in db.Service2
 161:                                                                    join sro in db.ServiceRequestOnts on s.Access.Id equals sro.Access.Id
 162:                                                                    join srod in db.ServiceRequestOntDetails on s.Service equals srod.Service
 163:                                                                    where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && srod.ServiceRequestOnt != null && srod.ServiceRequestOnt.Id != sro.Access.Id //&& s.Service == "25488888"
 164:                                                                    select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
 165:                                                                    {
 166:                                                                        ServiceId = s.Id,
 167:                                                                        Service = s.Service,
 168:                                                                        ServiceType = s.ServiceType,
 169:                                                                        ServiceRequestOnt = srod.ServiceRequestOnt
 170:                                                                    }).Distinct().ToList();
 171:   
 172:                  toRemoveFromCustomerDepartmentBecauseDoesNotExistInService = (from srod in db.ServiceRequestOntDetails
 173:                                                                                join sro in db.ServiceRequestOnts on srod.ServiceRequestOnt.Id equals sro.Id
 174:                                                                                join s in db.Service2 on srod.Service equals s.Service
 175:                                                                                into gj
 176:                                                                                from subs in gj.DefaultIfEmpty()
 177:                                                                                where /*subs.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService &&*/ subs.Id == null && sro.Access != null //&& srod.Service == "25488888"
 178:                                                                                select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
 179:                                                                                {
 180:                                                                                    Service = srod.Service,
 181:                                                                                    ServiceRequestOnt = sro
 182:                                                                                }).Distinct().ToList();
 183:   
 184:                  toRemoveFromCustomerDepartment = toRemoveFromCustomerDepartmentBecauseDoesNotExistInService.Union(toOverwriteByRemovingFirstInCustomerDepartment).Distinct().ToList();
 185:              }
 186:          }
 187:   
 188:          ////////////////////////////////////////////////////////////////////////////
 189:   
 190:          /// <summary>
 191:          ///
 192:          /// </summary>
 193:          public static List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> ServiceServiceRequestOntDetailWithMismatchedInformationInServiceRequestOntDetailList()
 194:          {
 195:              List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> list;
 196:              Dictionary<string, int> serviceIdPositionDictionary;
 197:   
 198:              serviceIdPositionDictionary = Ia.Ngn.Cl.Model.Data.Service.ServiceIdPositionDictionary;
 199:   
 200:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 201:              {
 202:                  list = (from s in db.Service2
 203:                          join sro in db.ServiceRequestOnts on s.Access.Id equals sro.Access.Id
 204:                          join srod in db.ServiceRequestOntDetails on sro.Id equals srod.ServiceRequestOnt.Id /*into gj
 205:                          from subsrod in gj.DefaultIfEmpty()*/
 206:                          where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && /*subsrod.Id == null &&*/ s.Access != null && sro.Access != null
 207:                          select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
 208:                          {
 209:                              ServiceId = s.Id,
 210:                              Service = s.Service,
 211:                              ServiceType = s.ServiceType,
 212:                              ServiceRequestOnt = sro
 213:                          }).ToList();
 214:   
 215:                  foreach (var v in list)
 216:                  {
 217:                      if (serviceIdPositionDictionary.ContainsKey(v.ServiceId))
 218:                      {
 219:                          v.ServicePosition = serviceIdPositionDictionary[v.ServiceId];
 220:                      }
 221:                  }
 222:              }
 223:   
 224:              return list.OrderBy(u => u.Service).ToList();
 225:          }
 226:   
 227:          ////////////////////////////////////////////////////////////////////////////
 228:   
 229:          /// <summary>
 230:          ///
 231:          /// </summary>
 232:          public static Dictionary<string, int> ServiceIdPositionDictionary
 233:          {
 234:              get
 235:              {
 236:                  lock (objectLock)
 237:                  {
 238:                      if (serviceIdPositionDictionary == null || serviceIdPositionDictionary.Count == 0) serviceIdPositionDictionary = Ia.Ngn.Cl.Model.Data.Service._ServiceIdPositionDictionary;
 239:   
 240:                      return serviceIdPositionDictionary;
 241:                  }
 242:              }
 243:          }
 244:   
 245:          ////////////////////////////////////////////////////////////////////////////
 246:   
 247:          /// <summary>
 248:          ///
 249:          /// </summary>
 250:          private static Dictionary<string, int> _ServiceIdPositionDictionary
 251:          {
 252:              get
 253:              {
 254:                  string key;
 255:                  Dictionary<string, int> dictionary, nokiaToNokiaDictionary, nokiaToHuaweiEmsOntSipInfoesDictionary, nokiaToHuaweiEmsVoipPstnUsersDictionary, huaweiToHuaweiEmsOntSipInfoesDictionary, huaweiToHuaweiEmsVoipPstnUsersDictionary;
 256:   
 257:                  nokiaToNokiaDictionary = new Dictionary<string, int>();
 258:                  nokiaToHuaweiEmsOntSipInfoesDictionary = new Dictionary<string, int>();
 259:                  nokiaToHuaweiEmsVoipPstnUsersDictionary = new Dictionary<string, int>();
 260:                  huaweiToHuaweiEmsOntSipInfoesDictionary = new Dictionary<string, int>();
 261:   
 262:                  var dummyVarToDrawRefractorToBelow = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service("0000000");
 263:   
 264:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 265:                  {
 266:                      // No-No
 267:                      nokiaToNokiaDictionary = (from s in db.Subscribers
 268:                                                join sp in db.SubParties on s.SubParty.Id equals sp.Id
 269:                                                join ep in db.AgcfEndpoints on sp.AgcfEndpoint.Id equals ep.Id
 270:                                                select new { s.Id, ep.FlatTermID }).Distinct().ToDictionary(u => u.Id, u => u.FlatTermID);
 271:   
 272:   
 273:                      // No-Hu ONT with EmsOntSipInfo
 274:                      // select * from Subscribers as s inner join EmsOntSipInfoes as eosi on s.PartyId = eosi.SIPUSERNAME 
 275:                      var list = (from s in db.Subscribers
 276:                                  join eosi in db.EmsOntSipInfoes on s.PartyId equals eosi.SIPUSERNAME
 277:                                  select new { s.Id, eosi.TEL }).ToList();
 278:   
 279:                      foreach (var l in list) if (!nokiaToHuaweiEmsOntSipInfoesDictionary.ContainsKey(l.Id)) nokiaToHuaweiEmsOntSipInfoesDictionary[l.Id] = l.TEL;
 280:   
 281:   
 282:                      // No-Hu MDU with EmsVoipPstnUser
 283:                      // select s.Id, evpu.PN from Subscribers as s inner join EmsVoipPstnUsers as evpu on s.PartyId = '+' + evpu.DN
 284:                      var list2 = (from s in db.Subscribers
 285:                                   join evpu in db.EmsVoipPstnUsers on s.PartyId equals "+" + evpu.DN // see: Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode()
 286:                                   select new { s.Id, evpu.PN }).ToList();
 287:   
 288:                      foreach (var l in list2) if (!nokiaToHuaweiEmsVoipPstnUsersDictionary.ContainsKey(l.Id)) nokiaToHuaweiEmsVoipPstnUsersDictionary[l.Id] = l.PN;
 289:   
 290:   
 291:                      // Hu-Hu ONT with EmsOntSipInfo
 292:                      // I will use SIPUSERNAME because looks similar for Nokia and Huawei switches, but SIPNAME sometimes like +96525422460@ims.moc.kw and like priv_96524602282
 293:                      // select s.IMPU, eosi.SIPUSERNAME, eosi.TEL from HuSbrs as s inner join EmsOntSipInfoes as eosi on s.IMPU = 'sip:' + eosi.SIPNAME
 294:                      var list3 = (from s in db.HuSbrs
 295:                                   join eosi in db.EmsOntSipInfoes on s.IMPU equals "sip:" + eosi.SIPNAME  // see: Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain()
 296:                                   select new { s.IMPU, eosi.TEL }).ToList();
 297:   
 298:                      foreach (var l in list3) if (!huaweiToHuaweiEmsOntSipInfoesDictionary.ContainsKey(l.IMPU)) huaweiToHuaweiEmsOntSipInfoesDictionary[l.IMPU] = l.TEL;
 299:   
 300:   
 301:                      // Hu-Hu MDU with EmsVoipPstnUser
 302:                      // select * from HuSbrs s inner join EmsVoipPstnUsers evpu on s.IMPU = 'sip:+' + evpu.DN + '@ims.moc.kw'
 303:                      huaweiToHuaweiEmsVoipPstnUsersDictionary = (from s in db.HuSbrs
 304:                                                                  join evpu in db.EmsVoipPstnUsers on s.IMPU equals "sip:+" + evpu.DN + "@ims.moc.kw" // see: Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode()
 305:                                                                  select new { s.IMPU, evpu.PN }).Distinct().ToDictionary(u => u.IMPU, u => u.PN);
 306:   
 307:   
 308:                      // Hu-No
 309:   
 310:   
 311:   
 312:                      dictionary = new Dictionary<string, int>(nokiaToNokiaDictionary.Count + nokiaToHuaweiEmsOntSipInfoesDictionary.Count + huaweiToHuaweiEmsOntSipInfoesDictionary.Count + huaweiToHuaweiEmsVoipPstnUsersDictionary.Count);
 313:   
 314:   
 315:                      foreach (KeyValuePair<string, int> kvp in nokiaToNokiaDictionary)
 316:                      {
 317:                          key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
 318:                          key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService);
 319:                          dictionary[key] = kvp.Value;
 320:                      }
 321:   
 322:                      foreach (KeyValuePair<string, int> kvp in nokiaToHuaweiEmsOntSipInfoesDictionary)
 323:                      {
 324:                          key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
 325:                          key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService);
 326:                          dictionary[key] = kvp.Value;
 327:                      }
 328:   
 329:                      foreach (KeyValuePair<string, int> kvp in nokiaToHuaweiEmsVoipPstnUsersDictionary)
 330:                      {
 331:                          key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
 332:                          key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService);
 333:                          dictionary[key] = Ia.Ngn.Cl.Model.Business.Service.ConvertEmsVoipPstnUsersPnToServiceRequestServicePosition(kvp.Value);
 334:                      }
 335:   
 336:                      foreach (KeyValuePair<string, int> kvp in huaweiToHuaweiEmsOntSipInfoesDictionary)
 337:                      {
 338:                          key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
 339:                          key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService);
 340:                          dictionary[key] = kvp.Value;
 341:                      }
 342:   
 343:                      foreach (KeyValuePair<string, int> kvp in huaweiToHuaweiEmsVoipPstnUsersDictionary)
 344:                      {
 345:                          key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
 346:                          key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService);
 347:                          dictionary[key] = Ia.Ngn.Cl.Model.Business.Service.ConvertEmsVoipPstnUsersPnToServiceRequestServicePosition(kvp.Value);
 348:                      }
 349:                  }
 350:   
 351:                  return dictionary;
 352:              }
 353:          }
 354:   
 355:          ////////////////////////////////////////////////////////////////////////////
 356:   
 357:          /// <summary>
 358:          ///
 359:          /// </summary>
 360:          public static int ServicePosition(string service)
 361:          {
 362:              int port;
 363:              string partyId, impu;
 364:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
 365:   
 366:              switchVendor = Ia.Ngn.Cl.Model.Business.Service.SwitchVendor(service);
 367:   
 368:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 369:              {
 370:                  if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 371:                  {
 372:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
 373:   
 374:                      // No-No (db.Subscribers partyId and Id format +96523230000)
 375:                      var ep1 = (from s in db.Subscribers
 376:                                 join sp in db.SubParties on s.SubParty.Id equals sp.Id
 377:                                 join ep in db.AgcfEndpoints on sp.AgcfEndpoint.Id equals ep.Id
 378:                                 where s.PartyId == partyId
 379:                                 select ep).SingleOrDefault();
 380:   
 381:                      if (ep1 != null) port = ep1.FlatTermID;
 382:                      else
 383:                      {
 384:                          // No-Hu ONT with EmsOntSipInfo (db.Subscribers partyId and Id have format +96523230000)
 385:                          var eosi1 = (from s in db.Subscribers
 386:                                       join eosi in db.EmsOntSipInfoes on s.PartyId equals eosi.SIPUSERNAME
 387:                                       where s.PartyId == partyId
 388:                                       select eosi).SingleOrDefault();
 389:   
 390:                          if (eosi1 != null) port = eosi1.TEL;
 391:                          else
 392:                          {
 393:                              // No-Hu MDU (db.Subscribers partyId and Id have format +96523230000)
 394:                              var evpu1 = (from s in db.Subscribers
 395:                                           join evpu in db.EmsVoipPstnUsers on s.PartyId equals "+" + evpu.DN
 396:                                           where s.PartyId == partyId
 397:                                           select evpu).SingleOrDefault();
 398:   
 399:                              if (evpu1 != null)
 400:                              {
 401:                                  port = evpu1.PN;
 402:                                  port = Ia.Ngn.Cl.Model.Business.Service.ConvertEmsVoipPstnUsersPnToServiceRequestServicePosition(port);
 403:                              }
 404:                              else port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown;
 405:                          }
 406:                      }
 407:                  }
 408:                  else if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 409:                  {
 410:                      impu = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
 411:   
 412:                      // Hu-Hu ONT (db.HuSbrs IMPU have format sip:+96523610000@ims.moc.kw)
 413:                      var eosi1 = (from s in db.HuSbrs
 414:                                   join eosi in db.EmsOntSipInfoes on s.IMPU equals "sip:" + eosi.SIPNAME
 415:                                   where s.IMPU == impu
 416:                                   select eosi).SingleOrDefault();
 417:   
 418:                      if (eosi1 != null) port = eosi1.TEL;
 419:                      else
 420:                      {
 421:                          // Hu-Hu MDU (db.HuSbrs IMPU have format sip:+96523610000@ims.moc.kw)
 422:                          var evpu1 = (from s in db.HuSbrs
 423:                                       join evpu in db.EmsVoipPstnUsers on s.IMPU equals "sip:+" + evpu.DN + "@ims.moc.kw"
 424:                                       where s.IMPU == impu
 425:                                       select evpu).SingleOrDefault();
 426:   
 427:                          if (evpu1 != null)
 428:                          {
 429:                              port = evpu1.PN;
 430:                              port = Ia.Ngn.Cl.Model.Business.Service.ConvertEmsVoipPstnUsersPnToServiceRequestServicePosition(port);
 431:                          }
 432:                          else port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown;
 433:                      }
 434:                  }
 435:                  else //if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Undefined)
 436:                  {
 437:                      port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown;
 438:                  }
 439:              }
 440:   
 441:              return port;
 442:          }
 443:   
 444:          ////////////////////////////////////////////////////////////////////////////
 445:   
 446:          /// <summary>
 447:          ///
 448:          /// </summary>
 449:          public static List<Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea> KuwaitNgnAreaList
 450:          {
 451:              get
 452:              {
 453:                  lock (objectLock)
 454:                  {
 455:                      if (kuwaitNgnAreaList == null || kuwaitNgnAreaList.Count == 0) kuwaitNgnAreaList = Ia.Ngn.Cl.Model.Data.Service._KuwaitNgnAreaList;
 456:   
 457:                      return kuwaitNgnAreaList;
 458:                  }
 459:              }
 460:          }
 461:   
 462:          ////////////////////////////////////////////////////////////////////////////
 463:   
 464:          /// <summary>
 465:          ///
 466:          /// </summary>
 467:          private static List<Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea> _KuwaitNgnAreaList
 468:          {
 469:              get
 470:              {
 471:                  int id;
 472:                  string symbol;//, text, key, value;
 473:                  //List<int> list;
 474:                  //Dictionary<string, List<string>> dictionaryList;
 475:                  Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea kuwaitNgnArea;
 476:   
 477:                  kuwaitNgnAreaList = new List<Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea>();
 478:   
 479:                  foreach (XElement xe in XDocument.Element("service").Elements("areaList").Elements("area"))
 480:                  {
 481:                      kuwaitNgnArea = new Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea();
 482:   
 483:                      id = int.Parse(xe.Attribute("id").Value);
 484:                      kuwaitNgnArea.Id = id;
 485:   
 486:                      symbol = xe.Attribute("symbol").Value;
 487:                      kuwaitNgnArea.Symbol = symbol;
 488:   
 489:                      kuwaitNgnArea.ServiceRequestAddressProvinceAreaName = xe.Attribute("serviceRequestAddressProvinceAreaName").Value;
 490:   
 491:                      kuwaitNgnArea.Name = (from ka in Ia.Cl.Model.Kuwait.KuwaitAreaList where ka.Id == id select ka.Name).SingleOrDefault();
 492:                      kuwaitNgnArea.ArabicName = (from ka in Ia.Cl.Model.Kuwait.KuwaitAreaList where ka.Id == id select ka.ArabicName).SingleOrDefault();
 493:   
 494:                      kuwaitNgnArea.SiteList = (from s in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SiteList where s.AreaSymbolList.Contains(symbol) select s).ToList();
 495:   
 496:                      if (kuwaitNgnArea.SiteList != null) kuwaitNgnAreaList.Add(kuwaitNgnArea);
 497:                  }
 498:   
 499:                  return kuwaitNgnAreaList;
 500:              }
 501:          }
 502:   
 503:          ////////////////////////////////////////////////////////////////////////////
 504:   
 505:          /// <summary>
 506:          ///
 507:          /// </summary>
 508:          public static Dictionary<int, string> AreaIdToSymbolDictionary
 509:          {
 510:              get
 511:              {
 512:                  Dictionary<int, string> dictionary;
 513:   
 514:                  dictionary = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList
 515:                                select new { kna.Id, kna.Symbol }).ToDictionary(u => u.Id, u => u.Symbol);
 516:   
 517:                  return dictionary;
 518:              }
 519:          }
 520:   
 521:          ////////////////////////////////////////////////////////////////////////////
 522:   
 523:          /// <summary>
 524:          ///
 525:          /// </summary>
 526:          public static Dictionary<int, string> AreaIdToNameArabicNameDictionary
 527:          {
 528:              get
 529:              {
 530:                  Dictionary<int, string> dictionary;
 531:   
 532:                  dictionary = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList
 533:                                select new { kna.Id, kna.NameArabicName }).ToDictionary(u => u.Id, u => u.NameArabicName);
 534:   
 535:                  return dictionary;
 536:              }
 537:          }
 538:   
 539:          ////////////////////////////////////////////////////////////////////////////
 540:   
 541:          /// <summary>
 542:          ///
 543:          /// </summary>
 544:          public static Dictionary<int, int> AreaIdToSiteIdDictionary
 545:          {
 546:              get
 547:              {
 548:                  Dictionary<int, int> dictionary;
 549:   
 550:                  dictionary = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList
 551:                                where kna.SiteList.Count > 0
 552:                                select new { kna.Id, SiteId = kna.SiteList.FirstOrDefault().Id }).ToDictionary(u => u.Id, u => u.SiteId);
 553:   
 554:                  return dictionary;
 555:              }
 556:          }
 557:   
 558:          ////////////////////////////////////////////////////////////////////////////
 559:          ////////////////////////////////////////////////////////////////////////////
 560:   
 561:          /// <summary>
 562:          ///
 563:          /// </summary>
 564:          public static List<int> DomainList
 565:          {
 566:              get
 567:              {
 568:                  lock (objectLock)
 569:                  {
 570:                      if (domainList == null || domainList.Count == 0) domainList = Ia.Ngn.Cl.Model.Data.Service._DomainList;
 571:   
 572:                      return domainList;
 573:                  }
 574:              }
 575:          }
 576:   
 577:          ////////////////////////////////////////////////////////////////////////////
 578:   
 579:          /// <summary>
 580:          ///
 581:          /// </summary>
 582:          private static List<int> _DomainList
 583:          {
 584:              get
 585:              {
 586:                  domainList = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList select r).SelectMany(r => r.DomainList).Distinct().ToList();
 587:   
 588:                  domainList.Sort();
 589:   
 590:                  return domainList;
 591:              }
 592:          }
 593:   
 594:          ////////////////////////////////////////////////////////////////////////////
 595:          ////////////////////////////////////////////////////////////////////////////
 596:   
 597:          /// <summary>
 598:          ///
 599:          /// </summary>
 600:          public static List<int> PstnDomainList
 601:          {
 602:              get
 603:              {
 604:                  lock (objectLock)
 605:                  {
 606:                      if (pstnDomainList == null || pstnDomainList.Count == 0) pstnDomainList = Ia.Ngn.Cl.Model.Data.Service._PstnDomainList;
 607:   
 608:                      return pstnDomainList;
 609:                  }
 610:              }
 611:          }
 612:   
 613:          ////////////////////////////////////////////////////////////////////////////
 614:   
 615:          /// <summary>
 616:          ///
 617:          /// </summary>
 618:          private static List<int> _PstnDomainList
 619:          {
 620:              get
 621:              {
 622:                  pstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList select p).SelectMany(r => r.DomainList).Distinct().ToList();
 623:   
 624:                  pstnDomainList.Sort();
 625:   
 626:                  return pstnDomainList;
 627:              }
 628:          }
 629:   
 630:          ////////////////////////////////////////////////////////////////////////////
 631:   
 632:          /// <summary>
 633:          ///
 634:          /// </summary>
 635:          public static List<int> AxePstnDomainList
 636:          {
 637:              get
 638:              {
 639:                  lock (objectLock)
 640:                  {
 641:                      if (axePstnDomainList == null || axePstnDomainList.Count == 0) axePstnDomainList = Ia.Ngn.Cl.Model.Data.Service._AxePstnDomainList;
 642:   
 643:                      return axePstnDomainList;
 644:                  }
 645:              }
 646:          }
 647:   
 648:          ////////////////////////////////////////////////////////////////////////////
 649:   
 650:          /// <summary>
 651:          ///
 652:          /// </summary>
 653:          private static List<int> _AxePstnDomainList
 654:          {
 655:              get
 656:              {
 657:                  axePstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
 658:                                       where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.EricssonAxe
 659:                                       select p).SelectMany(r => r.DomainList).Distinct().ToList();
 660:   
 661:                  axePstnDomainList.Sort();
 662:   
 663:                  return axePstnDomainList;
 664:              }
 665:          }
 666:   
 667:          ////////////////////////////////////////////////////////////////////////////
 668:          ////////////////////////////////////////////////////////////////////////////
 669:   
 670:          /// <summary>
 671:          ///
 672:          /// </summary>
 673:          public static List<int> EwsdPstnDomainList
 674:          {
 675:              get
 676:              {
 677:                  lock (objectLock)
 678:                  {
 679:                      if (ewsdPstnDomainList == null || ewsdPstnDomainList.Count == 0) ewsdPstnDomainList = Ia.Ngn.Cl.Model.Data.Service._EwsdPstnDomainList;
 680:   
 681:                      return ewsdPstnDomainList;
 682:                  }
 683:              }
 684:          }
 685:   
 686:          ////////////////////////////////////////////////////////////////////////////
 687:   
 688:          /// <summary>
 689:          ///
 690:          /// </summary>
 691:          private static List<int> _EwsdPstnDomainList
 692:          {
 693:              get
 694:              {
 695:                  ewsdPstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
 696:                                        where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.SiemensEwsd
 697:                                        select p).SelectMany(r => r.DomainList).Distinct().ToList();
 698:   
 699:                  ewsdPstnDomainList.Sort();
 700:   
 701:                  return ewsdPstnDomainList;
 702:              }
 703:          }
 704:   
 705:          ////////////////////////////////////////////////////////////////////////////
 706:          ////////////////////////////////////////////////////////////////////////////
 707:   
 708:          /// <summary>
 709:          ///
 710:          /// </summary>
 711:          public static List<int> MigrationDomainList
 712:          {
 713:              get
 714:              {
 715:                  lock (objectLock)
 716:                  {
 717:                      if (migrationDomainList == null || migrationDomainList.Count == 0) migrationDomainList = Ia.Ngn.Cl.Model.Data.Service._MigrationDomainList;
 718:   
 719:                      return migrationDomainList;
 720:                  }
 721:              }
 722:          }
 723:   
 724:          ////////////////////////////////////////////////////////////////////////////
 725:   
 726:          /// <summary>
 727:          ///
 728:          /// </summary>
 729:          private static List<int> _MigrationDomainList
 730:          {
 731:              get
 732:              {
 733:                  var pstnDomainList = Ia.Ngn.Cl.Model.Data.Service.PstnDomainList;
 734:                  var domainList = Ia.Ngn.Cl.Model.Data.Service.DomainList;
 735:   
 736:                  var list = domainList.Intersect(pstnDomainList);
 737:   
 738:                  return pstnDomainList;
 739:              }
 740:          }
 741:   
 742:          ////////////////////////////////////////////////////////////////////////////
 743:   
 744:          /// <summary>
 745:          ///
 746:          /// </summary>
 747:          public static List<int> NokiaSwitchDomainList
 748:          {
 749:              get
 750:              {
 751:                  lock (objectLock)
 752:                  {
 753:                      if (nokiaSwitchDomainList == null || nokiaSwitchDomainList.Count == 0) nokiaSwitchDomainList = Ia.Ngn.Cl.Model.Data.Service._NokiaSwitchDomainList;
 754:   
 755:                      return nokiaSwitchDomainList;
 756:                  }
 757:              }
 758:          }
 759:   
 760:          ////////////////////////////////////////////////////////////////////////////
 761:   
 762:          /// <summary>
 763:          ///
 764:          /// </summary>
 765:          private static List<int> _NokiaSwitchDomainList
 766:          {
 767:              get
 768:              {
 769:                  Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor;
 770:   
 771:                  vendor = (from v in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.VendorList
 772:                            where v == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
 773:                            select v).Single();
 774:   
 775:                  return DomainListWithinSwitchVendor(vendor);
 776:              }
 777:          }
 778:   
 779:          ////////////////////////////////////////////////////////////////////////////
 780:   
 781:          /// <summary>
 782:          ///
 783:          /// </summary>
 784:          public static List<int> HuaweiSwitchDomainList
 785:          {
 786:              get
 787:              {
 788:                  lock (objectLock)
 789:                  {
 790:                      if (huaweiSwitchDomainList == null || huaweiSwitchDomainList.Count == 0) huaweiSwitchDomainList = Ia.Ngn.Cl.Model.Data.Service._HuaweiSwitchDomainList;
 791:   
 792:                      return huaweiSwitchDomainList;
 793:                  }
 794:              }
 795:          }
 796:   
 797:          ////////////////////////////////////////////////////////////////////////////
 798:   
 799:          /// <summary>
 800:          ///
 801:          /// </summary>
 802:          private static List<int> _HuaweiSwitchDomainList
 803:          {
 804:              get
 805:              {
 806:                  Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor;
 807:   
 808:                  vendor = (from v in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.VendorList
 809:                            where v == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
 810:                            select v).Single();
 811:   
 812:                  return Ia.Ngn.Cl.Model.Data.Service.DomainListWithinSwitchVendor(vendor);
 813:              }
 814:          }
 815:   
 816:          ////////////////////////////////////////////////////////////////////////////
 817:   
 818:          /// <summary>
 819:          ///
 820:          /// </summary>
 821:          private static List<int> DomainListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor)
 822:          {
 823:              List<int> list;
 824:   
 825:              list = (from d in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
 826:                      where d.Vendor == vendor
 827:                      select d).SelectMany(r => r.DomainList).ToList();
 828:   
 829:              list.Sort();
 830:   
 831:              return list;
 832:          }
 833:   
 834:          ////////////////////////////////////////////////////////////////////////////
 835:   
 836:          /// <summary>
 837:          ///
 838:          /// 
 839:          /// </summary>
 840:          private static List<int> DomainListWithinAccessVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor)
 841:          {
 842:              List<int> list;
 843:   
 844:              list = (from d in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OdfList
 845:                      where d.Vendor == vendor
 846:                      select d.Router).SelectMany(r => r.DomainList).ToList();
 847:   
 848:              list.Sort();
 849:   
 850:              return list;
 851:          }
 852:   
 853:          ////////////////////////////////////////////////////////////////////////////
 854:   
 855:          /// <summary>
 856:          ///
 857:          /// </summary>
 858:          public static List<int> AllPossibleServiceNumberList
 859:          {
 860:              get
 861:              {
 862:                  int n, length;
 863:                  string s;
 864:                  List<int> list;
 865:   
 866:                  list = new List<int>(10000 * Ia.Ngn.Cl.Model.Data.Service.DomainList.Count);
 867:   
 868:                  foreach (int d in Ia.Ngn.Cl.Model.Data.Service.DomainList)
 869:                  {
 870:                      s = d.ToString();
 871:   
 872:                      length = s.Length;
 873:   
 874:                      if (length == 4)
 875:                      {
 876:                          for (int i = 0; i < 10000; i++)
 877:                          {
 878:                              n = d * 10000 + i;
 879:   
 880:                              list.Add(n);
 881:                          }
 882:                      }
 883:                      else if (length == 5)
 884:                      {
 885:                          for (int p = 0; p < 1000; p++)
 886:                          {
 887:                              n = d * 1000 + p;
 888:   
 889:                              list.Add(n);
 890:                          }
 891:                      }
 892:                      else
 893:                      {
 894:                          throw new Exception("length " + length + " is unknown");
 895:                      }
 896:                  }
 897:   
 898:                  return list;
 899:              }
 900:          }
 901:   
 902:          ////////////////////////////////////////////////////////////////////////////
 903:   
 904:          /// <summary>
 905:          ///
 906:          /// </summary>
 907:          public static List<int> AllPossiblePstnServiceNumberList
 908:          {
 909:              get
 910:              {
 911:                  int n, length;
 912:                  string s;
 913:                  List<int> list;
 914:   
 915:                  list = new List<int>(10000 * Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Count);
 916:   
 917:                  foreach (int d in Ia.Ngn.Cl.Model.Data.Service.PstnDomainList)
 918:                  {
 919:                      s = d.ToString();
 920:   
 921:                      length = s.Length;
 922:   
 923:                      if (length == 4)
 924:                      {
 925:                          for (int i = 0; i < 10000; i++)
 926:                          {
 927:                              n = d * 10000 + i;
 928:   
 929:                              list.Add(n);
 930:                          }
 931:                      }
 932:                      else if (length == 5)
 933:                      {
 934:                          for (int p = 0; p < 1000; p++)
 935:                          {
 936:                              n = d * 1000 + p;
 937:   
 938:                              list.Add(n);
 939:                          }
 940:                      }
 941:                      else
 942:                      {
 943:                          throw new Exception("length " + length + " is unknown");
 944:                      }
 945:                  }
 946:   
 947:                  return list;
 948:              }
 949:          }
 950:   
 951:          ////////////////////////////////////////////////////////////////////////////
 952:   
 953:          /// <summary>
 954:          ///
 955:          /// </summary>
 956:          public static List<int> AllPossibleServiceNumberListWithinDomain(int domain)
 957:          {
 958:              int n, length;
 959:              string s;
 960:              List<int> list;
 961:   
 962:              s = domain.ToString();
 963:   
 964:              length = s.Length;
 965:   
 966:              list = new List<int>(10000);
 967:   
 968:              if (length == 4)
 969:              {
 970:                  for (int i = 0; i < 10000; i++)
 971:                  {
 972:                      n = domain * 10000 + i;
 973:   
 974:                      list.Add(n);
 975:                  }
 976:              }
 977:              else if (length == 5)
 978:              {
 979:                  for (int p = 0; p < 1000; p++)
 980:                  {
 981:                      n = domain * 1000 + p;
 982:   
 983:                      list.Add(n);
 984:                  }
 985:              }
 986:              else
 987:              {
 988:                  throw new Exception("length " + length + " is unknown");
 989:              }
 990:   
 991:              return list;
 992:          }
 993:   
 994:          ////////////////////////////////////////////////////////////////////////////
 995:   
 996:          /// <summary>
 997:          ///
 998:          /// </summary>
 999:          public static int NumberOfPossibleServicesWithinDomainList(List<int> domainList)
1000:          {
1001:              int n, length;
1002:   
1003:              n = 0;
1004:   
1005:              foreach (int domain in domainList)
1006:              {
1007:                  length = domain.ToString().Length;
1008:   
1009:                  if (length == 4) n += 10000;
1010:                  else if (length == 5) n += 1000;
1011:                  else
1012:                  {
1013:                      throw new Exception("length " + length + " is unknown");
1014:                  }
1015:              }
1016:   
1017:              return n;
1018:          }
1019:   
1020:          ////////////////////////////////////////////////////////////////////////////
1021:   
1022:          /// <summary>
1023:          ///
1024:          /// </summary>
1025:          public static List<int> AllPossibleServiceNumberListWithinNokiaSwitch
1026:          {
1027:              get
1028:              {
1029:                  Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor nokia;
1030:                  List<int> list;
1031:   
1032:                  nokia = (from v in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.VendorList
1033:                           where v == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
1034:                           select v).Single();
1035:   
1036:                  list = AllPossibleServiceNumberListWithinSwitchVendor(nokia);
1037:   
1038:                  return list;
1039:              }
1040:          }
1041:   
1042:          ////////////////////////////////////////////////////////////////////////////
1043:   
1044:          /// <summary>
1045:          ///
1046:          /// </summary>
1047:          public static List<int> AllPossibleServiceNumberListWithinHuaweiSwitch
1048:          {
1049:              get
1050:              {
1051:                  Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor huawei;
1052:                  List<int> list;
1053:   
1054:                  huawei = (from v in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.VendorList
1055:                            where v == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
1056:                            select v).Single();
1057:   
1058:                  list = AllPossibleServiceNumberListWithinSwitchVendor(huawei);
1059:   
1060:                  return list;
1061:              }
1062:          }
1063:   
1064:          ////////////////////////////////////////////////////////////////////////////
1065:   
1066:          /// <summary>
1067:          ///
1068:          /// </summary>
1069:          private static List<int> AllPossibleServiceNumberListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor)
1070:          {
1071:              int n, length;
1072:              string s;
1073:              List<int> list;
1074:              List<int> domainListWithinSwitchVendor;
1075:   
1076:              domainListWithinSwitchVendor = Ia.Ngn.Cl.Model.Data.Service.DomainListWithinSwitchVendor(vendor);
1077:   
1078:              list = new List<int>(10000 * domainListWithinSwitchVendor.Count);
1079:   
1080:              foreach (int domain in domainListWithinSwitchVendor)
1081:              {
1082:                  s = domain.ToString();
1083:   
1084:                  length = s.Length;
1085:   
1086:                  if (length == 4)
1087:                  {
1088:                      for (int i = 0; i < 10000; i++)
1089:                      {
1090:                          n = domain * 10000 + i;
1091:   
1092:                          list.Add(n);
1093:                      }
1094:                  }
1095:                  else if (length == 5)
1096:                  {
1097:                      for (int p = 0; p < 1000; p++)
1098:                      {
1099:                          n = domain * 1000 + p;
1100:   
1101:                          list.Add(n);
1102:                      }
1103:                  }
1104:                  else
1105:                  {
1106:                      throw new Exception("length " + length + " is unknown");
1107:                  }
1108:              }
1109:   
1110:              return list;
1111:          }
1112:   
1113:          ////////////////////////////////////////////////////////////////////////////    
1114:          ////////////////////////////////////////////////////////////////////////////
1115:   
1116:          /// <summary>
1117:          ///
1118:          /// </summary>
1119:          public static List<int> AllPossibleServiceNumberWithinAHuaweiSwitchRouterThatHasANokiaGponOlt()
1120:          {
1121:              int n, length;
1122:              string s;
1123:              List<int> list;
1124:              List<int> domainList;
1125:   
1126:              var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.HuaweiSwitchNokiaGponOltIdList;
1127:   
1128:              domainList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
1129:                            where oltIdList.Contains(o.Id)
1130:                            select o.Odf.Router).SelectMany(r => r.DomainList).Distinct().ToList();
1131:   
1132:              list = new List<int>(10000 * domainList.Count);
1133:   
1134:              foreach (int domain in domainList)
1135:              {
1136:                  s = domain.ToString();
1137:   
1138:                  length = s.Length;
1139:   
1140:                  if (length == 4)
1141:                  {
1142:                      for (int i = 0; i < 10000; i++)
1143:                      {
1144:                          n = domain * 10000 + i;
1145:   
1146:                          list.Add(n);
1147:                      }
1148:                  }
1149:                  else if (length == 5)
1150:                  {
1151:                      for (int p = 0; p < 1000; p++)
1152:                      {
1153:                          n = domain * 1000 + p;
1154:   
1155:                          list.Add(n);
1156:                      }
1157:                  }
1158:                  else
1159:                  {
1160:                      throw new Exception("length " + length + " is unknown");
1161:                  }
1162:              }
1163:   
1164:              list.Sort();
1165:   
1166:              return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
1167:   
1168:          }
1169:   
1170:          ////////////////////////////////////////////////////////////////////////////
1171:   
1172:          /// <summary>
1173:          ///
1174:          /// </summary>
1175:          public static List<int> AllPossibleServiceNumberWithinSite(string siteName)
1176:          {
1177:              int n, length;
1178:              string s;
1179:              List<int> list;
1180:              List<int> domainList;
1181:   
1182:              domainList = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
1183:                            where r.Site.Name == siteName
1184:                            select r).SelectMany(r => r.DomainList).ToList();
1185:   
1186:              list = new List<int>(10000 * domainList.Count);
1187:   
1188:              foreach (int domain in domainList)
1189:              {
1190:                  s = domain.ToString();
1191:   
1192:                  length = s.Length;
1193:   
1194:                  if (length == 4)
1195:                  {
1196:                      for (int i = 0; i < 10000; i++)
1197:                      {
1198:                          n = domain * 10000 + i;
1199:   
1200:                          list.Add(n);
1201:                      }
1202:                  }
1203:                  else if (length == 5)
1204:                  {
1205:                      for (int p = 0; p < 1000; p++)
1206:                      {
1207:                          n = domain * 1000 + p;
1208:   
1209:                          list.Add(n);
1210:                      }
1211:                  }
1212:                  else
1213:                  {
1214:                      throw new Exception("length " + length + " is unknown");
1215:                  }
1216:              }
1217:   
1218:              list.Sort();
1219:   
1220:              return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
1221:          }
1222:   
1223:          ////////////////////////////////////////////////////////////////////////////
1224:   
1225:          /// <summary>
1226:          ///
1227:          /// </summary>
1228:          public static List<int> AllPossibleServiceNumbersWithinPstn(string pstnName)
1229:          {
1230:              int n, length;
1231:              string s;
1232:              List<int> list;
1233:              List<int> domainList;
1234:   
1235:              domainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
1236:                            where p.Name == pstnName
1237:                            select p).SelectMany(r => r.DomainList).ToList();
1238:   
1239:              list = new List<int>(10000 * domainList.Count);
1240:   
1241:              foreach (int domain in domainList)
1242:              {
1243:                  s = domain.ToString();
1244:   
1245:                  length = s.Length;
1246:   
1247:                  if (length == 4)
1248:                  {
1249:                      for (int i = 0; i < 10000; i++)
1250:                      {
1251:                          n = domain * 10000 + i;
1252:   
1253:                          list.Add(n);
1254:                      }
1255:                  }
1256:                  else if (length == 5)
1257:                  {
1258:                      for (int p = 0; p < 1000; p++)
1259:                      {
1260:                          n = domain * 1000 + p;
1261:   
1262:                          list.Add(n);
1263:                      }
1264:                  }
1265:                  else
1266:                  {
1267:                      throw new Exception("length " + length + " is unknown");
1268:                  }
1269:              }
1270:   
1271:              list.Sort();
1272:   
1273:              return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
1274:          }
1275:   
1276:          ////////////////////////////////////////////////////////////////////////////
1277:   
1278:          /// <summary>
1279:          ///
1280:          /// </summary>
1281:          public static List<string> SiteDomainList(string siteName)
1282:          {
1283:              List<int> list;
1284:              List<string> sList;
1285:   
1286:              list = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
1287:                      where r.Site.Name == siteName
1288:                      select r).SelectMany(r => r.DomainList).ToList();
1289:   
1290:              list.Sort();
1291:   
1292:              sList = (from n in list select n.ToString()).ToList<string>();
1293:   
1294:              return sList;
1295:          }
1296:   
1297:          ////////////////////////////////////////////////////////////////////////////
1298:   
1299:          /// <summary>
1300:          ///
1301:          /// </summary>
1302:          public static List<string> SitePstnDomainList(string siteName)
1303:          {
1304:              List<int> list;
1305:              List<string> sList;
1306:   
1307:              list = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
1308:                      where r.Site.Name == siteName
1309:                      select r).SelectMany(r => r.DomainList).ToList();
1310:   
1311:              list.Sort();
1312:   
1313:              sList = (from n in list select n.ToString()).ToList<string>();
1314:   
1315:              return sList;
1316:          }
1317:   
1318:          ////////////////////////////////////////////////////////////////////////////
1319:   
1320:          /// <summary>
1321:          ///
1322:          /// </summary>
1323:          public static bool ServiceListIsWithinSitePstnDomainList(string siteName, List<string> serviceList)
1324:          {
1325:              bool b;
1326:   
1327:              b = Ia.Ngn.Cl.Model.Data.Service.SitePstnDomainList(siteName).Any(u => serviceList.Any(v => v.StartsWith(u)));
1328:   
1329:              return b;
1330:          }
1331:   
1332:          ////////////////////////////////////////////////////////////////////////////
1333:   
1334:          /// <summary>
1335:          ///
1336:          /// </summary>
1337:          public static bool ServiceIsWithinPstnDomainList(string service)
1338:          {
1339:              bool b;
1340:   
1341:              b = Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Any(u => service.StartsWith(u.ToString()));
1342:   
1343:              return b;
1344:          }
1345:   
1346:          ////////////////////////////////////////////////////////////////////////////
1347:   
1348:          /// <summary>
1349:          ///
1350:          /// </summary>
1351:          public static bool ServiceListHasANumberThatIsWithinPstnDomainList(List<string> serviceList)
1352:          {
1353:              bool b;
1354:   
1355:              b = Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Any(u => serviceList.Any(v => v.StartsWith(u.ToString())));
1356:   
1357:              return b;
1358:          }
1359:   
1360:          ////////////////////////////////////////////////////////////////////////////
1361:   
1362:          /// <summary>
1363:          ///
1364:          /// </summary>
1365:          public static bool ServiceListHasANumberThatIsWithinAxePstnDomainList(List<string> serviceList)
1366:          {
1367:              bool b;
1368:   
1369:              b = Ia.Ngn.Cl.Model.Data.Service.AxePstnDomainList.Any(u => serviceList.Any(v => v.StartsWith(u.ToString())));
1370:   
1371:              return b;
1372:          }
1373:   
1374:          ////////////////////////////////////////////////////////////////////////////
1375:   
1376:          /// <summary>
1377:          ///
1378:          /// </summary>
1379:          public static bool ServiceListHasANumberThatIsWithinEwsdPstnDomainList(List<string> serviceList)
1380:          {
1381:              bool b;
1382:   
1383:              b = Ia.Ngn.Cl.Model.Data.Service.EwsdPstnDomainList.Any(u => serviceList.Any(v => v.StartsWith(u.ToString())));
1384:   
1385:              return b;
1386:          }
1387:   
1388:          ////////////////////////////////////////////////////////////////////////////    
1389:          ////////////////////////////////////////////////////////////////////////////    
1390:   
1391:          /// <summary>
1392:          ///
1393:          /// </summary>
1394:          public static List<string> ActiveServiceRequestServiceNumbersWithinDomainList(string domain)
1395:          {
1396:              List<string> list;
1397:   
1398:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1399:              {
1400:                  list = (from srs in db.ServiceRequestServices
1401:                          where /*srs.ServiceType == 1 &&*/ srs.Service.StartsWith(domain) && srs.Provisioned == true
1402:                          select srs.Service).ToList();
1403:              }
1404:   
1405:              return list;
1406:          }
1407:   
1408:          ////////////////////////////////////////////////////////////////////////////    
1409:   
1410:          /// <summary>
1411:          ///
1412:          /// </summary>
1413:          public static List<string> ActiveServiceNumbersWithinDomainList(string domain)
1414:          {
1415:              int serviceType;
1416:              List<string> list;
1417:   
1418:              serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService;
1419:   
1420:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1421:              {
1422:                  list = (from s in db.Service2
1423:                          where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && s.ServiceType == serviceType && s.Service.StartsWith(domain)
1424:                          select s.Service).ToList();
1425:              }
1426:   
1427:              return list;
1428:          }
1429:   
1430:          ////////////////////////////////////////////////////////////////////////////
1431:   
1432:          /// <summary>
1433:          ///
1434:          /// </summary>
1435:          public static List<string> InactiveServiceRequestServiceNumbersWithinDomainList(string domain)
1436:          {
1437:              List<int> possibleServiceList;
1438:              List<string> serviceList, inactiveServiceList;
1439:   
1440:              serviceList = ActiveServiceRequestServiceNumbersWithinDomainList(domain);
1441:   
1442:              possibleServiceList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinDomain(int.Parse(domain));
1443:   
1444:              inactiveServiceList = new List<string>(possibleServiceList.Count - serviceList.Count);
1445:   
1446:              // below: extract numbers within possible but not in serviceList
1447:              foreach (int i in possibleServiceList)
1448:              {
1449:                  if (!serviceList.Contains(i.ToString())) inactiveServiceList.Add(i.ToString());
1450:              }
1451:   
1452:              return inactiveServiceList;
1453:          }
1454:   
1455:          ////////////////////////////////////////////////////////////////////////////
1456:   
1457:          /// <summary>
1458:          ///
1459:          /// </summary>
1460:          public static List<string> InactiveServiceNumbersWithinDomainList(string domain)
1461:          {
1462:              List<int> possibleServiceList;
1463:              List<string> serviceList, inactiveServiceList;
1464:   
1465:              serviceList = ActiveServiceNumbersWithinDomainList(domain);
1466:   
1467:              possibleServiceList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinDomain(int.Parse(domain));
1468:   
1469:              inactiveServiceList = new List<string>(possibleServiceList.Count - serviceList.Count);
1470:   
1471:              // below: extract numbers within possible but not in serviceList
1472:              foreach (int i in possibleServiceList)
1473:              {
1474:                  if (!serviceList.Contains(i.ToString())) inactiveServiceList.Add(i.ToString());
1475:              }
1476:   
1477:              return inactiveServiceList;
1478:          }
1479:   
1480:          ////////////////////////////////////////////////////////////////////////////
1481:   
1482:          /// <summary>
1483:          ///
1484:          /// </summary>
1485:          public static List<string> ServicePbxList
1486:          {
1487:              get
1488:              {
1489:                  List<string> list, nokiaPbxList, huaweiPbxList;
1490:   
1491:                  nokiaPbxList = Ia.Ngn.Cl.Model.Data.Nokia.SubParty.ServicePbxList();
1492:                  huaweiPbxList = Ia.Ngn.Cl.Model.Data.Huawei.HuSbr.ServicePbxList();
1493:   
1494:                  list = nokiaPbxList.Concat(huaweiPbxList).ToList();
1495:   
1496:                  return list;
1497:              }
1498:          }
1499:   
1500:          ////////////////////////////////////////////////////////////////////////////
1501:          ////////////////////////////////////////////////////////////////////////////
1502:   
1503:          /// <summary>
1504:          ///
1505:          /// </summary>
1506:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeProvisionedOltList
1507:          {
1508:              get
1509:              {
1510:                  return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldOltList.Union(AllowedToBeMigratedOltList).ToList();
1511:              }
1512:          }
1513:   
1514:          ////////////////////////////////////////////////////////////////////////////
1515:   
1516:          /// <summary>
1517:          ///
1518:          /// </summary>
1519:          public static List<int> AllowedToBeProvisionedOltIdList
1520:          {
1521:              get
1522:              {
1523:                  return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldOltIdList.Union(AllowedToBeMigratedOltIdList).ToList();
1524:              }
1525:          }
1526:   
1527:          ////////////////////////////////////////////////////////////////////////////
1528:   
1529:          /// <summary>
1530:          ///
1531:          /// </summary>
1532:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeProvisionedSipOltList
1533:          {
1534:              get
1535:              {
1536:                  return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldSipOltList.Union(AllowedToBeMigratedSipOltList).ToList();
1537:              }
1538:          }
1539:   
1540:          ////////////////////////////////////////////////////////////////////////////
1541:   
1542:          /// <summary>
1543:          ///
1544:          /// </summary>
1545:          public static List<int> AllowedToBeProvisionedSipOltIdList
1546:          {
1547:              get
1548:              {
1549:                  return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldSipOltIdList.Union(AllowedToBeMigratedSipOltIdList).ToList();
1550:              }
1551:          }
1552:   
1553:          ////////////////////////////////////////////////////////////////////////////
1554:          ////////////////////////////////////////////////////////////////////////////
1555:   
1556:          /// <summary>
1557:          ///
1558:          /// </summary>
1559:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeMigratedOltList
1560:          {
1561:              get
1562:              {
1563:                  return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
1564:                          where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u))
1565:                          select o).ToList();
1566:              }
1567:          }
1568:   
1569:          ////////////////////////////////////////////////////////////////////////////
1570:   
1571:          /// <summary>
1572:          ///
1573:          /// </summary>
1574:          public static List<int> AllowedToBeMigratedOltIdList
1575:          {
1576:              get
1577:              {
1578:                  return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
1579:                          where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u))
1580:                          select o.Id).ToList();
1581:              }
1582:          }
1583:   
1584:          ////////////////////////////////////////////////////////////////////////////
1585:   
1586:          /// <summary>
1587:          ///
1588:          /// </summary>
1589:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeMigratedSipOltList
1590:          {
1591:              get
1592:              {
1593:                  return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
1594:                          where o.IsSip == true && (Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u)))
1595:                          select o).ToList();
1596:              }
1597:          }
1598:   
1599:          ////////////////////////////////////////////////////////////////////////////
1600:   
1601:          /// <summary>
1602:          ///
1603:          /// </summary>
1604:          public static List<int> AllowedToBeMigratedSipOltIdList
1605:          {
1606:              get
1607:              {
1608:                  return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
1609:                          where o.IsSip == true && (Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u)))
1610:                          select o.Id).ToList();
1611:              }
1612:          }
1613:   
1614:          ////////////////////////////////////////////////////////////////////////////
1615:   
1616:          /// <summary>
1617:          ///
1618:          /// </summary>
1619:          public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> AllowedToBeMigratedAccessIdToOntDictionary
1620:          {
1621:              get
1622:              {
1623:                  Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> dictionary;
1624:   
1625:                  var list = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList
1626:                              where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Pon.PonGroup.Olt.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Pon.PonGroup.Symbol)
1627:                              select o).ToList();
1628:   
1629:                  dictionary = list.ToDictionary(u => u.Access.Id, u => u);
1630:   
1631:                  return dictionary;
1632:              }
1633:          }
1634:   
1635:          ////////////////////////////////////////////////////////////////////////////
1636:   
1637:          /// <summary>
1638:          ///
1639:          /// </summary>
1640:          public static List<string> ServiceNotInServiceRequestServiceList()
1641:          {
1642:              string s;
1643:              List<string> list;
1644:   
1645:              var allPossibleServiceNumberList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberList;
1646:   
1647:              var serviceRequestServiceServiceDictionary = Ia.Ngn.Cl.Model.Data.ServiceRequestService.ServiceDictionary();
1648:   
1649:              list = new List<string>(allPossibleServiceNumberList.Count);
1650:   
1651:              foreach (var i in allPossibleServiceNumberList)
1652:              {
1653:                  s = i.ToString();
1654:   
1655:                  if (!serviceRequestServiceServiceDictionary.ContainsKey(s))
1656:                  {
1657:                      /*if (i > Ia.Ngn.Cl.Model.Business.Service.TemporaryProcedureToIndicateWhereTheLastReadNumberFromOracleDatabaseBecauseListIsTooLongToRepeatHahaha)*/
1658:                      list.Add(s);
1659:                  }
1660:              }
1661:   
1662:              return list.OrderBy(u => u).ToList();
1663:          }
1664:   
1665:          ////////////////////////////////////////////////////////////////////////////    
1666:   
1667:          /// <summary>
1668:          ///
1669:          /// </summary>
1670:          public static string SequentialAllPossibleServiceNumberList(ref int referenceIndex, out int itemIndex, out int listCount)
1671:          {
1672:              int service;
1673:   
1674:              if (serviceList.JustStartedOrRolledOver())
1675:              {
1676:                  serviceList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberList;
1677:              }
1678:   
1679:              service = serviceList.Next(ref referenceIndex, out itemIndex, out listCount);
1680:   
1681:              return service.ToString();
1682:          }
1683:   
1684:          ////////////////////////////////////////////////////////////////////////////
1685:          ////////////////////////////////////////////////////////////////////////////
1686:   
1687:          /// <summary>
1688:          ///
1689:          /// </summary>
1690:          public static Ia.Ngn.Cl.Model.Business.Service.ServiceType ServiceType(int typeId)
1691:          {
1692:              return (from s in Ia.Ngn.Cl.Model.Data.Service.ServiceTypeList where s.Id == typeId select s).SingleOrDefault();
1693:          }
1694:   
1695:          ////////////////////////////////////////////////////////////////////////////
1696:   
1697:          /// <summary>
1698:          ///
1699:          /// </summary>
1700:          public static string ServiceTypeNameFromId(int id)
1701:          {
1702:              return (from s in Ia.Ngn.Cl.Model.Data.Service.ServiceTypeList where s.Id == id select s.Name).SingleOrDefault();
1703:          }
1704:   
1705:          ////////////////////////////////////////////////////////////////////////////
1706:   
1707:          /// <summary>
1708:          ///
1709:          /// </summary>
1710:          public static List<Ia.Ngn.Cl.Model.Business.Service.ServiceType> ServiceTypeList
1711:          {
1712:              get
1713:              {
1714:                  if (serviceTypeList == null || serviceTypeList.Count == 0)
1715:                  {
1716:                      serviceTypeList = new List<Ia.Ngn.Cl.Model.Business.Service.ServiceType>();
1717:   
1718:                      serviceTypeList = new List<Ia.Ngn.Cl.Model.Business.Service.ServiceType>
1719:                      {
1720:                          // DO NOT CHANGE "Ngn" and "Pstn" values, they will effect class ServiceType values
1721:                          new Ia.Ngn.Cl.Model.Business.Service.ServiceType(0, "Undefined", "Undefined (غير معرف)", "red"),
1722:                          new Ia.Ngn.Cl.Model.Business.Service.ServiceType(1, "Ngn", "Fiber (فايبر)", "fiber-blue"),
1723:                          new Ia.Ngn.Cl.Model.Business.Service.ServiceType(2, "Pstn", "Copper (نحاس)", "copper-brown")
1724:                      };
1725:   
1726:                      /*
1727:  
1728:                      /// 0:IMSSIPUE(IMSSIPUSER): The subscriber is an IMS SIP-UE subscriber.
1729:                      /// 1:POTS(POTSUSER): The subscriber is a SIP subscriber connected to the SIPIAD of the AGCF.
1730:                      /// 4:G/U(GUUSER): The subscriber is a G/U subscriber.
1731:                      /// 5:CDMA(CDMAUSER): The subscriber is a CDMA subscriber.
1732:                      /// 6:PSTN(PSTNUSER): The subscriber is a PSTN subscriber.
1733:  
1734:                      <type id="0" name="?"/>
1735:                      <type id="1" name="DN" Idlike="25212254:1:965"/>
1736:                      <type id="2" name="HSI" Idlike="SLA.82.13.1.2:2:965 SLA.PON.ONT.CARD.PORT"/>
1737:                      <type id="3" name="CDMA"/>
1738:                      <type id="4" name="G/U"/>
1739:                      <type id="5" name="POTS"/>
1740:                      <type id="6" name="PSTN"/>
1741:                       */
1742:                  }
1743:   
1744:                  return serviceTypeList.ToList();
1745:              }
1746:          }
1747:   
1748:          ////////////////////////////////////////////////////////////////////////////
1749:   
1750:          /// <summary>
1751:          /// 
1752:          /// How to embed and access resources by using Visual C# http://support.microsoft.com/kb/319292/en-us
1753:          /// 
1754:          /// 1. Change the "Build Action" property of your XML file from "Content" to "Embedded Resource".
1755:          /// 2. Add "using System.Reflection".
1756:          /// 3. See sample below.
1757:          /// 
1758:          /// </summary>
1759:   
1760:          private static XDocument XDocument
1761:          {
1762:              get
1763:              {
1764:                  if (xDocument == null)
1765:                  {
1766:                      Assembly _assembly;
1767:                      StreamReader streamReader;
1768:   
1769:                      _assembly = Assembly.GetExecutingAssembly();
1770:                      streamReader = new StreamReader(_assembly.GetManifestResourceStream("Ia.Ngn.Cl.model.data.service.xml"));
1771:   
1772:                      try
1773:                      {
1774:                          if (streamReader.Peek() != -1)
1775:                          {
1776:                              xDocument = System.Xml.Linq.XDocument.Load(streamReader);
1777:                          }
1778:                      }
1779:                      catch (Exception)
1780:                      {
1781:                      }
1782:                      finally
1783:                      {
1784:                      }
1785:                  }
1786:   
1787:                  return xDocument;
1788:              }
1789:          }
1790:   
1791:          ////////////////////////////////////////////////////////////////////////////    
1792:          ////////////////////////////////////////////////////////////////////////////
1793:      }
1794:   
1795:      ////////////////////////////////////////////////////////////////////////////
1796:      ////////////////////////////////////////////////////////////////////////////   
1797:  }