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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Provision

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

Provision support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections;
   3:  using System.Collections.Generic;
   4:  using System.Data;
   5:  using System.Linq;
   6:  using System.Text.RegularExpressions;
   7:   
   8:  namespace Ia.Ngn.Cl.Model.Business
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Provision support class of Next Generation Network'a (NGN's) business model.
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  18:      ///
  19:      /// 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
  20:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  21:      ///
  22:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  23:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  24:      /// 
  25:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  26:      /// 
  27:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  28:      /// </remarks> 
  29:      public class Provision
  30:      {
  31:          private static int serviceSuspensionQueueOriginalCount;
  32:          private static int sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueueOriginalCount;
  33:          private static Queue<string> sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue = new Queue<string>();
  34:          private static Queue<string> serviceSuspensionQueue = new Queue<string>();
  35:   
  36:          ////////////////////////////////////////////////////////////////////////////
  37:   
  38:          /// <summary>
  39:          ///
  40:          /// </summary>
  41:          public Provision() { }
  42:   
  43:          ////////////////////////////////////////////////////////////////////////////
  44:   
  45:          /// <summary>
  46:          ///
  47:          /// </summary>
  48:          public static bool CreateNokiaSwitchSubscriber(Ia.Ngn.Cl.Model.Client.Nokia.Ims ims, string accessName, string service, int port, Ia.Ngn.Cl.Model.Business.Default.Protocol protocol, bool ignoreRestrictions, out string result)
  49:          {
  50:              bool executed, isSip;
  51:              int gatewayId;
  52:              string r;
  53:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
  54:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor, accessVendor;
  55:              Ia.Ngn.Cl.Model.Ont ont;
  56:              Ia.Ngn.Cl.Model.Huawei.EmsOnt emsOnt;
  57:   
  58:              executed = false;
  59:              result = string.Empty;
  60:   
  61:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
  62:   
  63:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
  64:              {
  65:                  nddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Access.Name == accessName select n).SingleOrDefault();
  66:   
  67:                  if (nddOnt != null)
  68:                  {
  69:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(nddOnt, service) || ignoreRestrictions)
  70:                      {
  71:                          accessVendor = nddOnt.Pon.PonGroup.Olt.Odf.Vendor;
  72:   
  73:                          if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
  74:                          {
  75:                              ont = Ia.Ngn.Cl.Model.Data.Nokia.Ont.Read(nddOnt.Id);
  76:   
  77:                              if (ont != null)
  78:                              {
  79:                                  if (protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd) isSip = nddOnt.Pon.PonGroup.Olt.IsSip;
  80:                                  else isSip = protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.Sip;
  81:   
  82:                                  if (!isSip) // if H.248
  83:                                  {
  84:                                      gatewayId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
  85:   
  86:                                      if (gatewayId > 0)
  87:                                      {
  88:                                          port = (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown) ? port : Ia.Ngn.Cl.Model.Data.Nokia.Ams.NextVacantFlatTermIdForOnt(ont.FamilyTypeId, ont);
  89:   
  90:                                          if (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown)
  91:                                          {
  92:                                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.CreateH248SubscriberAndSubPartyAndAgcfEndpoint(ims, gatewayId, service, port, nddOnt, out r);
  93:                                              result += r + ",";
  94:   
  95:                                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
  96:                                              result += r + ",";
  97:   
  98:                                              executed = true;
  99:                                          }
 100:                                          else
 101:                                          {
 102:                                              result += "port is invalid or does not exist,";
 103:                                          }
 104:                                      }
 105:                                      else
 106:                                      {
 107:                                          result += "gatewayId is invalid or does not exist,";
 108:                                      }
 109:                                  }
 110:                                  else // if IsSip == true
 111:                                  {
 112:   
 113:                                  }
 114:                              }
 115:                              else
 116:                              {
 117:                                  result += "ONT is null for access:" + nddOnt.Access.Name + ",";
 118:                              }
 119:                          }
 120:                          else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 121:                          {
 122:                              emsOnt = Ia.Ngn.Cl.Model.Data.Huawei.Ont.Read(nddOnt.Id);
 123:   
 124:                              if (emsOnt != null)
 125:                              {
 126:                                  if (protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd) isSip = nddOnt.Pon.PonGroup.Olt.IsSip;
 127:                                  else isSip = protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.Sip;
 128:   
 129:                                  //onuFamilyType = Ia.Ngn.Cl.Model.Data.Huawei.Default.HuaweiSpecialOnuFamilyTypesForAccessNames(accessName);
 130:                                  // if (flatTermIdOrTelPort == 0) flatTermIdOrTelPort = Ia.Ngn.Cl.Model.Business.Ims.NextVacantFlatTermIdFromAgcfEndpointUsingGwIdForOnu(onuFamilyType, gatewayId);
 131:   
 132:                                  if (!isSip) // if H.248
 133:                                  {
 134:                                      gatewayId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
 135:   
 136:                                      if (gatewayId > 0)
 137:                                      {
 138:                                          port = (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown) ? port : Ia.Ngn.Cl.Model.Data.Default.NextVacantFlatTermIdForHuaweiEmsOntEquipmentTypeIdAndNokiaGatewayId(emsOnt.EquipmentType, gatewayId);
 139:   
 140:                                          if (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown)
 141:                                          {
 142:                                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.CreateH248SubscriberAndSubPartyAndAgcfEndpoint(ims, gatewayId, service, port, nddOnt, out r);
 143:                                              result += r + ",";
 144:   
 145:                                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
 146:                                              result += r + ",";
 147:   
 148:                                              executed = true;
 149:                                          }
 150:                                          else
 151:                                          {
 152:                                              result += "port is invalid or does not exist,";
 153:                                          }
 154:                                      }
 155:                                      else
 156:                                      {
 157:                                          result += "gatewayId is invalid or does not exist,";
 158:                                      }
 159:                                  }
 160:                                  else // if IsSip == true
 161:                                  {
 162:                                      Ia.Ngn.Cl.Model.Data.Nokia.Ims.CreateSipSubscriber(ims, service, nddOnt, out r);
 163:                                      result += r + ",";
 164:   
 165:                                      Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateSubPartyAndSubscriberAndService(ims, service, nddOnt, out r);
 166:                                      result += r + ",";
 167:   
 168:                                      executed = true;
 169:                                  }
 170:                              }
 171:                              else
 172:                              {
 173:                                  result += "EmsOnt is null, does not exist for access:" + nddOnt.Access.Name + ",";
 174:                              }
 175:                          }
 176:                          else
 177:                          {
 178:                              throw new Exception("accessVendor is unknown. ");
 179:                          }
 180:                      }
 181:                      else
 182:                      {
 183:                          result += "service is not within allowed router domain list. ";
 184:                      }
 185:                  }
 186:                  else
 187:                  {
 188:                      result += "nddOnt is null, does not exist for access:" + accessName + ",";
 189:                  }
 190:              }
 191:              else
 192:              {
 193:                  throw new Exception("switchVendor is null or not Nokia. ");
 194:              }
 195:   
 196:              return executed;
 197:          }
 198:   
 199:          ////////////////////////////////////////////////////////////////////////////
 200:   
 201:          /// <summary>
 202:          ///
 203:          /// </summary>
 204:          public static bool ModifyNokiaSwitchSubscriberH248ToSip(Ia.Ngn.Cl.Model.Client.Nokia.Ims ims, string service, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt, out string result)
 205:          {
 206:              bool executed;
 207:              int gatewayId;
 208:              string r;
 209:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor, accessVendor;
 210:              Ia.Ngn.Cl.Model.Ont ont;
 211:              Ia.Ngn.Cl.Model.Huawei.EmsOnt emsOnt;
 212:   
 213:              executed = false;
 214:              result = string.Empty;
 215:   
 216:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
 217:   
 218:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 219:              {
 220:                  if (nddOnt != null)
 221:                  {
 222:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(nddOnt, service))
 223:                      {
 224:                          accessVendor = nddOnt.Pon.PonGroup.Olt.Odf.Vendor;
 225:   
 226:                          if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 227:                          {
 228:                              ont = Ia.Ngn.Cl.Model.Data.Nokia.Ont.Read(nddOnt.Id);
 229:   
 230:                              if (ont != null)
 231:                              {
 232:                                  if (nddOnt.Pon.PonGroup.Olt.IsSip == false) // if H.248
 233:                                  {
 234:                                      gatewayId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
 235:   
 236:                                      if (gatewayId > 0)
 237:                                      {
 238:                                          //Ia.Ngn.Cl.Model.Data.Nokia.Ims.Modify248SubscriberAndSubPartyAndAgcfEndpointToSip(ims, gatewayId, service, nddOnt, out r);
 239:                                          //result += r + ",";
 240:   
 241:                                          Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
 242:                                          result += r + ",";
 243:   
 244:                                          executed = true;
 245:                                      }
 246:                                      else
 247:                                      {
 248:                                          result += "gatewayId is invalid or does not exist,";
 249:                                      }
 250:                                  }
 251:                                  else // if IsSip == true
 252:                                  {
 253:                                      result += "error: OLT is already SIP,";
 254:                                  }
 255:                              }
 256:                              else
 257:                              {
 258:                                  result += "ONT is null for access:" + nddOnt.Access.Name + ",";
 259:                              }
 260:                          }
 261:                          else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 262:                          {
 263:                              emsOnt = Ia.Ngn.Cl.Model.Data.Huawei.Ont.Read(nddOnt.Id);
 264:   
 265:                              if (emsOnt != null)
 266:                              {
 267:                                  if (nddOnt.Pon.PonGroup.Olt.IsSip == false) // if H.248
 268:                                  {
 269:                                      gatewayId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
 270:   
 271:                                      if (gatewayId > 0)
 272:                                      {
 273:                                          Ia.Ngn.Cl.Model.Data.Nokia.Ims.Modify248SubscriberAndSubPartyAndDeleteAgcfEndpointToSip(ims, service, nddOnt, out r);
 274:                                          result += r + ",";
 275:   
 276:                                          Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
 277:                                          result += r + ",";
 278:   
 279:                                          executed = true;
 280:                                      }
 281:                                      else
 282:                                      {
 283:                                          result += "gatewayId is invalid or does not exist,";
 284:                                      }
 285:                                  }
 286:                                  else // if IsSip == true
 287:                                  {
 288:                                      result += "error: OLT is already SIP,";
 289:                                  }
 290:                              }
 291:                              else
 292:                              {
 293:                                  result += "EmsOnt is null, does not exist for access:" + nddOnt.Access.Name + ",";
 294:                              }
 295:                          }
 296:                          else
 297:                          {
 298:                              throw new Exception("accessVendor is unknown. ");
 299:                          }
 300:                      }
 301:                      else
 302:                      {
 303:                          result += "service is not within allowed router domain list. ";
 304:                      }
 305:                  }
 306:                  else
 307:                  {
 308:                      result += "nddOnt is null,";
 309:                  }
 310:              }
 311:              else
 312:              {
 313:                  throw new Exception("switchVendor is null or not Nokia. ");
 314:              }
 315:   
 316:              return executed;
 317:          }
 318:   
 319:          ////////////////////////////////////////////////////////////////////////////
 320:   
 321:          /// <summary>
 322:          ///
 323:          /// </summary>
 324:          public static bool DeleteNokiaSwitchSubscriber(Ia.Ngn.Cl.Model.Client.Nokia.Ims ims, string accessName, string service, Ia.Ngn.Cl.Model.Business.Default.Protocol protocol, bool ignoreRestrictions, out string result)
 325:          {
 326:              bool executed, isSip;
 327:              int gatewayId;
 328:              string r;
 329:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 330:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor, accessVendor;
 331:              Ia.Ngn.Cl.Model.Ont ont;
 332:   
 333:              executed = false;
 334:              result = string.Empty;
 335:   
 336:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
 337:   
 338:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 339:              {
 340:                  nddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Access.Name == accessName select n).SingleOrDefault();
 341:   
 342:                  if (nddOnt != null)
 343:                  {
 344:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(nddOnt, service) || ignoreRestrictions)
 345:                      {
 346:                          accessVendor = nddOnt.Pon.PonGroup.Olt.Odf.Vendor;
 347:   
 348:                          if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 349:                          {
 350:                              ont = Ia.Ngn.Cl.Model.Data.Nokia.Ont.Read(nddOnt.Id);
 351:   
 352:                              if (ont != null)
 353:                              {
 354:                                  if (protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd) isSip = nddOnt.Pon.PonGroup.Olt.IsSip;
 355:                                  else isSip = protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.Sip;
 356:   
 357:                                  if (!isSip) // if H.248
 358:                                  {
 359:                                      gatewayId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
 360:   
 361:                                      if (gatewayId > 0)
 362:                                      {
 363:                                          Ia.Ngn.Cl.Model.Data.Nokia.Ims.DeleteAgcfEndpointAndH248SubscriberAndSubParty(ims, service, nddOnt, out r);
 364:                                          result += r + ",";
 365:   
 366:                                          Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
 367:                                          result += r + ",";
 368:   
 369:                                          executed = true;
 370:                                      }
 371:                                      else
 372:                                      {
 373:                                          result += "gatewayId is invalid or does not exist,";
 374:                                      }
 375:                                  }
 376:                                  else // if IsSip == true
 377:                                  {
 378:   
 379:                                  }
 380:                              }
 381:                              else
 382:                              {
 383:                                  result += "ont is null for access:" + nddOnt.Access.Name + ",";
 384:                              }
 385:                          }
 386:                          else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 387:                          {
 388:                              if (protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd) isSip = nddOnt.Pon.PonGroup.Olt.IsSip;
 389:                              else isSip = protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.Sip;
 390:   
 391:                              if (!isSip) // if H.248
 392:                              {
 393:                                  gatewayId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
 394:   
 395:                                  if (gatewayId > 0)
 396:                                  {
 397:                                      Ia.Ngn.Cl.Model.Data.Nokia.Ims.DeleteAgcfEndpointAndH248SubscriberAndSubParty(ims, service, nddOnt, out r);
 398:                                      result += r + ",";
 399:   
 400:                                      Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
 401:                                      result += r + ",";
 402:   
 403:                                      executed = true;
 404:                                  }
 405:                                  else
 406:                                  {
 407:                                      result += "gatewayId is invalid or does not exist,";
 408:                                  }
 409:                              }
 410:                              else // if IsSip == true
 411:                              {
 412:                                  Ia.Ngn.Cl.Model.Data.Nokia.Ims.DeleteSipSubscriber(ims, service, nddOnt, out r);
 413:                                  result += r + ",";
 414:   
 415:                                  Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateSubPartyAndSubscriberAndService(ims, service, nddOnt, out r);
 416:                                  result += r + ",";
 417:                              }
 418:                          }
 419:                          else
 420:                          {
 421:                              throw new Exception("accessVendor is unknown. ");
 422:                          }
 423:                      }
 424:                      else
 425:                      {
 426:                          result += "service is not within allowed router domain list. ";
 427:                      }
 428:                  }
 429:                  else
 430:                  {
 431:                      result += "nddOnt is null, does not exist for access:" + accessName + ",";
 432:                  }
 433:              }
 434:              else
 435:              {
 436:                  throw new Exception("switchVendor is null or not Nokia. ");
 437:              }
 438:   
 439:              return executed;
 440:          }
 441:   
 442:          ////////////////////////////////////////////////////////////////////////////
 443:   
 444:          /// <summary>
 445:          ///
 446:          /// </summary>
 447:          public static bool DeleteNokiaSwitchAgcfEndpointAndH248SubscriberAndIgnoreAccess(Ia.Ngn.Cl.Model.Client.Nokia.Ims ims, int gatewayId, string service, bool ignoreRestrictions, out string result)
 448:          {
 449:              bool executed;
 450:              string ip;
 451:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 452:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
 453:   
 454:              executed = false;
 455:              result = string.Empty;
 456:   
 457:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
 458:   
 459:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 460:              {
 461:                  ip = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.IpFromGatewayId(gatewayId);
 462:   
 463:                  if (!string.IsNullOrEmpty(ip))
 464:                  {
 465:                      nddOnt = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Ip == ip select o).SingleOrDefault();
 466:   
 467:                      if (nddOnt != null)
 468:                      {
 469:                          if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(nddOnt, service) || ignoreRestrictions)
 470:                          {
 471:                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.DeleteAgcfEndpointAndH248SubscriberAndSubParty(ims, service, nddOnt, out string r);
 472:                              result += r + ",";
 473:   
 474:                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(ims, gatewayId, out r);
 475:                              result += r + ",";
 476:   
 477:                              executed = true;
 478:                          }
 479:                          else
 480:                          {
 481:                              result += "service is not within allowed router domain list. ";
 482:                          }
 483:                      }
 484:                      else
 485:                      {
 486:                          result += "nddOnt is null, does not exist for ip:" + ip + ",";
 487:                      }
 488:                  }
 489:                  else
 490:                  {
 491:                      result += "For gatewayId: " + gatewayId + " ip is null or empty,";
 492:                  }
 493:              }
 494:              else
 495:              {
 496:                  throw new Exception("switchVendor is null or not Nokia. ");
 497:              }
 498:   
 499:              return executed;
 500:          }
 501:   
 502:          ////////////////////////////////////////////////////////////////////////////
 503:   
 504:          /// <summary>
 505:          ///
 506:          /// </summary>
 507:          public static bool DeleteNokiaSwitchAgcfEndpointAndH248SubscriberFromAnyFsdb(Ia.Ngn.Cl.Model.Client.Nokia.Ims ims, string service, out string result)
 508:          {
 509:              bool executed;
 510:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
 511:   
 512:              executed = false;
 513:              result = string.Empty;
 514:   
 515:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
 516:   
 517:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 518:              {
 519:                  if (!string.IsNullOrEmpty(service))
 520:                  {
 521:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedNokiaSwitchDomainList(service))
 522:                      {
 523:                          foreach (Ia.Ngn.Cl.Model.Business.Nokia.Ims.ImsBasicService ibs in Ia.Ngn.Cl.Model.Business.Nokia.Ims.ImsBasicServiceList)
 524:                          {
 525:                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.DeleteAgcfEndpointAndH248SubscriberAndSubParty(ims, service, ibs.PrimarySwitch, ibs.Fsdb, out string r);
 526:                              result += r + ",";
 527:   
 528:                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadSubPartyAndSubscriber(ims, service, ibs.PrimarySwitch, ibs.Fsdb, ibs.Service, out r);
 529:                              result += r + ",";
 530:                          }
 531:   
 532:                          executed = true;
 533:                      }
 534:                      else result += "Error: service number does not belong to a valid Nokia switch. ";
 535:                  }
 536:                  else
 537:                  {
 538:                      result += "Error: service null or empty. ";
 539:                  }
 540:              }
 541:              else
 542:              {
 543:                  throw new Exception("switchVendor is null or not Nokia. ");
 544:              }
 545:   
 546:              return executed;
 547:          }
 548:   
 549:          ////////////////////////////////////////////////////////////////////////////
 550:          ////////////////////////////////////////////////////////////////////////////
 551:   
 552:          /// <summary>
 553:          ///
 554:          /// </summary>
 555:          public static bool CreateHuaweiSwitchSubscriber(Ia.Ngn.Cl.Model.Client.Huawei.Ims ims, string accessName, string service, int port, Ia.Ngn.Cl.Model.Business.Default.Protocol protocol, bool ignoreRestrictions, out string result)
 556:          {
 557:              bool executed, created, isSip;
 558:              string r;
 559:              Ia.Ngn.Cl.Model.Business.Huawei.Default.FnSnPn fnSnPn;
 560:              Ia.Ngn.Cl.Model.Business.Huawei.Dev.MduDev mdu;
 561:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 562:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor, accessVendor;
 563:              Ia.Ngn.Cl.Model.Huawei.EmsOnt emsOnt;
 564:              Ia.Ngn.Cl.Model.Ont ont;
 565:   
 566:              executed = false;
 567:              result = string.Empty;
 568:   
 569:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
 570:   
 571:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 572:              {
 573:                  nddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Access.Name == accessName select n).SingleOrDefault();
 574:   
 575:                  if (nddOnt != null)
 576:                  {
 577:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(nddOnt, service) || ignoreRestrictions)
 578:                      {
 579:                          accessVendor = nddOnt.Pon.PonGroup.Olt.Odf.Vendor;
 580:   
 581:                          if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 582:                          {
 583:                              ont = Ia.Ngn.Cl.Model.Data.Nokia.Ont.Read(nddOnt.Id);
 584:   
 585:                              if (ont != null)
 586:                              {
 587:                                  port = (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown) ? port : Ia.Ngn.Cl.Model.Data.Nokia.Ams.NextVacantFlatTermIdForOnt(ont.FamilyTypeId, ont);
 588:   
 589:                                  if (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown)
 590:                                  {
 591:                                      Ia.Ngn.Cl.Model.Data.Huawei.Ims.CreateSubscriber(ims, service, nddOnt, out r);
 592:                                      result += r + ",";
 593:   
 594:                                      Ia.Ngn.Cl.Model.Business.Huawei.Ims.ReadSbrForService(ims, service, out r);
 595:                                      result += r + ",";
 596:   
 597:                                      // other commands will be issued through U2000 NBI to configure H.248 in SKB and TEC softswitch
 598:   
 599:                                      executed = true;
 600:                                  }
 601:                                  else
 602:                                  {
 603:                                      result += "Port is invalid or does not exist,";
 604:                                  }
 605:                              }
 606:                              else
 607:                              {
 608:                                  result += "Ont is null, does not exist for access:" + nddOnt.Access.Name + ",";
 609:                              }
 610:                          }
 611:                          else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 612:                          {
 613:                              emsOnt = Ia.Ngn.Cl.Model.Data.Huawei.Ont.Read(nddOnt.Id);
 614:   
 615:                              if (emsOnt != null)
 616:                              {
 617:                                  if (protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd) isSip = nddOnt.Pon.PonGroup.Olt.IsSip;
 618:                                  else isSip = protocol == Ia.Ngn.Cl.Model.Business.Default.Protocol.Sip;
 619:   
 620:                                  if (!isSip) // if H.248
 621:                                  {
 622:                                  }
 623:                                  else // if IsSip == true
 624:                                  {
 625:                                      if (emsOnt.FamilyType == Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu)
 626:                                      {
 627:                                          if (Ia.Ngn.Cl.Model.Data.Huawei.Default.AccessNameToMduDevDictionary.ContainsKey(nddOnt.Access.Name))
 628:                                          {
 629:                                              var pn = port;
 630:   
 631:                                              mdu = Ia.Ngn.Cl.Model.Data.Huawei.Default.AccessNameToMduDevDictionary[nddOnt.Access.Name];
 632:   
 633:                                              var vacantFnSnPnList = Ia.Ngn.Cl.Model.Data.Huawei.Ems.VacantMduFnSnPnForOntList(mdu, emsOnt);
 634:   
 635:                                              if (pn != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown) fnSnPn = vacantFnSnPnList.Where(f => f.Pn == pn).SingleOrDefault();
 636:                                              else fnSnPn = Ia.Ngn.Cl.Model.Data.Huawei.Ems.NextVacantMduFnSnPnForOnt(mdu, emsOnt);
 637:   
 638:                                              if (fnSnPn != null)
 639:                                              {
 640:                                                  port = (port < 0) ? fnSnPn.Pn : port;
 641:   
 642:                                                  created = Ia.Ngn.Cl.Model.Data.Huawei.Ims.CreateSubscriber(ims, service, nddOnt, out r);
 643:   
 644:                                                  result += r + ",";
 645:                                              }
 646:                                              else result += "MDU sn and/or tel is invalid or does not exist. ";
 647:                                          }
 648:                                          else
 649:                                          {
 650:                                              result += "emsOnt.FamilyType == Mdu but MduDictionary does not contain key: " + nddOnt.Access.Name + " for service: " + service + ", and access: " + nddOnt.Access.Name;
 651:                                          }
 652:                                      }
 653:                                      else // if not MDU
 654:                                      {
 655:                                          port = (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown) ? port : Ia.Ngn.Cl.Model.Data.Huawei.Ems.NextVacantTelForOnt(emsOnt);
 656:   
 657:                                          if (port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown)
 658:                                          {
 659:                                              created = Ia.Ngn.Cl.Model.Data.Huawei.Ims.CreateSubscriber(ims, service, nddOnt, out r);
 660:   
 661:                                              result += r + ",";
 662:                                          }
 663:                                          else
 664:                                          {
 665:                                              result += "Port is invalid or does not exist,";
 666:                                          }
 667:                                      }
 668:                                  }
 669:                              }
 670:                              else
 671:                              {
 672:                                  result += "emsOnt is null, does not exist for access:" + nddOnt.Access.Name + ",";
 673:                              }
 674:   
 675:                              Ia.Ngn.Cl.Model.Business.Huawei.Ims.ReadUpdateSbrAndServiceForService(ims, service, nddOnt, out r);
 676:                              result += r + ",";
 677:                          }
 678:                          else
 679:                          {
 680:                              throw new Exception("accessVendor is unknown. ");
 681:                          }
 682:                      }
 683:                      else
 684:                      {
 685:                          result += "service is not within allowed router domain list. ";
 686:                      }
 687:                  }
 688:                  else
 689:                  {
 690:                      result += "nddOnt is null, does not exist for access:" + accessName + ",";
 691:                  }
 692:              }
 693:              else
 694:              {
 695:                  throw new Exception("switchVendor is null or not Huawei. ");
 696:              }
 697:   
 698:              return executed;
 699:          }
 700:   
 701:          ////////////////////////////////////////////////////////////////////////////
 702:   
 703:          /// <summary>
 704:          ///
 705:          /// </summary>
 706:          public static bool DeleteHuaweiSwitchSubscriber(Ia.Ngn.Cl.Model.Client.Huawei.Ims ims, string accessName, string service, Ia.Ngn.Cl.Model.Business.Default.Protocol protocol, bool ignoreRestrictions, out string result)
 707:          {
 708:              bool executed, isSip;
 709:              string r;
 710:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 711:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor, accessVendor;
 712:              Ia.Ngn.Cl.Model.Ont ont;
 713:   
 714:              executed = false;
 715:              result = string.Empty;
 716:   
 717:              switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
 718:   
 719:              if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 720:              {
 721:                  nddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Access.Name == accessName select n).SingleOrDefault();
 722:   
 723:                  if (nddOnt != null)
 724:                  {
 725:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(nddOnt, service) || ignoreRestrictions)
 726:                      {
 727:                          accessVendor = nddOnt.Pon.PonGroup.Olt.Odf.Vendor;
 728:   
 729:                          if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 730:                          {
 731:                              ont = Ia.Ngn.Cl.Model.Data.Nokia.Ont.Read(nddOnt.Id);
 732:   
 733:                              if (ont != null)
 734:                              {
 735:                                  Ia.Ngn.Cl.Model.Data.Huawei.Ims.DeleteSubscriber(ims, service, out r);
 736:                                  result += r + ",";
 737:   
 738:                                  Ia.Ngn.Cl.Model.Business.Huawei.Ims.ReadUpdateSbrAndServiceForService(ims, service, nddOnt, out r);
 739:                                  result += r + ",";
 740:   
 741:                                  // other commands will be issued through U2000 NBI to configure H.248 in SKB and TEC softswitch
 742:                              }
 743:                              else
 744:                              {
 745:                                  result += "ont is null,";
 746:                              }
 747:                          }
 748:                          else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 749:                          {
 750:                              Ia.Ngn.Cl.Model.Data.Huawei.Ims.DeleteSubscriber(ims, service, out r);
 751:                              result += r + ",";
 752:   
 753:                              Ia.Ngn.Cl.Model.Business.Huawei.Ims.ReadUpdateSbrAndServiceForService(ims, service, nddOnt, out r);
 754:                              result += r + ",";
 755:                          }
 756:                          else
 757:                          {
 758:                              throw new Exception("accessVendor is unknown. ");
 759:                          }
 760:                      }
 761:                      else
 762:                      {
 763:                          result += "service is not within allowed router domain list. ";
 764:                      }
 765:                  }
 766:                  else
 767:                  {
 768:                      result += "nddOnt is null, does not exist for access:" + accessName + ",";
 769:                  }
 770:              }
 771:              else
 772:              {
 773:                  throw new Exception("switchVendor is null or not Huawei. ");
 774:              }
 775:   
 776:              return executed;
 777:          }
 778:   
 779:          ////////////////////////////////////////////////////////////////////////////
 780:          ////////////////////////////////////////////////////////////////////////////
 781:   
 782:          /// <summary>
 783:          ///
 784:          /// </summary>
 785:          public static string SequentialServiceSuspensionMismatchBetweenServiceRequestServiceAndServiceServiceIdList(out int serviceSuspensionQueueCount, out string result)
 786:          {
 787:              string service;
 788:   
 789:              if (serviceSuspensionQueue.Count == 0)
 790:              {
 791:                  serviceSuspensionQueue = new Queue<string>(Ia.Ngn.Cl.Model.Data.Provision.ServiceSuspensionMismatchBetweenServiceRequestServiceAndServiceServiceIdList());
 792:   
 793:                  serviceSuspensionQueueOriginalCount = serviceSuspensionQueue.Count;
 794:              }
 795:   
 796:              if (serviceSuspensionQueue.Count > 0) service = serviceSuspensionQueue.Dequeue();
 797:              else service = null;
 798:   
 799:              result = "(" + serviceSuspensionQueue.Count + "/" + serviceSuspensionQueueOriginalCount + ") ";
 800:   
 801:              serviceSuspensionQueueCount = serviceSuspensionQueue.Count;
 802:   
 803:              return service;
 804:          }
 805:   
 806:          ////////////////////////////////////////////////////////////////////////////
 807:   
 808:          /// <summary>
 809:          ///
 810:          /// </summary>
 811:          public static string SequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceListItem(int provisionWithinLastNDays, out int sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueueCount, out string progressCounterString)
 812:          {
 813:              string service;
 814:   
 815:              if (sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue.Count == 0)
 816:              {
 817:                  sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue = new Queue<string>(DiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdList(provisionWithinLastNDays).Keys.ToList());
 818:   
 819:                  sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueueOriginalCount = sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue.Count;
 820:              }
 821:   
 822:              if (sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue.Count > 0) service = sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue.Dequeue();
 823:              else service = null;
 824:   
 825:              progressCounterString = "(" + sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue.Count + "/" + sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueueOriginalCount + ")";
 826:   
 827:              sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueueCount = sequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdQueue.Count;
 828:   
 829:              return service;
 830:          }
 831:   
 832:          ////////////////////////////////////////////////////////////////////////////
 833:   
 834:          /// <summary>
 835:          ///
 836:          /// </summary>
 837:          public static Dictionary<string, string> DiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceServiceIdList(int provisionWithinLastNDays)
 838:          {
 839:              Dictionary<string, string> dictionary;
 840:   
 841:              Ia.Ngn.Cl.Model.Data.Provision.ServiceToUpdateServiceIdAccessIdDictionary_ServiceToCreateServiceIdAccessIdDictionary_ServiceToDeleteServiceIdAccessIdDictionary(provisionWithinLastNDays, out Dictionary<string, string> serviceToUpdateIdAccessIdDictionary, out Dictionary<string, string> serviceToCreateServiceIdAccessIdDictionary, out Dictionary<string, string> serviceToDeleteServiceIdAccessIdDictionary);
 842:   
 843:              dictionary = new Dictionary<string, string>(serviceToUpdateIdAccessIdDictionary.Count + serviceToCreateServiceIdAccessIdDictionary.Count + serviceToDeleteServiceIdAccessIdDictionary.Count);
 844:   
 845:              foreach (KeyValuePair<string, string> s in serviceToUpdateIdAccessIdDictionary) dictionary.Add(s.Key, s.Value);
 846:              foreach (KeyValuePair<string, string> s in serviceToCreateServiceIdAccessIdDictionary) dictionary.Add(s.Key, s.Value);
 847:              foreach (KeyValuePair<string, string> s in serviceToDeleteServiceIdAccessIdDictionary) dictionary.Add(s.Key, s.Value);
 848:   
 849:              return dictionary;
 850:          }
 851:   
 852:          ////////////////////////////////////////////////////////////////////////////
 853:   
 854:          /// <summary>
 855:          ///
 856:          /// </summary>
 857:          public static List<Ia.Ngn.Cl.Model.Business.Procedure.Process> ServiceToCreateAndToDeleteInEmsOntSipInfoOrVoipPstnUserListFromThePastNHourList(int provisioningWithinPastNHours)
 858:          {
 859:              DateTime pastNHoursDateTime;
 860:              List<Ia.Ngn.Cl.Model.Business.Procedure.Process> processList;
 861:   
 862:              processList = new List<Ia.Ngn.Cl.Model.Business.Procedure.Process>();
 863:   
 864:              pastNHoursDateTime = (provisioningWithinPastNHours > 0) ? DateTime.UtcNow.AddHours(3).AddHours(-provisioningWithinPastNHours) : DateTime.MinValue;
 865:   
 866:              Ia.Ngn.Cl.Model.Business.Provision.ServiceIdToCreateInEmsOntSipInfoOrVoipPstnUserList_ServiceIdToAnnulInEmsOntSipInfoOrVoipPstnUserList(out List<Ia.Ngn.Cl.Model.Business.ServiceOnt> serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList, out List<Ia.Ngn.Cl.Model.Business.ServiceOnt> serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList);
 867:   
 868:              // issue read, execute, then read again commands
 869:              foreach (var serviceOnt in serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList)
 870:              {
 871:                  if (serviceOnt.CreatedDateTime >= pastNHoursDateTime)
 872:                  {
 873:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { ServiceId = serviceOnt.ServiceId, Service = serviceOnt.Service, Ont = serviceOnt.Ont, Port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Create, DateTime = serviceOnt.CreatedDateTime });
 874:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { ServiceId = serviceOnt.ServiceId, Service = serviceOnt.Service, Ont = serviceOnt.Ont, Port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Read, DateTime = serviceOnt.CreatedDateTime });
 875:                  }
 876:              }
 877:   
 878:              foreach (var serviceOnt in serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList)
 879:              {
 880:                  if (serviceOnt.CreatedDateTime >= pastNHoursDateTime)
 881:                  {
 882:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { ServiceId = serviceOnt.ServiceId, Service = serviceOnt.Service, Ont = serviceOnt.Ont, Port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Delete, DateTime = serviceOnt.CreatedDateTime });
 883:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { ServiceId = serviceOnt.ServiceId, Service = serviceOnt.Service, Ont = serviceOnt.Ont, Port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Read, DateTime = serviceOnt.CreatedDateTime });
 884:                  }
 885:              }
 886:   
 887:              return processList;
 888:          }
 889:   
 890:          ////////////////////////////////////////////////////////////////////////////
 891:   
 892:          /// <summary>
 893:          /// Find the provisioned services within SIP OLTs that do not have equivalent OntSipInfo or VoipPstnUser records, and all OntSipInfo and VoipPstnUser records that do note have equivalent services within SIP OLTs.
 894:          /// </summary>
 895:          private static void ServiceIdToCreateInEmsOntSipInfoOrVoipPstnUserList_ServiceIdToAnnulInEmsOntSipInfoOrVoipPstnUserList(out List<Ia.Ngn.Cl.Model.Business.ServiceOnt> serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList, out List<Ia.Ngn.Cl.Model.Business.ServiceOnt> serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList)
 896:          {
 897:              Ia.Ngn.Cl.Model.Business.ServiceOnt serviceOnt2;
 898:              List<string> serviceIdExemptionList;
 899:              List<Ia.Ngn.Cl.Model.Business.ServiceOnt> serviceOntList, serviceOntWithinAllowedToBeProvisionedOrMigratedSipOltList;
 900:              List<Ia.Ngn.Cl.Model.Business.ServiceOnt> ontSipInfoServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList, voipPstnUserServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList;
 901:   
 902:              serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList = new List<Ia.Ngn.Cl.Model.Business.ServiceOnt>();
 903:              serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList = new List<Ia.Ngn.Cl.Model.Business.ServiceOnt>();
 904:   
 905:              serviceOntWithinAllowedToBeProvisionedOrMigratedSipOltList = Ia.Ngn.Cl.Model.Data.Service2.ServiceOntWithinAllowedSipOltToBeProvisionedOrMigratedList;
 906:              serviceOntList = Ia.Ngn.Cl.Model.Data.Service2.ServiceOntList;
 907:              ontSipInfoServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList = Ia.Ngn.Cl.Model.Data.Huawei.OntSipInfo.ServiceOntWithinAllowedSipOltToBeProvisionedOrMigratedList();
 908:              voipPstnUserServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList = Ia.Ngn.Cl.Model.Data.Huawei.VoipPstnUser.ServiceOntWithinAllowedSipOltToBeProvisionedOrMigratedList();
 909:   
 910:              foreach (var serviceOnt in serviceOntWithinAllowedToBeProvisionedOrMigratedSipOltList)
 911:              {
 912:                  if (!ontSipInfoServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList.Any(u => u.ServiceId == serviceOnt.ServiceId) && !voipPstnUserServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList.Any(u => u.ServiceId == serviceOnt.ServiceId))
 913:                  {
 914:                      if (!serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 915:                      {
 916:                          serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList.Add(serviceOnt);
 917:                      }
 918:                  }
 919:              }
 920:   
 921:              // In serviceIdToAnnulInEmsOntSipInfoOrVoipPstnUserList I must make sure that serviceId does not belong to any current service in serviceIdWithinHuaweiSwitchDomainList
 922:              // this is to allow U2000 and POTS to GPON migration without interruption or feedback from the vendor. Any number deleted from IMS will be deleted from U2000.
 923:   
 924:              foreach (var serviceOnt in ontSipInfoServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList)
 925:              {
 926:                  if (!serviceOntWithinAllowedToBeProvisionedOrMigratedSipOltList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 927:                  {
 928:                      if (!serviceOntList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 929:                      {
 930:                          if (!serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 931:                          {
 932:                              serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList.Add(serviceOnt);
 933:                          }
 934:                      }
 935:                  }
 936:              }
 937:   
 938:              foreach (var serviceOnt in voipPstnUserServiceOntWithinAllowedToBeProvisionedOrMigratedSipOltList)
 939:              {
 940:                  if (!serviceOntWithinAllowedToBeProvisionedOrMigratedSipOltList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 941:                  {
 942:                      if (!serviceOntList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 943:                      {
 944:                          if (!serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList.Any(u => u.ServiceId == serviceOnt.ServiceId)) // .Contains(serviceOnt) is disastrous here
 945:                          {
 946:                              serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList.Add(serviceOnt);
 947:                          }
 948:                      }
 949:                  }
 950:              }
 951:   
 952:              // will exclude exempt numbers
 953:              serviceIdExemptionList = Ia.Ngn.Cl.Model.Data.Provision.ServiceIdOfServiceExemptFromProvisionProcessingList();
 954:              foreach (string serviceId in serviceIdExemptionList)
 955:              {
 956:                  serviceOnt2 = serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList.SingleOrDefault(u => u.ServiceId == serviceId);
 957:                  if (serviceOnt2 != null) serviceOntToCreateInEmsOntSipInfoOrVoipPstnUserList.Remove(serviceOnt2);
 958:   
 959:                  serviceOnt2 = serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList.SingleOrDefault(u => u.ServiceId == serviceId);
 960:                  if (serviceOnt2 != null) serviceOntToAnnulInEmsOntSipInfoOrVoipPstnUseList.Remove(serviceOnt2);
 961:              }
 962:          }
 963:   
 964:          ////////////////////////////////////////////////////////////////////////////
 965:          ////////////////////////////////////////////////////////////////////////////
 966:   
 967:          /// <summary>
 968:          ///
 969:          /// </summary>
 970:          public static List<string> ServiceSuspendedInServiceRequestServiceButNotInServiceStringNumberList
 971:          {
 972:              get
 973:              {
 974:                  List<string> list, sList, srsList;
 975:                  SortedList sl;
 976:   
 977:                  sList = Ia.Ngn.Cl.Model.Data.Service2.ServiceSuspensionIsTrueStringNumberList;
 978:                  srsList = Ia.Ngn.Cl.Model.Data.ServiceRequestService.ServiceSuspensionIsTrueAndProvisionedIsTrueStringNumberList;
 979:   
 980:                  if (sList != null && sList.Count > 0)
 981:                  {
 982:                      if (srsList != null && srsList.Count > 0)
 983:                      {
 984:                          list = new List<string>(sList.Count);
 985:   
 986:                          sl = new SortedList(sList.ToDictionary(s => s));
 987:   
 988:                          foreach (string s in srsList)
 989:                          {
 990:                              if (!sl.ContainsKey(s)) list.Add(s);
 991:                          }
 992:                      }
 993:                      else
 994:                      {
 995:                          list = new List<string>();
 996:                      }
 997:                  }
 998:                  else
 999:                  {
1000:                      if (srsList != null && srsList.Count > 0) list = sList;
1001:                      else list = new List<string>();
1002:                  }
1003:   
1004:                  return list;
1005:              }
1006:          }
1007:   
1008:          ////////////////////////////////////////////////////////////////////////////
1009:   
1010:          /// <summary>
1011:          ///
1012:          /// </summary>
1013:          public static List<string> ServiceActiveInServiceRequestServiceButNotInServiceStringNumberList
1014:          {
1015:              get
1016:              {
1017:                  List<string> list, sList, srsList;
1018:                  SortedList sl;
1019:   
1020:                  sList = Ia.Ngn.Cl.Model.Data.Service2.ServiceSuspensionIsFalseStringNumberList;
1021:                  srsList = Ia.Ngn.Cl.Model.Data.ServiceRequestService.ServiceSuspensionIsFalseStringNumberList;
1022:   
1023:                  if (sList != null && sList.Count > 0)
1024:                  {
1025:                      if (srsList != null && srsList.Count > 0)
1026:                      {
1027:                          list = new List<string>(sList.Count);
1028:   
1029:                          sl = new SortedList(sList.ToDictionary(s => s));
1030:   
1031:                          foreach (string s in srsList)
1032:                          {
1033:                              if (!sl.ContainsKey(s)) list.Add(s);
1034:                          }
1035:                      }
1036:                      else
1037:                      {
1038:                          list = new List<string>();
1039:                      }
1040:                  }
1041:                  else
1042:                  {
1043:                      if (srsList != null && srsList.Count > 0) list = sList;
1044:                      else list = new List<string>();
1045:                  }
1046:   
1047:                  return list;
1048:              }
1049:          }
1050:   
1051:          ////////////////////////////////////////////////////////////////////////////
1052:   
1053:          /// <summary>
1054:          ///
1055:          /// </summary>
1056:          public static List<Ia.Ngn.Cl.Model.Business.Procedure.Process> EmsOntToBeUpdatedFromH248ToSipList()
1057:          {
1058:              List<string> oltSymbolList;
1059:              List<Ia.Ngn.Cl.Model.Business.Procedure.Process> processList;
1060:   
1061:              processList = new List<Ia.Ngn.Cl.Model.Business.Procedure.Process>();
1062:   
1063:              oltSymbolList = Ia.Ngn.Cl.Model.Business.Default.H248ToSipUpdateOltSymbolList;
1064:   
1065:              var list = Ia.Ngn.Cl.Model.Data.Default.DistinctNddOntWhereVaprofIsNotAluSipBAndIgnoreMduForOltSymbolListList(oltSymbolList);
1066:   
1067:              foreach (var l in list)
1068:              {
1069:                  processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Ont = l.Ont, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Update });
1070:                  processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Ont = l.Ont, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Read });
1071:              }
1072:   
1073:              return processList;
1074:          }
1075:   
1076:          ////////////////////////////////////////////////////////////////////////////
1077:   
1078:          /// <summary>
1079:          ///
1080:          /// </summary>
1081:          public static List<Ia.Ngn.Cl.Model.Business.Procedure.Process> OntSipInfoOrOntVoipPstnUserToBeCreatedForAnOntUpdatedFromH248ToSipList()
1082:          {
1083:              int pn;
1084:              List<string> oltSymbolList;
1085:              List<Ia.Ngn.Cl.Model.Business.Procedure.Process> processList;
1086:   
1087:              processList = new List<Ia.Ngn.Cl.Model.Business.Procedure.Process>();
1088:   
1089:              oltSymbolList = Ia.Ngn.Cl.Model.Business.Default.H248ToSipUpdateOltSymbolList;
1090:   
1091:              var list = Ia.Ngn.Cl.Model.Data.Default.ServiceAndNddOntAndEmsOntFamilyTypeAndPortWhereAgcfEndpointPortIsNot0AndVaprofIsAluSipBAndSfuEmsOntSipInfoTelDoesNotExistOrMduEmsVagIsSipAndMduEmsVoipPstnUserPnDoesNotExistForOltSymbolListList(oltSymbolList);
1092:   
1093:              /*
1094:               * All Nokia ONTs (SFUs and MDUs) start at port position 1.
1095:               * Huawei ONTs (SFUs) start at port position 1, while Huawei MDUs start at port position 0.
1096:               */
1097:   
1098:              // issue update then read commands
1099:              foreach (var l in list)
1100:              {
1101:                  if (l.EmsOntFamilyType == Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu)
1102:                  {
1103:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Service = l.Service, Ont = l.Ont, EmsOntFamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu, Port = l.Port, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Update });
1104:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Service = l.Service, Ont = l.Ont, EmsOntFamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Sfu, Port = l.Port, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Read });
1105:                  }
1106:                  else if (l.EmsOntFamilyType == Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu)
1107:                  {
1108:                      pn = Ia.Ngn.Cl.Model.Business.Service.ConvertFlatTermIdPositionToEmsVoipPstnUsersPn(l.Port);
1109:   
1110:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Service = l.Service, Ont = l.Ont, EmsOntFamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, Port = pn, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Update });
1111:                      processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Service = l.Service, Ont = l.Ont, EmsOntFamilyType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType.Mdu, Port = pn, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.Read });
1112:                  }
1113:                  else
1114:                  {
1115:                      throw new Exception("EmsOntFamilyType is not concedered. ");
1116:                  }
1117:              }
1118:   
1119:              return processList;
1120:          }
1121:   
1122:          ////////////////////////////////////////////////////////////////////////////
1123:   
1124:          /// <summary>
1125:          ///
1126:          /// </summary>
1127:          public static List<Ia.Ngn.Cl.Model.Business.Procedure.Process> NokiaImsSubscriberToBeUpdatedFromH248ToSipList()
1128:          {
1129:              List<string> oltSymbolList;
1130:              List<Ia.Ngn.Cl.Model.Business.Procedure.Process> processList;
1131:   
1132:              processList = new List<Ia.Ngn.Cl.Model.Business.Procedure.Process>();
1133:   
1134:              oltSymbolList = Ia.Ngn.Cl.Model.Business.Default.H248ToSipUpdateOltSymbolList;
1135:   
1136:              var list = Ia.Ngn.Cl.Model.Data.Default.ServiceAndNddOntWherePrimaryPuidcpeProfileNumberIsNot10AndEmsOntVaprofIsAluSipBAndSfuEmsOntSipInfoTelExistsOrAndMduEmsOntVagIsSipAndMduEmsVoipPstnUserPnExistsForOltSymbolListList(oltSymbolList);
1137:   
1138:              // issue delete then create commands
1139:              foreach (var l in list)
1140:              {
1141:                  processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Service = l.Service, Ont = l.Ont, Protocol = Ia.Ngn.Cl.Model.Business.Default.Protocol.H248, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.DeleteRead });
1142:   
1143:                  processList.Add(new Ia.Ngn.Cl.Model.Business.Procedure.Process { Service = l.Service, Ont = l.Ont, Protocol = Ia.Ngn.Cl.Model.Business.Default.Protocol.Sip, Type = Ia.Ngn.Cl.Model.Business.Procedure.ProcessType.CreateRead });
1144:              }
1145:   
1146:              return processList;
1147:          }
1148:   
1149:          ////////////////////////////////////////////////////////////////////////////
1150:   
1151:          /// <summary>
1152:          ///
1153:          /// </summary>
1154:          public static void ManageServiceProvisioning(Ia.Ngn.Cl.Model.Client.Nokia.Ims nokiaIms, Ia.Ngn.Cl.Model.Client.Huawei.Ims huaweiIms, out Ia.Cl.Model.Result result)
1155:          {
1156:              int gwId, number, provisionWithinLastNDays;
1157:              string service, serviceId, progressCounterString, r0, r, r2, r3;
1158:              Ia.Cl.Model.Result r4;
1159:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont srsNddOnt, sNddOnt;
1160:              Ia.Ngn.Cl.Model.Service2 service2;
1161:              Ia.Ngn.Cl.Model.ServiceRequestService serviceRequestService;
1162:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
1163:   
1164:              r = progressCounterString = r2 = r3 = string.Empty;
1165:              r4 = new Ia.Cl.Model.Result();
1166:              result = new Ia.Cl.Model.Result();
1167:   
1168:              provisionWithinLastNDays = 0; // 0 means earliest request datetime huaweiIms, 
1169:   
1170:              serviceId = Ia.Ngn.Cl.Model.Business.Provision.SequentialDiscrepancyAndComplementaryServiceMismatchBetweenServiceRequestServiceAndServiceListItem(provisionWithinLastNDays, out int serviceQueueCount, out progressCounterString);
1171:   
1172:              //serviceId = "23717888:1:965";
1173:   
1174:              if (serviceId != null)
1175:              {
1176:                  r0 = "service: " + serviceId.Replace(":1:965", "") + " " + progressCounterString + ": ";
1177:                  r2 = serviceId;
1178:   
1179:                  service2 = Ia.Ngn.Cl.Model.Data.Service2.ReadByIdIncludeAccess(serviceId);
1180:                  serviceRequestService = Ia.Ngn.Cl.Model.Data.ServiceRequestService.ReadIncludeAccess(serviceId);
1181:   
1182:                  try
1183:                  {
1184:                      if (serviceRequestService != null)
1185:                      {
1186:                          if (serviceRequestService.Provisioned)
1187:                          {
1188:                              service = serviceRequestService.Service;
1189:   
1190:                              if (int.TryParse(service, out number))
1191:                              {
1192:                                  switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
1193:   
1194:                                  srsNddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where serviceRequestService.Access != null && n.Access.Id == serviceRequestService.Access.Id select n).SingleOrDefault();
1195:   
1196:                                  if (service2 == null)
1197:                                  {
1198:                                      // create number in service
1199:                                      r0 += "create: ";
1200:   
1201:                                      if (srsNddOnt != null)
1202:                                      {
1203:                                          if (Ia.Ngn.Cl.Model.Business.Service.OltIsWithinAllowedToBeProvisionedOltList(srsNddOnt.Pon.PonGroup.Olt))
1204:                                          {
1205:                                              if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(srsNddOnt, service))
1206:                                              {
1207:                                                  if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
1208:                                                  {
1209:                                                      r0 += "Nokia: ";
1210:   
1211:                                                      // make sure the number is not suspended before creating it
1212:                                                      Ia.Ngn.Cl.Model.Data.ServiceRequestService.UpdateServiceSuspension(service, false, Guid.Empty, out r4);
1213:   
1214:                                                      Ia.Ngn.Cl.Model.Business.Provision.CreateNokiaSwitchSubscriber(nokiaIms, srsNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1215:                                                  }
1216:                                                  else if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
1217:                                                  {
1218:                                                      r0 += "Huawei: ";
1219:   
1220:                                                      // make sure the number is not suspend before creating it
1221:                                                      Ia.Ngn.Cl.Model.Data.ServiceRequestService.UpdateServiceSuspension(service, false, Guid.Empty, out r4);
1222:   
1223:                                                      // we I will completely remove any existing number before installing it again to make sure it installs fresh
1224:                                                      Ia.Ngn.Cl.Model.Business.Provision.DeleteHuaweiSwitchSubscriber(huaweiIms, srsNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1225:   
1226:                                                      Ia.Ngn.Cl.Model.Business.Provision.CreateHuaweiSwitchSubscriber(huaweiIms, srsNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1227:                                                  }
1228:                                                  else
1229:                                                  {
1230:                                                      throw new Exception("switchVendor is undefined, ");
1231:                                                  }
1232:                                              }
1233:                                              else
1234:                                              {
1235:                                                  r0 += "service is not within allowed router domain list. ";
1236:                                              }
1237:   
1238:                                              r0 += r;
1239:                                          }
1240:                                          else
1241:                                          {
1242:                                              r0 += "Access is not in an allowed to be provisioned OLT. ";
1243:                                          }
1244:                                      }
1245:                                      else r0 += "SRS Ont is null. ";
1246:                                  }
1247:                                  else
1248:                                  {
1249:                                      // check services
1250:                                      r0 += "update: ";
1251:   
1252:                                      // note that I will install services according to the Access given by service variable, not SRS access
1253:                                      sNddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where service2.Access != null && n.Access.Id == service2.Access.Id select n).SingleOrDefault();
1254:   
1255:                                      if (srsNddOnt != null && sNddOnt != null)
1256:                                      {
1257:                                          if (Ia.Ngn.Cl.Model.Business.Service.OltIsWithinAllowedToBeProvisionedOltList(srsNddOnt.Pon.PonGroup.Olt))
1258:                                          {
1259:                                              if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(sNddOnt, service))
1260:                                              {
1261:                                                  if (srsNddOnt.Id == sNddOnt.Id)
1262:                                                  {
1263:                                                      r0 += "service: ";
1264:   
1265:                                                      if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
1266:                                                      {
1267:                                                          r0 += "Nokia: ";
1268:   
1269:                                                          // below: send change command to IMS
1270:                                                          if (service2.CallerId != serviceRequestService.CallerId) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallerId, serviceRequestService.CallerId, out r2);
1271:                                                          else if (service2.CallForwarding != serviceRequestService.CallForwarding) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallForwarding, serviceRequestService.CallForwarding, out r2);
1272:                                                          else if (service2.ConferenceCall != serviceRequestService.ConferenceCall) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall, serviceRequestService.ConferenceCall, out r2);
1273:                                                          else if (service2.AlarmCall != serviceRequestService.AlarmCall) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall, serviceRequestService.AlarmCall, out r2);
1274:                                                          else if (service2.WakeupCall != serviceRequestService.WakeupCall) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall, serviceRequestService.WakeupCall, out r2);
1275:                                                          else if (service2.AbbriviatedCalling != serviceRequestService.AbbriviatedCalling) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling, serviceRequestService.AbbriviatedCalling, out r2);
1276:                                                          else if (service2.InternationalCalling != serviceRequestService.InternationalCalling) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling, serviceRequestService.InternationalCalling, out r2);
1277:                                                          else if (service2.InternationalCallingUserControlled != serviceRequestService.InternationalCallingUserControlled) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled, serviceRequestService.InternationalCallingUserControlled, out r2);
1278:                                                          // below: CallWaiting is not provisioned for PBX keys. It is placed last in the execution logic so that it does not prevention the flow of logic to other services
1279:                                                          else if (service2.CallWaiting != serviceRequestService.CallWaiting) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignSupplementaryService(nokiaIms, service, sNddOnt, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallWaiting, serviceRequestService.CallWaiting, out r2);
1280:   
1281:                                                          // below: a little complicated to decide if number should on or off
1282:                                                          else if (serviceRequestService.CallBarring == false && serviceRequestService.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, sNddOnt, false, out r2);
1283:                                                          else if (serviceRequestService.CallBarring == true && serviceRequestService.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, sNddOnt, true, out r2);
1284:                                                          else if (serviceRequestService.CallBarring == false && serviceRequestService.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, sNddOnt, true, out r2);
1285:                                                          else if (serviceRequestService.CallBarring == true && serviceRequestService.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, sNddOnt, true, out r2);
1286:                                                          else r2 = "no difference in services. ";
1287:   
1288:                                                          if (sNddOnt.Pon.PonGroup.Olt.IsSip == false) // if H.248
1289:                                                          {
1290:                                                              gwId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(sNddOnt.Ip);
1291:   
1292:                                                              if (gwId > 0)
1293:                                                              {
1294:                                                                  Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(nokiaIms, gwId, out r3);
1295:   
1296:                                                                  r0 += r2 + "," + r3 + ". ";
1297:                                                              }
1298:                                                              else
1299:                                                              {
1300:                                                                  r0 += "gwId: 0, " + r2 + "," + r3 + ". ";
1301:                                                              }
1302:                                                          }
1303:                                                          else // if IsSip == true
1304:                                                          {
1305:                                                              Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateSubPartyAndSubscriberAndService(nokiaIms, service, sNddOnt, out r3);
1306:                                                              r0 += r2 + "," + r3 + ". ";
1307:                                                          }
1308:                                                      }
1309:                                                      else if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
1310:                                                      {
1311:                                                          r0 += "Huawei: ";
1312:   
1313:                                                          // below: send change command to IMS
1314:                                                          if (service2.CallerId != serviceRequestService.CallerId) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallerId, serviceRequestService.CallerId, out r2);
1315:                                                          else if (service2.CallForwarding != serviceRequestService.CallForwarding) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallForwarding, serviceRequestService.CallForwarding, out r2);
1316:                                                          else if (service2.CallWaiting != serviceRequestService.CallWaiting) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallWaiting, serviceRequestService.CallWaiting, out r2);
1317:                                                          else if (service2.ConferenceCall != serviceRequestService.ConferenceCall) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall, serviceRequestService.ConferenceCall, out r2);
1318:                                                          else if (service2.AlarmCall != serviceRequestService.AlarmCall) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall, serviceRequestService.AlarmCall, out r2);
1319:                                                          else if (service2.WakeupCall != serviceRequestService.WakeupCall) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall, serviceRequestService.WakeupCall, out r2);
1320:                                                          else if (service2.AbbriviatedCalling != serviceRequestService.AbbriviatedCalling) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling, serviceRequestService.AbbriviatedCalling, out r2);
1321:   
1322:                                                          // below: data is insufficient to decide
1323:                                                          //if (service.InternationalCalling != serviceRequestService.InternationalCalling) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, serviceString, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling, serviceRequestService.InternationalCalling, out r2);
1324:                                                          else if (service2.InternationalCallingUserControlled != serviceRequestService.InternationalCallingUserControlled) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignSupplementaryService(huaweiIms, service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled, serviceRequestService.InternationalCallingUserControlled, out r2);
1325:   
1326:                                                          // below: data is insufficient to decide
1327:                                                          // below: a little complicated to decide if number should on or off
1328:                                                          //else if (srs.CallBarring == false && srs.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, false, out r2);
1329:                                                          //else if (srs.CallBarring == true && srs.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, true, out r2);
1330:                                                          //else if (srs.CallBarring == false && srs.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, true, out r2);
1331:                                                          //else if (srs.CallBarring == true && srs.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, true, out r2);
1332:   
1333:                                                          else r2 = "no difference in services. ";
1334:   
1335:                                                          // below: read and update
1336:                                                          Ia.Ngn.Cl.Model.Business.Huawei.Ims.ReadUpdateSbrAndServiceForService(huaweiIms, service, sNddOnt, out r3);
1337:   
1338:                                                          r0 += r2 + "," + r3 + ". ";
1339:                                                      }
1340:                                                      else
1341:                                                      {
1342:                                                          throw new Exception("switchVendor is undefined, ");
1343:                                                      }
1344:                                                  }
1345:                                                  else
1346:                                                  {
1347:                                                      // update service access
1348:                                                      r0 += "service access: ";
1349:                                                      r0 += "delete: ";
1350:   
1351:                                                      if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
1352:                                                      {
1353:                                                          r0 += "Nokia: ";
1354:   
1355:                                                          Ia.Ngn.Cl.Model.Business.Provision.DeleteNokiaSwitchSubscriber(nokiaIms, sNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1356:                                                      }
1357:                                                      else if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
1358:                                                      {
1359:                                                          r0 += "Huawei: ";
1360:   
1361:                                                          Ia.Ngn.Cl.Model.Business.Provision.DeleteHuaweiSwitchSubscriber(huaweiIms, sNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1362:                                                      }
1363:                                                      else
1364:                                                      {
1365:                                                          throw new Exception("switchVendor is undefined, ");
1366:                                                      }
1367:                                                  }
1368:                                              }
1369:                                              else
1370:                                              {
1371:                                                  r0 += "service is not within allowed router domain list. ";
1372:                                              }
1373:                                          }
1374:                                          else
1375:                                          {
1376:                                              r0 += "Access is not in an allowed to be provisioned OLT. ";
1377:                                          }
1378:                                      }
1379:                                      else
1380:                                      {
1381:                                          r0 += "Service access and/or service request service access is null. ";
1382:                                      }
1383:                                  }
1384:                              }
1385:                              else
1386:                              {
1387:                                  r0 += "service is not a valid number. ";
1388:                              }
1389:                          }
1390:                          else //if(!serviceRequestService.Provisioned)
1391:                          {
1392:                              service = serviceRequestService.Service;
1393:   
1394:                              if (int.TryParse(service, out number))
1395:                              {
1396:                                  switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
1397:   
1398:                                  if (service2 != null)
1399:                                  {
1400:                                      // delete number from service
1401:                                      r0 += "delete: ";
1402:   
1403:                                      sNddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where service2.Access != null && n.Access.Id == service2.Access.Id select n).SingleOrDefault();
1404:   
1405:                                      if (sNddOnt != null)
1406:                                      {
1407:                                          if (Ia.Ngn.Cl.Model.Business.Service.OltIsWithinAllowedToBeProvisionedOltList(sNddOnt.Pon.PonGroup.Olt))
1408:                                          {
1409:                                              if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedRouterDomainList(sNddOnt, service))
1410:                                              {
1411:                                                  if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
1412:                                                  {
1413:                                                      r0 += "Nokia: ";
1414:   
1415:                                                      Ia.Ngn.Cl.Model.Business.Provision.DeleteNokiaSwitchSubscriber(nokiaIms, sNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1416:                                                  }
1417:                                                  else if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
1418:                                                  {
1419:                                                      r0 += "Huawei: ";
1420:   
1421:                                                      Ia.Ngn.Cl.Model.Business.Provision.DeleteHuaweiSwitchSubscriber(huaweiIms, sNddOnt.Access.Name, service, Ia.Ngn.Cl.Model.Business.Default.Protocol.DefaultAsInNdd, false, out r);
1422:                                                  }
1423:                                                  else
1424:                                                  {
1425:                                                      throw new Exception("switchVendor is undefined, ");
1426:                                                  }
1427:                                              }
1428:                                              else
1429:                                              {
1430:                                                  r0 += "service is not within allowed router domain list. ";
1431:                                              }
1432:   
1433:                                              r0 += r;
1434:                                          }
1435:                                          else
1436:                                          {
1437:                                              r0 += "Access is not in an allowed to be provisioned OLT. ";
1438:                                          }
1439:                                      }
1440:                                      else r0 += "SRS Ont is null. ";
1441:                                  }
1442:                                  else
1443:                                  {
1444:                                      throw new Exception("switchVendor is null. ");
1445:                                  }
1446:                              }
1447:                              else
1448:                              {
1449:                                  r0 += "service is not a valid number. ";
1450:                              }
1451:                          }
1452:                      }
1453:                      else
1454:                      {
1455:                          r0 += "serviceRequestService is null. ";
1456:                      }
1457:                  }
1458:                  catch (Exception ex)
1459:                  {
1460:                      r0 += "Exception: " + ex.ToString();
1461:                  }
1462:              }
1463:              else
1464:              {
1465:                  r0 = "No numbers in service discrepancy and complementary service mismatch list. ";
1466:              }
1467:   
1468:              r0 = "Manage: " + r0;
1469:   
1470:              result.AddSuccess(r0);
1471:          }
1472:   
1473:          ////////////////////////////////////////////////////////////////////////////
1474:   
1475:          /// <summary>
1476:          ///
1477:          /// </summary>
1478:          public static void ManageServiceSuspension(Ia.Ngn.Cl.Model.Client.Nokia.Ims nokiaIms, Ia.Ngn.Cl.Model.Client.Huawei.Ims huaweiIms, out Ia.Cl.Model.Result result)
1479:          {
1480:              int gwId;
1481:              string service, serviceId, r0, r, r1, r2, r3;
1482:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
1483:              Ia.Ngn.Cl.Model.Service2 s;
1484:              Ia.Ngn.Cl.Model.ServiceRequestService srs;
1485:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
1486:   
1487:              r = r1 = r2 = r3 = string.Empty;
1488:   
1489:              result = new Ia.Cl.Model.Result();
1490:   
1491:              serviceId = Ia.Ngn.Cl.Model.Business.Provision.SequentialServiceSuspensionMismatchBetweenServiceRequestServiceAndServiceServiceIdList(out int serviceSuspensionQueueCount, out r1);
1492:   
1493:              if (serviceId != null)
1494:              {
1495:                  r0 = "service: " + serviceId.Replace(":1:965", "") + ",";
1496:                  r2 = serviceId;
1497:   
1498:                  s = Ia.Ngn.Cl.Model.Data.Service2.ReadByIdIncludeAccess(serviceId);
1499:                  srs = Ia.Ngn.Cl.Model.Data.ServiceRequestService.ReadIncludeAccess(serviceId);
1500:   
1501:                  try
1502:                  {
1503:                      if (srs != null && s != null)
1504:                      {
1505:                          service = srs.Service;
1506:   
1507:                          switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
1508:   
1509:                          nddOnt = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where srs.Access != null && n.Access.Id == srs.Access.Id select n).SingleOrDefault();
1510:   
1511:                          if (nddOnt != null)
1512:                          {
1513:                              if (Ia.Ngn.Cl.Model.Business.Service.OltIsWithinAllowedToBeProvisionedOltList(nddOnt.Pon.PonGroup.Olt))
1514:                              {
1515:                                  r0 += "service: ";
1516:   
1517:                                  if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
1518:                                  {
1519:                                      gwId = Ia.Ngn.Cl.Model.Data.Nokia.AgcfGatewayRecord.GwIdFromIp(nddOnt.Ip);
1520:   
1521:                                      if (gwId > 0)
1522:                                      {
1523:                                          // below: a little complicated to decide if number should on or off
1524:                                          if (srs.CallBarring == false && srs.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, nddOnt, false, out r2);
1525:                                          else if (srs.CallBarring == true && srs.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, nddOnt, true, out r2);
1526:                                          else if (srs.CallBarring == false && srs.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, nddOnt, true, out r2);
1527:                                          else if (srs.CallBarring == true && srs.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Nokia.Ims.AssignServiceSuspensionStateToServiceSubscriber(nokiaIms, service, nddOnt, true, out r2);
1528:   
1529:                                          r2 = Regex.Replace(r2, "[\r\n]+", ". ");
1530:   
1531:                                          // below: read and update
1532:                                          Ia.Ngn.Cl.Model.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(nokiaIms, gwId, out r3);
1533:   
1534:                                          r0 += r2 + "," + r3 + ",";
1535:                                      }
1536:                                      else
1537:                                      {
1538:                                          r0 += "gwId: 0, " + r2 + "," + r3 + ",";
1539:                                      }
1540:                                  }
1541:                                  else if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
1542:                                  {
1543:                                      // below: a little complicated to decide if number should on or off
1544:                                      //if (srs.CallBarring == false && srs.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, false, out r2);
1545:                                      //else if (srs.CallBarring == true && srs.ServiceSuspension == false) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, true, out r2);
1546:                                      //else if (srs.CallBarring == false && srs.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, true, out r2);
1547:                                      //else if (srs.CallBarring == true && srs.ServiceSuspension == true) Ia.Ngn.Cl.Model.Data.Huawei.Ims.AssignServiceSuspensionStateToServiceSubscriber(huaweiIms, service, true, out r2);
1548:   
1549:                                      r2 = Regex.Replace(r2, "[\r\n]+", "\r\n");
1550:   
1551:                                      // below: read and update
1552:                                      //Ia.Ngn.Cl.Model.Business.Huawei.Ims.ReadSbrForService(huaweiIms, service, out r3);
1553:   
1554:                                      r0 += r2 + "," + r3 + ",";
1555:                                      r0 += @"procedure not active for switchVendor.Name == ""Huawei"",";
1556:                                  }
1557:                                  else
1558:                                  {
1559:                                      r0 += "switchVendor is undefined,";
1560:                                  }
1561:                              }
1562:                              else
1563:                              {
1564:                                  r0 += "Access is not in an allowed to be provisioned OLT, ";
1565:                              }
1566:                          }
1567:                          else
1568:                          {
1569:                              r0 += "nddOnt == null,";
1570:                          }
1571:                      }
1572:                  }
1573:                  catch (Exception ex)
1574:                  {
1575:                      r0 += "Exception: " + ex.ToString();
1576:                  }
1577:              }
1578:              else
1579:              {
1580:                  r0 = "No numbers in service suspension mismatch list. ";
1581:              }
1582:   
1583:              r0 = "Manage: " + r0;
1584:   
1585:              result.AddSuccess(r0);
1586:          }
1587:   
1588:          ////////////////////////////////////////////////////////////////////////////
1589:          ////////////////////////////////////////////////////////////////////////////
1590:   
1591:          /// <summary>
1592:          ///
1593:          /// </summary>
1594:          public static void CreateService(Ia.Ngn.Cl.Model.Client.Nokia.Ims nokiaIms, Ia.Ngn.Cl.Model.Client.Huawei.Ims huaweiIms, string accessName, string service, int port, Ia.Ngn.Cl.Model.Business.Default.Protocol protocol, bool ignoreRestrictions, out string result)
1595:          {
1596:              if (!string.IsNullOrEmpty(service))
1597:              {
1598:                  if (!string.IsNullOrEmpty(accessName))
1599:                  {
1600:                      if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedNokiaSwitchDomainList(service))
1601:                      {
1602:                          Ia.Ngn.Cl.Model.Business.Provision.CreateNokiaSwitchSubscriber(nokiaIms, accessName, service, port, protocol, ignoreRestrictions, out result);
1603:                      }
1604:                      else if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedHuaweiSwitchDomainList(service))
1605:                      {
1606:                          Ia.Ngn.Cl.Model.Business.Provision.CreateHuaweiSwitchSubscriber(huaweiIms, accessName, service, port, protocol, ignoreRestrictions, out result);
1607:                      }
1608:                      else result = "Error: service number does not belong to a valid vendor switch. ";
1609:                  }
1610:                  else result = "Error: accessName null or empty. ";
1611:              }
1612:              else result = "Error: service null or empty. ";
1613:          }
1614:   
1615:          ////////////////////////////////////////////////////////////////////////////
1616:   
1617:          /// <summary>
1618:          ///
1619:          /// </summary>
1620:          public static void DeleteService(Ia.Ngn.Cl.Model.Client.Nokia.Ims nokiaIms, Ia.Ngn.Cl.Model.Client.Huawei.Ims huaweiIms, string accessName, string service, Ia.Ngn.Cl.Model.Business.Default.Protocol protocol, bool ignoreRestrictions, out string result)
1621:          {
1622:              bool b;
1623:   
1624:              if (!string.IsNullOrEmpty(service))
1625:              {
1626:                  if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedNokiaSwitchDomainList(service))
1627:                  {
1628:                      if (!string.IsNullOrEmpty(accessName))
1629:                      {
1630:                          b = Ia.Ngn.Cl.Model.Business.Provision.DeleteNokiaSwitchSubscriber(nokiaIms, accessName, service, protocol, ignoreRestrictions, out result);
1631:                      }
1632:                      else result = "Error: accessName is null or empty. ";
1633:                  }
1634:                  else if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedHuaweiSwitchDomainList(service))
1635:                  {
1636:                      b = Ia.Ngn.Cl.Model.Business.Provision.DeleteHuaweiSwitchSubscriber(huaweiIms, accessName, service, protocol, ignoreRestrictions, out result);
1637:                  }
1638:                  else result = "Error: service number does not belong to a valid vendor switch. ";
1639:              }
1640:              else
1641:              {
1642:                  result = "Error: service null or empty. ";
1643:              }
1644:          }
1645:   
1646:          ////////////////////////////////////////////////////////////////////////////
1647:          ////////////////////////////////////////////////////////////////////////////    
1648:      }
1649:   
1650:      ////////////////////////////////////////////////////////////////////////////
1651:      ////////////////////////////////////////////////////////////////////////////   
1652:  }