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

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