)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » ServiceRequestAdministrativeIssueController (Ia.Ngn.Ofn.Wa.Api.Model.Controller)

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

Service Request Administrative Issue API Controller class of Optical Fiber Network (OFN) model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4: using System.Runtime.Serialization;
    5: using System.Web.Http;
    6:  
    7: namespace Ia.Ngn.Ofn.Wa.Api.Model.Controller
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Service Request Administrative Issue API Controller class of Optical Fiber Network (OFN) model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     ///
   18:     /// 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
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     // [Authorize]
   29:     public partial class ServiceRequestAdministrativeIssueController : ApiController
   30:     {
   31:         private static readonly object objectLock = new object();
   32:  
   33:         ////////////////////////////////////////////////////////////////////////////
   34:  
   35:         /// <summary>
   36:         /// Service Request Administrative Issues: Restrain and release service numbers within the Optical Fiber Network
   37:         /// </summary>
   38:         public ServiceRequestAdministrativeIssueController() { }
   39:  
   40:         #region API v1
   41:  
   42:         ////////////////////////////////////////////////////////////////////////////
   43:         ////////////////////////////////////////////////////////////////////////////
   44:  
   45:         /// <summary>
   46:         /// IssueTypeListResponse
   47:         /// </summary>
   48:         [DataContract(IsReference = true, Name = "IssueTypeListResponse")]
   49:         public class IssueTypeListResponse
   50:         {
   51:             /// <summary/>
   52:             [DataMember(Name = "IsAuthorized")]
   53:             public bool IsAuthorized { get; set; }
   54:  
   55:             /// <summary/>
   56:             [DataMember(Name = "IssueTypeList")]
   57:             public List<Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.ServiceRequestAdministrativeIssueType> IssueTypeList { get; set; }
   58:         }
   59:  
   60:         ////////////////////////////////////////////////////////////////////////////
   61:  
   62:         /// <summary>
   63:         /// List of Service Request Administrative Issue types
   64:         /// </summary>
   65:         [HttpGet]
   66:         [Route("api/v1/service-request-administrative-issues/types")]
   67:         public IssueTypeListResponse IssueTypeList()
   68:         {
   69:             var response = new IssueTypeListResponse
   70:             {
   71:                 IsAuthorized = true,
   72:                 IssueTypeList = Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.ServiceRequestAdministrativeIssueTypeList
   73:             };
   74:  
   75:             return response;
   76:         }
   77:  
   78:         ////////////////////////////////////////////////////////////////////////////
   79:         ////////////////////////////////////////////////////////////////////////////
   80:  
   81:         /// <summary>
   82:         /// IssueListResponse
   83:         /// </summary>
   84:         [DataContract(IsReference = true, Name = "IssueListResponse")]
   85:         public class IssueListResponse
   86:         {
   87:             /// <summary/>
   88:             [DataMember(Name = "IsAuthorized")]
   89:             public bool IsAuthorized { get; set; }
   90:  
   91:             /// <summary/>
   92:             [DataMember(Name = "IssueList")]
   93:             public List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> IssueList { get; set; }
   94:         }
   95:  
   96:         /*
   97:         ////////////////////////////////////////////////////////////////////////////
   98: 
   99:         /// <summary>
  100:         /// List of all Service Request Administrative Issue services
  101:         /// </summary>
  102:         [HttpGet]
  103:         [Route("api/v1/service-request-administrative-issues")]
  104:         public IssueListResponse IssueList()
  105:         {
  106:             var response = new IssueListResponse
  107:             {
  108:                 IsAuthorized = true,
  109:                 IssueList = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.List()
  110:             };
  111: 
  112:             return response;
  113:         }
  114:         */
  115:  
  116:         ////////////////////////////////////////////////////////////////////////////
  117:         ////////////////////////////////////////////////////////////////////////////
  118:  
  119:         /// <summary>
  120:         /// IssueResponse
  121:         /// </summary>
  122:         [DataContract(IsReference = true, Name = "IssueResponse")]
  123:         public class IssueResponse
  124:         {
  125:             /// <summary/>
  126:             [DataMember(Name = "Service")]
  127:             public string Service { get; set; }
  128:  
  129:             /// <summary/>
  130:             [DataMember(Name = "ServiceType")]
  131:             public string ServiceType { get; set; }
  132:  
  133:             /// <summary/>
  134:             [DataMember(Name = "IsAuthorized")]
  135:             public bool IsAuthorized { get; set; }
  136:  
  137:             /// <summary/>
  138:             [DataMember(Name = "IsSuccessful")]
  139:             public bool IsSuccessful { get; set; }
  140:  
  141:             /// <summary/>
  142:             [DataMember(Name = "IsSuspended")]
  143:             public bool IsSuspended { get; set; }
  144:  
  145:             /// <summary/>
  146:             [DataMember(Name = "Updated")]
  147:             public DateTime Updated { get; set; }
  148:  
  149:             /// <summary/>
  150:             [DataMember(Name = "Message")]
  151:             public string Message { get; set; }
  152:  
  153:             /// <summary/>
  154:             [DataMember(Name = "Issue")]
  155:             public Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue Issue { get; set; }
  156:         }
  157:  
  158:         ////////////////////////////////////////////////////////////////////////////
  159:  
  160:         /// <summary>
  161:         /// Post (suspend) a service into the Service Request Administrative Issues table
  162:         /// </summary>
  163:         [HttpPost]
  164:         [Route("api/v1/service-request-administrative-issues/{service}")]
  165:         public IssueResponse PostSuspendIssue(string service)
  166:         {
  167:             var serviceRequestAdministrativeIssueType = Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.ServiceRequestAdministrativeIssueTypeByDisconnectionType(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.ProgrammedAccounting);
  168:  
  169:             var issue = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Update(service, serviceRequestAdministrativeIssueType, true, out Ia.Cl.Models.Result result);
  170:             var updated = issue != null ? issue.Updated : DateTime.MinValue;
  171:  
  172:             var response = new IssueResponse
  173:             {
  174:                 IsAuthorized = true,
  175:                 Issue = issue,
  176:                 Service = service,
  177:                 ServiceType = ServiceTypeString(service),
  178:                 IsSuccessful = result.IsSuccessful,
  179:                 IsSuspended = issue != null,
  180:                 Updated = updated,
  181:                 Message = result.Message
  182:             };
  183:  
  184:             return response;
  185:         }
  186:  
  187:         ////////////////////////////////////////////////////////////////////////////
  188:  
  189:         /// <summary>
  190:         /// Read Service Request Administrative Issue for a service
  191:         /// </summary>
  192:         [HttpGet]
  193:         [Route("api/v1/service-request-administrative-issues/{service}")]
  194:         public IssueResponse ReadIssue(string service)
  195:         {
  196:             var issue = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Read(service, out Ia.Cl.Models.Result result);
  197:             var updated = issue != null ? issue.Updated : DateTime.MinValue;
  198:  
  199:             var response = new IssueResponse
  200:             {
  201:                 IsAuthorized = true,
  202:                 Service = service,
  203:                 ServiceType = ServiceTypeString(service),
  204:                 IsSuccessful = result.IsSuccessful,
  205:                 IsSuspended = issue != null,
  206:                 Updated = updated,
  207:                 Message = result.Message
  208:             };
  209:  
  210:             return response;
  211:         }
  212:  
  213:         ////////////////////////////////////////////////////////////////////////////
  214:  
  215:         /// <summary>
  216:         /// Delete (release) a service from Service Request Administrative Issues table
  217:         /// </summary>
  218:         [HttpDelete]
  219:         [Route("api/v1/service-request-administrative-issues/{service}")]
  220:         public IssueResponse DeleteReleaseIssue(string service)
  221:         {
  222:             var serviceRequestAdministrativeIssueType = Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.ServiceRequestAdministrativeIssueTypeByDisconnectionType(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.None);
  223:  
  224:             var issue = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Update(service, serviceRequestAdministrativeIssueType, true, out Ia.Cl.Models.Result result);
  225:             var updated = issue != null ? issue.Updated : DateTime.MinValue;
  226:  
  227:             var response = new IssueResponse
  228:             {
  229:                 IsAuthorized = true,
  230:                 Service = service,
  231:                 ServiceType = ServiceTypeString(service),
  232:                 IsSuccessful = result.IsSuccessful,
  233:                 IsSuspended = issue != null,
  234:                 Updated = updated,
  235:                 Message = result.Message
  236:             };
  237:  
  238:             return response;
  239:         }
  240:  
  241:         ////////////////////////////////////////////////////////////////////////////
  242:  
  243:         /// <summary>
  244:         ///
  245:         /// </summary>
  246:         public string ServiceTypeString(string service)
  247:         {
  248:             string serviceType;
  249:  
  250:             if (!string.IsNullOrEmpty(service))
  251:             {
  252:                 if (Ia.Ngn.Cl.Model.Business.Default.IsKuwaitLandlineService(service))
  253:                 {
  254:                     if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
  255:                     {
  256:                         var isPstnService = Ia.Ngn.Cl.Model.Data.Service2.IsPstnService(service);
  257:  
  258:                         if (isPstnService) serviceType = "PSTN (نحاس)";
  259:                         else
  260:                         {
  261:                             var isImsService = Ia.Ngn.Cl.Model.Data.Service2.IsImsService(service);
  262:  
  263:                             if (isImsService) serviceType = "Digital (رقمي)";
  264:                             else serviceType = "Unknown (غبر معرف)";
  265:                         }
  266:                     }
  267:                     else serviceType = "Not in OFN network";
  268:                 }
  269:                 else serviceType = "Not landline";
  270:             }
  271:             else serviceType = "Null";
  272:  
  273:             return serviceType;
  274:         }
  275:  
  276:         #endregion
  277:  
  278:         ////////////////////////////////////////////////////////////////////////////
  279:         ////////////////////////////////////////////////////////////////////////////
  280:  
  281:         #region API v2
  282:  
  283:         ////////////////////////////////////////////////////////////////////////////
  284:  
  285:         /// <summary>
  286:         /// List of Service Request Administrative Issue types
  287:         /// </summary>
  288:         [HttpGet]
  289:         [Route("api/v2/service-request-administrative-issues/types")]
  290:         public List<Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.ServiceRequestAdministrativeIssueType> IssueTypeList2()
  291:         {
  292:             return Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.ServiceRequestAdministrativeIssueTypeList;
  293:         }
  294:  
  295:         /*
  296:         ////////////////////////////////////////////////////////////////////////////
  297: 
  298:         /// <summary>
  299:         /// List of all Service Request Administrative Issue services
  300:         /// </summary>
  301:         [HttpGet]
  302:         [Route("api/v2/service-request-administrative-issues")]
  303:         public List<string> IssueList2()
  304:         {
  305:             var list = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.List();
  306: 
  307:             return list.Select(u => u.Service).ToList();
  308:         }
  309:         */
  310:  
  311:         ////////////////////////////////////////////////////////////////////////////
  312:         ////////////////////////////////////////////////////////////////////////////
  313:  
  314:         /// <summary>
  315:         /// IssueResponse
  316:         /// </summary>
  317:         [DataContract(IsReference = true, Namespace = "kw.com.ia.ofn.api.serviceRequestAdministrativeIssue", Name = "IssueResponse")]
  318:         public class IssueResponse2
  319:         {
  320:             /// <summary/>
  321:             [DataMember]
  322:             public string Service { get; set; }
  323:  
  324:             /// <summary/>
  325:             [DataMember]
  326:             public bool IsWithinAllowedToBeProvisionedDomainList { get; set; }
  327:  
  328:             /// <summary/>
  329:             [DataMember]
  330:             public bool IsProvisioned { get; set; }
  331:  
  332:             /// <summary/>
  333:             [DataMember]
  334:             public bool IsPstnService { get; set; }
  335:  
  336:             /// <summary/>
  337:             [DataMember]
  338:             public bool IsImsService { get; set; }
  339:  
  340:             /// <summary/>
  341:             [DataMember]
  342:             public bool ServiceRequestServiceHasInternationalCalling { get; set; }
  343:  
  344:             /// <summary/>
  345:             [DataMember]
  346:             public bool IsPendingSuspension { get; set; }
  347:  
  348:             /// <summary/>
  349:             [DataMember]
  350:             public bool IsSuspended { get; set; }
  351:  
  352:             /// <summary/>
  353:             [DataMember]
  354:             public bool InternationalCallingIsPendingSuspension { get; set; }
  355:  
  356:             /// <summary/>
  357:             [DataMember]
  358:             public bool InternationalCallingIsSuspended { get; set; }
  359:  
  360:             /// <summary/>
  361:             [DataMember]
  362:             public bool IsSuccessful { get; set; }
  363:  
  364:             /// <summary/>
  365:             [DataMember]
  366:             public bool WasUpdated { get; set; }
  367:  
  368:             /// <summary/>
  369:             [DataMember]
  370:             public string Message { get; set; }
  371:         }
  372:  
  373:         ////////////////////////////////////////////////////////////////////////////
  374:  
  375:         /// <summary>
  376:         /// Post (suspend) a service into the Service Request Administrative Issues table
  377:         /// </summary>
  378:         [HttpPost]
  379:         [Route("api/v2/service-request-administrative-issues/{service}")]
  380:         public IssueResponse2 PostSuspendIssue2(string service)
  381:         {
  382:             bool isSuccessful, wasUpdated;
  383:             string message;
  384:  
  385:             ServiceRequestAdministrativeIssueAndService2Profile(service, out bool isWithinAllowedToBeProvisionedDomainList, out bool isProvisioned, out bool isPstnService, out bool isImsService, out bool serviceRequestServiceHasInternationalCalling, out bool isPendingSuspension, out bool isSuspended, out bool internationalCallingIsPendingSuspension, out bool internationalCallingIsSuspended);
  386:  
  387:             if (isWithinAllowedToBeProvisionedDomainList && isProvisioned)
  388:             {
  389:                 wasUpdated = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Update2(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.ProgrammedAccounting, service, out Ia.Cl.Models.Result result);
  390:  
  391:                 ServiceRequestAdministrativeIssueAndService2Profile(service, out isWithinAllowedToBeProvisionedDomainList, out isProvisioned, out isPstnService, out isImsService, out serviceRequestServiceHasInternationalCalling, out isPendingSuspension, out isSuspended, out internationalCallingIsPendingSuspension, out internationalCallingIsSuspended);
  392:  
  393:                 isSuccessful = result.IsSuccessful;
  394:                 message = result.Message;
  395:             }
  396:             else
  397:             {
  398:                 isSuccessful = false;
  399:                 wasUpdated = false;
  400:                 message = "Error: Service " + service + " is not within allowed to be provisioned domain list, or is not provisioned.";
  401:             }
  402:  
  403:             var response = new IssueResponse2
  404:             {
  405:                 Service = service,
  406:                 IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
  407:                 IsProvisioned = isProvisioned,
  408:                 IsPstnService = isPstnService,
  409:                 IsImsService = isImsService,
  410:                 ServiceRequestServiceHasInternationalCalling = serviceRequestServiceHasInternationalCalling,
  411:                 IsPendingSuspension = isPendingSuspension,
  412:                 IsSuspended = isSuspended,
  413:                 InternationalCallingIsPendingSuspension = internationalCallingIsPendingSuspension,
  414:                 InternationalCallingIsSuspended = internationalCallingIsSuspended,
  415:                 IsSuccessful = isSuccessful,
  416:                 WasUpdated = wasUpdated,
  417:                 Message = message,
  418:             };
  419:  
  420:             return response;
  421:         }
  422:  
  423:         ////////////////////////////////////////////////////////////////////////////
  424:  
  425:         /// <summary>
  426:         /// Post (suspend) a service international calling into the Service Request Administrative Issues table
  427:         /// </summary>
  428:         [HttpPost]
  429:         [Route("api/v2/service-request-administrative-issues/{service}/international-calling")]
  430:         public IssueResponse2 PostSuspendInternationalCallingIssue(string service)
  431:         {
  432:             bool isSuccessful, wasUpdated;
  433:             string message;
  434:  
  435:             ServiceRequestAdministrativeIssueAndService2Profile(service, out bool isWithinAllowedToBeProvisionedDomainList, out bool isProvisioned, out bool isPstnService, out bool isImsService, out bool serviceRequestServiceHasInternationalCalling, out bool isPendingSuspension, out bool isSuspended, out bool internationalCallingIsPendingSuspension, out bool internationalCallingIsSuspended);
  436:  
  437:             if (isWithinAllowedToBeProvisionedDomainList && isProvisioned)
  438:             {
  439:                 if (!isPendingSuspension && !isSuspended)
  440:                 {
  441:                     if (serviceRequestServiceHasInternationalCalling)
  442:                     {
  443:                         wasUpdated = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Update2(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.ProgrammedInternationalCalling, service, out Ia.Cl.Models.Result result);
  444:  
  445:                         ServiceRequestAdministrativeIssueAndService2Profile(service, out isWithinAllowedToBeProvisionedDomainList, out isProvisioned, out isPstnService, out isImsService, out serviceRequestServiceHasInternationalCalling, out isPendingSuspension, out isSuspended, out internationalCallingIsPendingSuspension, out internationalCallingIsSuspended);
  446:  
  447:                         isSuccessful = result.IsSuccessful;
  448:                         message = result.Message;
  449:                     }
  450:                     else
  451:                     {
  452:                         isSuccessful = false;
  453:                         wasUpdated = false;
  454:                         message = "Error: Service " + service + " service request service's does not have international calling.";
  455:                     }
  456:                 }
  457:                 else
  458:                 {
  459:                     isSuccessful = false;
  460:                     wasUpdated = false;
  461:                     message = "Error: Service " + service + " is pending suspension or is suspended.";
  462:                 }
  463:             }
  464:             else
  465:             {
  466:                 isSuccessful = false;
  467:                 wasUpdated = false;
  468:                 message = "Error: Service " + service + " is not within allowed to be provisioned domain list, or is not provisioned.";
  469:             }
  470:  
  471:             var response = new IssueResponse2
  472:             {
  473:                 Service = service,
  474:                 IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
  475:                 IsProvisioned = isProvisioned,
  476:                 IsPstnService = isPstnService,
  477:                 IsImsService = isImsService,
  478:                 ServiceRequestServiceHasInternationalCalling = serviceRequestServiceHasInternationalCalling,
  479:                 IsPendingSuspension = isPendingSuspension,
  480:                 IsSuspended = isSuspended,
  481:                 InternationalCallingIsPendingSuspension = internationalCallingIsPendingSuspension,
  482:                 InternationalCallingIsSuspended = internationalCallingIsSuspended,
  483:                 IsSuccessful = isSuccessful,
  484:                 WasUpdated = wasUpdated,
  485:                 Message = message,
  486:             };
  487:  
  488:             return response;
  489:         }
  490:  
  491:         ////////////////////////////////////////////////////////////////////////////
  492:  
  493:         /// <summary>
  494:         /// Read Service Request Administrative Issue for a service
  495:         /// </summary>
  496:         [HttpGet]
  497:         [Route("api/v2/service-request-administrative-issues/{service}")]
  498:         public IssueResponse2 ReadIssue2(string service)
  499:         {
  500:             bool isSuccessful, wasUpdated;
  501:             string message;
  502:  
  503:             ServiceRequestAdministrativeIssueAndService2Profile(service, out bool isWithinAllowedToBeProvisionedDomainList, out bool isProvisioned, out bool isPstnService, out bool isImsService, out bool serviceRequestServiceHasInternationalCalling, out bool isPendingSuspension, out bool isSuspended, out bool internationalCallingIsPendingSuspension, out bool internationalCallingIsSuspended);
  504:  
  505:             isSuccessful = true;
  506:             wasUpdated = false;
  507:             message = string.Empty;
  508:  
  509:             var response = new IssueResponse2
  510:             {
  511:                 Service = service,
  512:                 IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
  513:                 IsProvisioned = isProvisioned,
  514:                 IsPstnService = isPstnService,
  515:                 IsImsService = isImsService,
  516:                 ServiceRequestServiceHasInternationalCalling = serviceRequestServiceHasInternationalCalling,
  517:                 IsPendingSuspension = isPendingSuspension,
  518:                 IsSuspended = isSuspended,
  519:                 InternationalCallingIsPendingSuspension = internationalCallingIsPendingSuspension,
  520:                 InternationalCallingIsSuspended = internationalCallingIsSuspended,
  521:                 IsSuccessful = isSuccessful,
  522:                 WasUpdated = wasUpdated,
  523:                 Message = message,
  524:             };
  525:  
  526:             return response;
  527:         }
  528:  
  529:         ////////////////////////////////////////////////////////////////////////////
  530:  
  531:         /// <summary>
  532:         /// Delete (release) a service from Service Request Administrative Issues table
  533:         /// </summary>
  534:         [HttpDelete]
  535:         [Route("api/v2/service-request-administrative-issues/{service}")]
  536:         public IssueResponse2 DeleteReleaseIssue2(string service)
  537:         {
  538:             bool isSuccessful, wasUpdated;
  539:             string message;
  540:  
  541:             ServiceRequestAdministrativeIssueAndService2Profile(service, out bool isWithinAllowedToBeProvisionedDomainList, out bool isProvisioned, out bool isPstnService, out bool isImsService, out bool serviceRequestServiceHasInternationalCalling, out bool isPendingSuspension, out bool isSuspended, out bool internationalCallingIsPendingSuspension, out bool internationalCallingIsSuspended);
  542:  
  543:             if (isWithinAllowedToBeProvisionedDomainList && isProvisioned)
  544:             {
  545:                 wasUpdated = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Update2(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.None, service, out Ia.Cl.Models.Result result);
  546:  
  547:                 ServiceRequestAdministrativeIssueAndService2Profile(service, out isWithinAllowedToBeProvisionedDomainList, out isProvisioned, out isPstnService, out isImsService, out serviceRequestServiceHasInternationalCalling, out isPendingSuspension, out isSuspended, out internationalCallingIsPendingSuspension, out internationalCallingIsSuspended);
  548:  
  549:                 isSuccessful = result.IsSuccessful;
  550:                 message = result.Message;
  551:             }
  552:             else
  553:             {
  554:                 isSuccessful = false;
  555:                 wasUpdated = false;
  556:                 message = "Error: Service " + service + " is not within allowed to be provisioned domain list, or is not provisioned.";
  557:             }
  558:  
  559:             var response = new IssueResponse2
  560:             {
  561:                 Service = service,
  562:                 IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
  563:                 IsProvisioned = isProvisioned,
  564:                 IsPstnService = isPstnService,
  565:                 IsImsService = isImsService,
  566:                 ServiceRequestServiceHasInternationalCalling = serviceRequestServiceHasInternationalCalling,
  567:                 IsPendingSuspension = isPendingSuspension,
  568:                 IsSuspended = isSuspended,
  569:                 InternationalCallingIsPendingSuspension = internationalCallingIsPendingSuspension,
  570:                 InternationalCallingIsSuspended = internationalCallingIsSuspended,
  571:                 IsSuccessful = isSuccessful,
  572:                 WasUpdated = wasUpdated,
  573:                 Message = message,
  574:             };
  575:  
  576:             return response;
  577:         }
  578:  
  579:         ////////////////////////////////////////////////////////////////////////////
  580:  
  581:         /// <summary>
  582:         /// Delete (release) a service international calling from Service Request Administrative Issues table
  583:         /// </summary>
  584:         [HttpDelete]
  585:         [Route("api/v2/service-request-administrative-issues/{service}/international-calling")]
  586:         public IssueResponse2 DeleteReleaseInternationalCallingIssue(string service)
  587:         {
  588:             bool isSuccessful, wasUpdated;
  589:             string message;
  590:  
  591:             ServiceRequestAdministrativeIssueAndService2Profile(service, out bool isWithinAllowedToBeProvisionedDomainList, out bool isProvisioned, out bool isPstnService, out bool isImsService, out bool serviceRequestServiceHasInternationalCalling, out bool isPendingSuspension, out bool isSuspended, out bool internationalCallingIsPendingSuspension, out bool internationalCallingIsSuspended);
  592:  
  593:             if (isWithinAllowedToBeProvisionedDomainList && isProvisioned)
  594:             {
  595:                 if (!isPendingSuspension && !isSuspended)
  596:                 {
  597:                     wasUpdated = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.Update2(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.None, service, out Ia.Cl.Models.Result result);
  598:  
  599:                     ServiceRequestAdministrativeIssueAndService2Profile(service, out isWithinAllowedToBeProvisionedDomainList, out isProvisioned, out isPstnService, out isImsService, out serviceRequestServiceHasInternationalCalling, out isPendingSuspension, out isSuspended, out internationalCallingIsPendingSuspension, out internationalCallingIsSuspended);
  600:  
  601:                     isSuccessful = result.IsSuccessful;
  602:                     message = result.Message;
  603:                 }
  604:                 else
  605:                 {
  606:                     isSuccessful = false;
  607:                     wasUpdated = false;
  608:                     message = "Error: Service " + service + " is pending suspension or is suspended.";
  609:                 }
  610:             }
  611:             else
  612:             {
  613:                 isSuccessful = false;
  614:                 wasUpdated = false;
  615:                 message = "Error: Service " + service + " is not within allowed to be provisioned domain list, or is not provisioned.";
  616:             }
  617:  
  618:             var response = new IssueResponse2
  619:             {
  620:                 Service = service,
  621:                 IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
  622:                 IsProvisioned = isProvisioned,
  623:                 IsPstnService = isPstnService,
  624:                 IsImsService = isImsService,
  625:                 ServiceRequestServiceHasInternationalCalling = serviceRequestServiceHasInternationalCalling,
  626:                 IsPendingSuspension = isPendingSuspension,
  627:                 IsSuspended = isSuspended,
  628:                 InternationalCallingIsPendingSuspension = internationalCallingIsPendingSuspension,
  629:                 InternationalCallingIsSuspended = internationalCallingIsSuspended,
  630:                 IsSuccessful = isSuccessful,
  631:                 WasUpdated = wasUpdated,
  632:                 Message = message,
  633:             };
  634:  
  635:             return response;
  636:         }
  637:  
  638:         ////////////////////////////////////////////////////////////////////////////
  639:  
  640:         /// <summary>
  641:         ///
  642:         /// </summary>
  643:         private void ServiceRequestAdministrativeIssueAndService2Profile(string service, out bool isWithinAllowedToBeProvisionedDomainList, out bool isProvisioned, out bool isPstnService, out bool isImsService, out bool serviceRequestServiceHasInternationalCalling, out bool isPendingSuspension, out bool isSuspended, out bool internationalCallingIsPendingSuspension, out bool internationalCallingIsSuspended)
  644:         {
  645:             if (!string.IsNullOrEmpty(service))
  646:             {
  647:                 if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
  648:                 {
  649:                     isWithinAllowedToBeProvisionedDomainList = true;
  650:  
  651:                     isImsService = Ia.Ngn.Cl.Model.Data.Service2.IsImsService(service);
  652:  
  653:                     if (isImsService)
  654:                     {
  655:                         isPstnService = false;
  656:                         isProvisioned = true;
  657:                     }
  658:                     else
  659:                     {
  660:                         isPstnService = Ia.Ngn.Cl.Model.Data.Service2.IsPstnService(service);
  661:                         isProvisioned = isPstnService;
  662:                     }
  663:  
  664:                     if (isProvisioned)
  665:                     {
  666:                         serviceRequestServiceHasInternationalCalling = Ia.Ngn.Cl.Model.Data.ServiceRequestService.HasInternationalCalling(service);
  667:  
  668:                         isPendingSuspension = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.IsPendingIssue(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.ProgrammedAccounting, service);
  669:                         isSuspended = Ia.Ngn.Cl.Model.Data.Service2.IsSuspended(service);
  670:  
  671:                         internationalCallingIsPendingSuspension = Ia.Ngn.Cl.Model.Data.ServiceRequestAdministrativeIssue.IsPendingIssue(Ia.Ngn.Cl.Model.Business.ServiceRequestAdministrativeIssue.DisconnectionType.ProgrammedInternationalCalling, service);
  672:                         internationalCallingIsSuspended = !Ia.Ngn.Cl.Model.Data.Service2.HasInternationalCalling(service);
  673:                     }
  674:                     else
  675:                     {
  676:                         isImsService = false;
  677:                         serviceRequestServiceHasInternationalCalling = false;
  678:                         isPendingSuspension = false;
  679:                         isSuspended = false;
  680:                         internationalCallingIsPendingSuspension = false;
  681:                         internationalCallingIsSuspended = false;
  682:                     }
  683:                 }
  684:                 else
  685:                 {
  686:                     isWithinAllowedToBeProvisionedDomainList = false;
  687:                     isProvisioned = false;
  688:                     isPstnService = false;
  689:                     isImsService = false;
  690:                     serviceRequestServiceHasInternationalCalling = false;
  691:                     isPendingSuspension = false;
  692:                     isSuspended = false;
  693:                     internationalCallingIsPendingSuspension = false;
  694:                     internationalCallingIsSuspended = false;
  695:                 }
  696:             }
  697:             else
  698:             {
  699:                 isWithinAllowedToBeProvisionedDomainList = false;
  700:                 isProvisioned = false;
  701:                 isPstnService = false;
  702:                 isImsService = false;
  703:                 serviceRequestServiceHasInternationalCalling = false;
  704:                 isPendingSuspension = false;
  705:                 isSuspended = false;
  706:                 internationalCallingIsPendingSuspension = false;
  707:                 internationalCallingIsSuspended = false;
  708:             }
  709:         }
  710:  
  711:         ////////////////////////////////////////////////////////////////////////////
  712:         ////////////////////////////////////////////////////////////////////////////
  713:  
  714:         #endregion
  715:  
  716:         ////////////////////////////////////////////////////////////////////////////
  717:         ////////////////////////////////////////////////////////////////////////////
  718:     }
  719: }