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

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 of Next Generation Network'a (NGN's) business model.

   1:  using System.Data;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Business
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Service support class of Next Generation Network'a (NGN's) business model.
  11:      /// </summary>
  12:      /// 
  13:      /// <remarks> 
  14:      /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  15:      ///
  16:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  17:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  18:      ///
  19:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  20:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  21:      /// 
  22:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  23:      /// 
  24:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  25:      /// </remarks> 
  26:      public partial class Service
  27:      {
  28:          /// <summary/>
  29:          public enum SupplementaryService
  30:          {
  31:              CallerId = 1, InternationalCalling, InternationalCallingUserControlled, CallForwarding, CallWaiting, ConferenceCall, WakeupCall, AbbriviatedCalling, ServiceSuspension
  32:          };
  33:   
  34:          ////////////////////////////////////////////////////////////////////////////
  35:   
  36:          /// <summary>
  37:          ///
  38:          /// </summary>
  39:          public static int CountryCode { get { return 965; } }
  40:   
  41:          ////////////////////////////////////////////////////////////////////////////
  42:   
  43:          /// <summary>
  44:          ///
  45:          /// </summary>
  46:          public Service() { }
  47:   
  48:          ////////////////////////////////////////////////////////////////////////////
  49:   
  50:          /// <summary>
  51:          ///
  52:          /// </summary>
  53:          public static string ServiceName(string service, int serviceType)
  54:          {
  55:              string name;
  56:   
  57:              name = service;
  58:   
  59:              if (name == "0") name = "";
  60:   
  61:              return name;
  62:          }
  63:   
  64:          ////////////////////////////////////////////////////////////////////////////
  65:   
  66:          /// <summary>
  67:          ///
  68:          /// </summary>
  69:          public static string ServiceIdToService(string serviceId)
  70:          {
  71:              string service;
  72:   
  73:              service = serviceId.Substring(0, serviceId.IndexOf(":"));
  74:   
  75:              return service;
  76:          }
  77:   
  78:          ////////////////////////////////////////////////////////////////////////////
  79:   
  80:          /// <summary>
  81:          ///
  82:          /// </summary>
  83:          public static string ServiceToServiceId(string service, int serviceType)
  84:          {
  85:              string serviceId;
  86:   
  87:              serviceId = service + ":" + serviceType + ":" + Ia.Ngn.Cl.Model.Business.Service.CountryCode;
  88:   
  89:              return serviceId;
  90:          }
  91:   
  92:          ////////////////////////////////////////////////////////////////////////////
  93:   
  94:          /// <summary>
  95:          ///
  96:          /// </summary>
  97:          public static int ServiceIdToServiceType(string serviceId)
  98:          {
  99:              int serviceType;
 100:   
 101:              serviceType = int.Parse(serviceId.Substring(serviceId.IndexOf(":") + 1, 1));
 102:   
 103:              return serviceType;
 104:          }
 105:   
 106:          /*
 107:          ////////////////////////////////////////////////////////////////////////////
 108:  
 109:          /// <summary>
 110:          /// List of domains allowed to be created
 111:          /// </summary>
 112:          public static List<string> AllowedDomainsToBeCreatedList
 113:          {
 114:              get
 115:              {
 116:                  return new List<string>() {
 117:                  "2521", "2522", "2523", "2524",
 118:                  "2490", "2466",
 119:                  "2453", "2454",
 120:                  "2497", "2460",
 121:                  "2435", "2436", "2438",
 122:                  "2363", "2374",
 123:                  //"2481", "2482", "2483", "2484",
 124:                  //"2541", "2542", "2543", "2544", "2545",
 125:                  //"2551", "2552",
 126:                  //"2480",
 127:                  "2455", "2456", "2457", "2458",
 128:                  "2361",
 129:                  "2391","2392",
 130:                  "2371","2372","2373",
 131:                  "2467",
 132:                  "2390",
 133:  "2368",
 134:  "2367",
 135:  "2549",
 136:  "25485","25486","25487","25488","25489",
 137:  "2360","2365","2366",
 138:  "2375",
 139:  "2465",
 140:  "2460","2469",
 141:  "25480","25481","25482","25483",
 142:  "24780","24781","24782"
 143:                  };
 144:              }
 145:          }
 146:  
 147:          ////////////////////////////////////////////////////////////////////////////
 148:  
 149:          /// <summary>
 150:          /// List of domains allowed to be updated
 151:          /// </summary>
 152:          public static List<string> AllowedDomainsToBeUpdatedList
 153:          {
 154:              get
 155:              {
 156:                  return new List<string>() {
 157:                      "2521", "2522", "2523", "2524",
 158:                      "2490", "2466",
 159:                      "2453", "2454",
 160:                      "2497", "2460",
 161:                      "2435", "2436", "2438",
 162:                      "2363", "2374",
 163:  "2368",
 164:  "2367",
 165:  "2549",
 166:  "25485","25486","25487","25488","25489",
 167:  "2360","2365","2366",
 168:  "2375",
 169:  "2465",
 170:  "2460","2469",
 171:  "25480","25481","25482","25483",
 172:  "24780","24781","24782"
 173:                  };
 174:              }
 175:          }
 176:  
 177:          ////////////////////////////////////////////////////////////////////////////
 178:  
 179:          /// <summary>
 180:          /// List of domains allowed to be deleted
 181:          /// </summary>
 182:          public static List<string> AllowedDomainsToBeDeletedList
 183:          {
 184:              get
 185:              {
 186:                  return new List<string>() {
 187:                      "2521", "2522", "2523", "2524",
 188:                      "2490", "2466",
 189:                      "2453", "2454",
 190:                      "2497", "2460",
 191:                      "2435", "2436", "2438",
 192:                      "2363", "2374",
 193:                      //"2481", "2482", "2483", "2484",
 194:                      //"2541", "2542", "2543", "2544", "2545",
 195:                      //"2551", "2552",
 196:                      //"2480",
 197:                      "2455", "2456", "2457", "2458",
 198:                      "2361",
 199:                      "2391","2392",
 200:                      "2371","2372","2373",
 201:                      "2467",
 202:                      "2390",
 203:  "2368",
 204:  "2367",
 205:  "2549",
 206:  "25485","25486","25487","25488","25489",
 207:  "2360","2365","2366",
 208:  "2375",
 209:  "2465",
 210:  "2460","2469",
 211:  "25480","25481","25482","25483",
 212:  "24780","24781","24782"
 213:                  };
 214:              }
 215:          }
 216:  
 217:          ////////////////////////////////////////////////////////////////////////////
 218:  
 219:          /// <summary>
 220:          /// List of access areas allowed to be created
 221:          /// </summary>
 222:          public static List<string> AllowedAccessAreaToBeCreatedList
 223:          {
 224:              get
 225:              {
 226:                  return new List<string>() { //"SKB",
 227:                      //"MUB","QRN",  stopped due to the use of split Siemens, Huawei exchange in MUB & QRN
 228:                      /*"ADN","QSR",* /"ABW","MSL","ABF","FUN","COB",
 229:                      "SBN","QRW","ADS",
 230:                      "SAA","ESU","WAH","JBA","AGI","NAS",
 231:                      "ABM","ESH",
 232:                      "FHD","MGF","SSB","FNT","EGL","MAH",
 233:                      "SLA","SHD","HIT","ZAH","SDQ","SMC",
 234:                      "ABH","FHH","MGO",
 235:                      "MSF","BYN","MBA","SAB",
 236:                      "KHP","KHR","ABF","FUN","SBA","MAH","NWS","JBA","MSL","ADS"
 237:                  };
 238:              }
 239:          }
 240:  
 241:          ////////////////////////////////////////////////////////////////////////////
 242:  
 243:          /// <summary>
 244:          /// List of access areas allowed to be updated
 245:          /// </summary>
 246:          public static List<string> AllowedAccessAreaToBeUpdatedList
 247:          {
 248:              get
 249:              {
 250:                  return new List<string>() { //"SKB",
 251:                      //"MUB","QRN",  stopped due to the use of split Siemens, Huawei exchange in MUB & QRN
 252:                      /*"ADN","QSR",* /"ABW","MSL","ABF","FUN","COB",
 253:                      "SBN","QRW","ADS",
 254:                      "SAA","ESU","WAH","JBA","AGI","NAS",
 255:                      "ABM","ESH",
 256:                      "FHD","MGF","SSB","FNT","EGL","MAH",
 257:                      "SLA","SHD","HIT","ZAH","SDQ","SMC",
 258:                      "ABH","FHH","MGO",
 259:                      "MSF","BYN","MBA","SAB",
 260:                      "KHP","KHR","ABF","FUN","SBA","MAH","NWS","JBA","MSL","ADS"
 261:                  };
 262:              }
 263:          }
 264:  
 265:          ////////////////////////////////////////////////////////////////////////////
 266:  
 267:          /// <summary>
 268:          /// List of access areas allowed to be deleted
 269:          /// </summary>
 270:          public static List<string> AllowedAccessAreaToBeDeletedList
 271:          {
 272:              get
 273:              {
 274:                  return new List<string>() { //"SKB",
 275:                      //"MUB","QRN",  stopped due to the use of split Siemens, Huawei exchange in MUB & QRN
 276:                      /*"ADN","QSR",* /"ABW","MSL","ABF","FUN","COB",
 277:                      "SBN","QRW","ADS",
 278:                      "SAA","ESU","WAH","JBA","AGI","NAS",
 279:                      "ABM","ESH",
 280:                      "FHD","MGF","SSB","FNT","EGL","MAH",
 281:                      "SLA","SHD","HIT","ZAH","SDQ","SMC",
 282:                      "ABH","FHH","MGO",
 283:                      "MSF","BYN","MBA","SAB",
 284:                      "KHP","KHR","ABF","FUN","SBA","MAH","NWS","JBA","MSL","ADS"
 285:                  };
 286:              }
 287:          }
 288:          */
 289:   
 290:          ////////////////////////////////////////////////////////////////////////////
 291:   
 292:          /// <summary>
 293:          ///
 294:          /// </summary>
 295:          public class KuwaitNgnArea
 296:          {
 297:              /// <summary/>
 298:              public KuwaitNgnArea() { }
 299:   
 300:              /// <summary/>
 301:              public KuwaitNgnArea(string name, string arabicName)
 302:              {
 303:                  this.Name = name;
 304:                  this.ArabicName = arabicName;
 305:              }
 306:   
 307:              /// <summary/>
 308:              public int Id { get; set; }
 309:              /// <summary/>
 310:              public string Name { get; set; }
 311:              /// <summary/>
 312:              public string ArabicName { get; set; }
 313:              /// <summary/>
 314:              public string NameArabicName
 315:              {
 316:                  get
 317:                  {
 318:                      return Name + " (" + ArabicName + ")";
 319:                  }
 320:              }
 321:              /// <summary/>
 322:              public string Symbol { get; set; }
 323:              /// <summary/>
 324:              public string ServiceRequestAddressProvinceAreaName { get; set; }
 325:   
 326:              public virtual List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site> SiteList { get; set; }
 327:          }
 328:   
 329:          ////////////////////////////////////////////////////////////////////////////
 330:   
 331:          /// <summary>
 332:          ///
 333:          /// </summary>
 334:          public static List<int> SelectListOfNumbersWithinAllowedDomainList(List<int> inNumberList)
 335:          {
 336:              string numberString;
 337:              List<int> numberList;
 338:   
 339:              numberList = new List<int>();
 340:   
 341:              if (inNumberList.Count > 0)
 342:              {
 343:                  numberList = new List<int>(inNumberList.Count);
 344:   
 345:                  foreach (int i in inNumberList)
 346:                  {
 347:                      numberString = i.ToString();
 348:   
 349:                      if (NumberIsWithinAllowedDomainList(numberString)) numberList.Add(i);
 350:                  }
 351:              }
 352:   
 353:              return numberList;
 354:          }
 355:   
 356:          ////////////////////////////////////////////////////////////////////////////
 357:   
 358:          /// <summary>
 359:          ///
 360:          /// </summary>
 361:          public static bool OltIsWithinAllowedToBeProvisioned(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt)
 362:          {
 363:              return Ia.Ngn.Cl.Model.Data.Service.AllowedOltToBeProvisionedList.Any(u => u == olt);
 364:          }
 365:   
 366:          ////////////////////////////////////////////////////////////////////////////
 367:   
 368:          /// <summary>
 369:          ///
 370:          /// </summary>
 371:          public static bool AreaSymbolIsWithinAnAllowedOltToBeProvisionedDomainList(string areaSymbol)
 372:          {
 373:              bool b;
 374:   
 375:              if (!string.IsNullOrEmpty(areaSymbol))
 376:              {
 377:                  b = Ia.Ngn.Cl.Model.Data.Service.AllowedOltToBeProvisionedList.Any(v => v.Odf.Router.Site.AreaSymbolList.Any(u => areaSymbol == u));
 378:              }
 379:              else
 380:              {
 381:                  b = false;
 382:              }
 383:   
 384:              return b;
 385:          }
 386:   
 387:          ////////////////////////////////////////////////////////////////////////////
 388:   
 389:          /// <summary>
 390:          ///
 391:          /// </summary>
 392:          public static bool NumberIsWithinAnAllowedOltToBeProvisionedDomainList(string service)
 393:          {
 394:              bool b;
 395:   
 396:              if (!string.IsNullOrEmpty(service))
 397:              {
 398:                  b = Ia.Ngn.Cl.Model.Data.Service.AllowedOltToBeProvisionedList.Any(v => v.Odf.Router.DomainList.Any(u => service.StartsWith(u.ToString())));
 399:              }
 400:              else
 401:              {
 402:                  b = false;
 403:              }
 404:   
 405:              return b;
 406:          }
 407:   
 408:          ////////////////////////////////////////////////////////////////////////////
 409:   
 410:          /// <summary>
 411:          ///
 412:          /// </summary>
 413:          public static bool NumberIsWithinAllowedDomainList(long number)
 414:          {
 415:              string numberString;
 416:   
 417:              numberString = number.ToString();
 418:   
 419:              return NumberIsWithinAllowedDomainList(numberString);
 420:          }
 421:   
 422:          ////////////////////////////////////////////////////////////////////////////
 423:   
 424:          /// <summary>
 425:          ///
 426:          /// </summary>
 427:          public static bool NumberIsWithinAllowedRouterDomainList(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont ont, string service)
 428:          {
 429:              bool b;
 430:   
 431:              if (ont != null)
 432:              {
 433:                  b = ont.Pon.PonGroup.Olt.Odf.Router.DomainList.Any(u => service.StartsWith(u.ToString()));
 434:              }
 435:              else b = false;
 436:   
 437:              return b;
 438:          }
 439:   
 440:          ////////////////////////////////////////////////////////////////////////////
 441:   
 442:          /// <summary>
 443:          ///
 444:          /// </summary>
 445:          public static bool NumberIsWithinAllowedDomainList(string number)
 446:          {
 447:              bool isWithinAllowed;
 448:   
 449:              if (!string.IsNullOrEmpty(number))
 450:              {
 451:                  if (Ia.Ngn.Cl.Model.Data.Service.DomainList.Any(u => number.StartsWith(u.ToString()))) isWithinAllowed = true;
 452:                  else isWithinAllowed = false;
 453:              }
 454:              else isWithinAllowed = false;
 455:   
 456:              return isWithinAllowed;
 457:          }
 458:   
 459:          ////////////////////////////////////////////////////////////////////////////
 460:   
 461:          /// <summary>
 462:          ///
 463:          /// </summary>
 464:          public static bool NumberIsWithinAllowedNokiaSwitchDomainList(long number)
 465:          {
 466:              string numberString;
 467:   
 468:              numberString = number.ToString();
 469:   
 470:              return NumberIsWithinAllowedNokiaSwitchDomainList(numberString);
 471:          }
 472:   
 473:          ////////////////////////////////////////////////////////////////////////////
 474:   
 475:          /// <summary>
 476:          ///
 477:          /// </summary>
 478:          public static bool NumberIsWithinAllowedNokiaSwitchDomainList(string number)
 479:          {
 480:              bool isWithinAllowedDomains;
 481:   
 482:              if (NumberIsWithinAllowedDomainList(number))
 483:              {
 484:                  if (Ia.Ngn.Cl.Model.Data.Service.NokiaSwitchDomainList.Any(u => number.StartsWith(u.ToString()))) isWithinAllowedDomains = true;
 485:                  else isWithinAllowedDomains = false;
 486:              }
 487:              else isWithinAllowedDomains = false;
 488:   
 489:              return isWithinAllowedDomains;
 490:          }
 491:   
 492:          ////////////////////////////////////////////////////////////////////////////
 493:   
 494:          /// <summary>
 495:          ///
 496:          /// </summary>
 497:          public static bool NumberIsWithinAllowedHuaweiSwitchDomainList(long number)
 498:          {
 499:              string numberString;
 500:   
 501:              numberString = number.ToString();
 502:   
 503:              return NumberIsWithinAllowedHuaweiSwitchDomainList(numberString);
 504:          }
 505:   
 506:          ////////////////////////////////////////////////////////////////////////////
 507:   
 508:          /// <summary>
 509:          ///
 510:          /// </summary>
 511:          public static bool NumberIsWithinAllowedHuaweiSwitchDomainList(string number)
 512:          {
 513:              bool isWithinAllowedDomains;
 514:              int i;
 515:   
 516:              if (NumberIsWithinAllowedDomainList(number))
 517:              {
 518:                  if (Ia.Ngn.Cl.Model.Data.Service.HuaweiSwitchDomainList.Any(u => number.StartsWith(u.ToString()))) isWithinAllowedDomains = true;
 519:                  else isWithinAllowedDomains = false;
 520:              }
 521:              else isWithinAllowedDomains = false;
 522:   
 523:              return isWithinAllowedDomains;
 524:          }
 525:   
 526:          ////////////////////////////////////////////////////////////////////////////
 527:   
 528:          /// <summary>
 529:          ///
 530:          /// </summary>
 531:          public static Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor SwitchVendor(string service)
 532:          {
 533:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor;
 534:   
 535:              if (NumberIsWithinAllowedNokiaSwitchDomainList(service))
 536:              {
 537:                  vendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia;
 538:              }
 539:              else if (NumberIsWithinAllowedHuaweiSwitchDomainList(service))
 540:              {
 541:                  vendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei;
 542:              }
 543:              else vendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Undefined;
 544:   
 545:              return vendor;
 546:          }
 547:   
 548:          ////////////////////////////////////////////////////////////////////////////
 549:   
 550:          /// <summary>
 551:          ///
 552:          /// </summary>
 553:          public static Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor AccessVendor(string accessName)
 554:          {
 555:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor;
 556:   
 557:              vendor = (from v in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where v.Access.Name == accessName select v.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
 558:   
 559:              if (vendor == null) vendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Undefined;
 560:   
 561:              return vendor;
 562:          }
 563:   
 564:          ////////////////////////////////////////////////////////////////////////////    
 565:          ////////////////////////////////////////////////////////////////////////////
 566:      }
 567:   
 568:      ////////////////////////////////////////////////////////////////////////////
 569:   
 570:      /// <summary>
 571:      ///
 572:      /// </summary>
 573:      public static class ServiceExtension
 574:      {
 575:          ////////////////////////////////////////////////////////////////////////////
 576:   
 577:          /// <summary>
 578:          /// 
 579:          /// <see cref="http://stackoverflow.com/questions/8910588/how-to-override-contains"/>
 580:          /// </summary>
 581:          public static bool Contains(this List<Ia.Ngn.Cl.Model.Business.ServiceRequest.NumberSerial> sourceList, int number, int serial)
 582:          {
 583:              return ((from n in sourceList where n.Number == number && n.Serial == serial select n) != null);
 584:          }
 585:   
 586:          ////////////////////////////////////////////////////////////////////////////    
 587:   
 588:          /// <summary>
 589:          ///
 590:          /// </summary>
 591:          public static List<long> IdList(this List<Ia.Ngn.Cl.Model.Business.ServiceRequest.NumberSerial> sourceList)
 592:          {
 593:              return ((from n in sourceList select (long)((long)n.Number * 100 + n.Serial)).ToList());
 594:          }
 595:   
 596:          ////////////////////////////////////////////////////////////////////////////
 597:          ////////////////////////////////////////////////////////////////////////////
 598:      }
 599:   
 600:      ////////////////////////////////////////////////////////////////////////////
 601:      ////////////////////////////////////////////////////////////////////////////   
 602:  }