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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Find

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

Find subscriber and network information support class for the Optical Fiber Network business model

   1:  using Microsoft.EntityFrameworkCore;
   2:  using System;
   3:  using System.Collections.Generic;
   4:  using System.Data;
   5:  using System.Linq;
   6:  using System.Text.RegularExpressions;
   7:  using System.Web;
   8:   
   9:  namespace Ia.Ngn.Cl.Model.Business.Maintenance
  10:  {
  11:      ////////////////////////////////////////////////////////////////////////////
  12:   
  13:      /// <summary publish="true">
  14:      /// Find subscriber and network information support class for the Optical Fiber Network business model
  15:      /// </summary>
  16:      /// 
  17:      /// <remarks> 
  18:      /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  19:      ///
  20:      /// 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
  21:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  22:      ///
  23:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  24:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  25:      /// 
  26:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  27:      /// 
  28:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  29:      /// </remarks> 
  30:      public class Find
  31:      {
  32:          public const string ServiceRequestCustomerIdInputTypeString = "serviceRequestCustomerId";
  33:          public const string PaciInputTypeString = "paci";
  34:   
  35:          ////////////////////////////////////////////////////////////////////////////
  36:   
  37:          /// <summary>
  38:          ///
  39:          /// </summary>
  40:          public Find() { }
  41:   
  42:          ////////////////////////////////////////////////////////////////////////////
  43:   
  44:          /// <summary>
  45:          ///
  46:          /// </summary>
  47:          public static string Url(string input)
  48:          {
  49:              return "~/maintenance/find.aspx?input=" + HttpUtility.UrlEncode(input);
  50:          }
  51:   
  52:          ////////////////////////////////////////////////////////////////////////////
  53:   
  54:          /// <summary>
  55:          ///
  56:          /// </summary>
  57:          public static void Search(Ia.Ngn.Cl.Model.Business.Administration.Framework framework, string rawInput, string inputType, out List<Ia.Ngn.Cl.Model.Ui.Service2> serviceList, out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList, out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList, out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList, out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList, out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList, out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList, out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList, out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList, out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList, out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList, out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList, out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList, out List<Ia.Ngn.Cl.Model.Ont> ontList, out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList, out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList, out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList, out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList, out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList, out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList, out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList, out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList, out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList, out List<Ia.Ngn.Cl.Model.Event> eventList, out List<Ia.Ngn.Cl.Model.Access> accessList, out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList, out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList, out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList, out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList, out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList, out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList, out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList, out List<Ia.Ngn.Cl.Model.Report> reportList, out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList, out Ia.Cl.Model.Result result)
  58:          {
  59:              var enqueueIntoMsmq = true;
  60:              var stopwatch = new Ia.Cl.Model.Stopwatch();
  61:   
  62:              Ia.Ngn.Cl.Model.Business.Maintenance.Find.Search(ref stopwatch, framework, enqueueIntoMsmq, rawInput, inputType, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
  63:          }
  64:   
  65:          ////////////////////////////////////////////////////////////////////////////
  66:   
  67:          /// <summary>
  68:          ///
  69:          /// </summary>
  70:          public static Ia.Cl.Model.Result TriggerSearchToRefreshAspNetAndDatabaseConnection(string input)
  71:          {
  72:              var enqueueIntoMsmq = false;
  73:              var inputType = string.Empty;
  74:              var stopwatch = new Ia.Cl.Model.Stopwatch();
  75:   
  76:              var staff = Ia.Ngn.Cl.Model.Business.Authority.SuperStaff;
  77:   
  78:              Ia.Ngn.Cl.Model.Business.Maintenance.Find.Search(ref stopwatch, staff.Framework, enqueueIntoMsmq, input, inputType, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out Ia.Cl.Model.Result result);
  79:   
  80:              return result;
  81:          }
  82:   
  83:          ////////////////////////////////////////////////////////////////////////////
  84:   
  85:          /// <summary>
  86:          ///
  87:          /// </summary>
  88:          public static void Search(ref Ia.Cl.Model.Stopwatch stopwatch,
  89:              Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
  90:              bool enqueueIntoMsmq,
  91:              string rawInput,
  92:              string inputType,
  93:              out List<Ia.Ngn.Cl.Model.Ui.Service2> serviceList,
  94:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
  95:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
  96:              out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
  97:              out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
  98:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
  99:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
 100:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
 101:              out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
 102:              out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
 103:              out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
 104:              out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
 105:              out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
 106:              out List<Ia.Ngn.Cl.Model.Ont> ontList,
 107:              out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
 108:              out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
 109:              out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
 110:              out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
 111:              out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
 112:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
 113:              out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 114:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 115:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
 116:              out List<Ia.Ngn.Cl.Model.Event> eventList,
 117:              out List<Ia.Ngn.Cl.Model.Access> accessList,
 118:              out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
 119:              out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
 120:              out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 121:              out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
 122:              out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
 123:              out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
 124:              out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
 125:              out List<Ia.Ngn.Cl.Model.Report> reportList,
 126:              out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
 127:              out Ia.Cl.Model.Result result)
 128:          {
 129:              bool inputIsValid;
 130:              string input;
 131:   
 132:              serviceList = null;
 133:              agcfGatewayRecordList = null;
 134:              agcfEndpointList = null;
 135:              mgwList = null;
 136:              asbrList = null;
 137:              subPartyList = null;
 138:              subscriberList = null;
 139:              huSbrList = null;
 140:              owsbrList = null;
 141:              seruattrList = null;
 142:              axeSubscriberList = null;
 143:              ewsdSubscriberList = null;
 144:              nddOntList = null;
 145:              ontList = null;
 146:              ontServiceVoipList = null;
 147:              ontOntPotsList = null;
 148:              emsDevList = null;
 149:              emsBoardList = null;
 150:              emsPortList = null;
 151:              emsOntList = null;
 152:              emsOntSipInfoList = null;
 153:              emsVoipPstnUserList = null;
 154:              emsVagList = null;
 155:              eventList = null;
 156:              accessList = null;
 157:              serviceRequestServiceList = null;
 158:              serviceRequestList = null;
 159:              serviceRequestAdministrativeIssueList = null;
 160:              serviceRequestHistoryList = null;
 161:              serviceRequestTypeList = null;
 162:              serviceRequestOntList = null;
 163:              serviceRequestOntDetailList = null;
 164:              reportList = null;
 165:              reportHistoryList = null;
 166:   
 167:              result = new Ia.Cl.Model.Result();
 168:   
 169:              if (!string.IsNullOrEmpty(rawInput))
 170:              {
 171:                  rawInput = rawInput.Trim();
 172:                  input = rawInput.ToLower();
 173:   
 174:                  if (input.Length > 0)
 175:                  {
 176:                      inputIsValid = true;
 177:   
 178:                      if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinKuwaitLandlineDomainList(input) || Ia.Ngn.Cl.Model.Business.NumberFormatConverter.IsMatchToServiceWithCountryCode(input) || Ia.Ngn.Cl.Model.Business.NumberFormatConverter.IsMatchToImpuSipDomain(input))
 179:                      {
 180:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.Number(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 181:                      }
 182:                      else if (Ia.Ngn.Cl.Model.Business.Access.AccessNameIsInAValidFormat(input))
 183:                      {
 184:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.OntName(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 185:                      }
 186:                      else if (Ia.Ngn.Cl.Model.Business.Access.PonNameIsInValidFormat(input))
 187:                      {
 188:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.PonName(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 189:                      }
 190:                      else if (Regex.IsMatch(input, @"^[a-zA-Z]{3}\-\d{1,2}\-\d{1,2}\-\d{1,2}\-\d{1,2}$")) // MsanDevLicPosition() regex must come before OntPosition()
 191:                      {
 192:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.MsanDevLicPosition(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 193:                      }
 194:                      else if (Regex.IsMatch(input, @"^[\w\d\-]+\-\d{1,2}\-\d{1,2}\-\d{1,2}$"))
 195:                      {
 196:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.OntPosition(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 197:                      }
 198:                      else if (Ia.Ngn.Cl.Model.Business.Huawei.Ont.IsValidSerialNumber(input) || Ia.Ngn.Cl.Model.Business.Nokia.Ont.IsValidSerialNumber(input)) // Huawei or Nokia ONT serial
 199:                      {
 200:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.Serial(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 201:                      }
 202:                      else if (Ia.Ngn.Cl.Model.Business.Access.PaciIsInAValidFormat(input))
 203:                      {
 204:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.Paci(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 205:   
 206:                          /*
 207:                          if (!string.IsNullOrEmpty(inputType) && inputType == Ia.Ngn.Cl.Model.Business.Maintenance.Find.PaciInputTypeString)
 208:                          {
 209:                              Ia.Ngn.Cl.Model.Business.Maintenance.Find.Paci(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 210:                          }
 211:                          */
 212:                      }
 213:                      else if (Ia.Cl.Model.Default.IsValidIpv4(input))
 214:                      {
 215:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.Ip(rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 216:                      }
 217:                      else if (Regex.IsMatch(input, @"^[a-zA-Z]{3},\d{1,3}$"))
 218:                      {
 219:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.AreaBlock(rawInput, out accessList, out result);
 220:                      }
 221:                      else if (Regex.IsMatch(input, @"^[a-zA-Z]{3},\d{0,3},\d{0,3},\d{0,3},\d{0,3}$"))
 222:                      {
 223:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.Address(rawInput, out accessList, out result);
 224:                      }
 225:                      else if (Regex.IsMatch(input, @"^\d{1,7}$"))
 226:                      {
 227:                          if (!string.IsNullOrEmpty(inputType) && inputType == Ia.Ngn.Cl.Model.Business.Maintenance.Find.ServiceRequestCustomerIdInputTypeString)
 228:                          {
 229:                              // max value of ServiceRequest CustomerId is a 7 digit number
 230:   
 231:                              Ia.Ngn.Cl.Model.Business.Maintenance.Find.CustomerId(rawInput, out serviceRequestList, out result);
 232:                          }
 233:                          else Ia.Ngn.Cl.Model.Business.Maintenance.Find.GatewayId(ref stopwatch, framework, enqueueIntoMsmq, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 234:                      }
 235:                      else if (Regex.IsMatch(input, @"^[\p{L}|\s]+$")) // "\p{L}" matches unicode characters
 236:                      {
 237:                          Ia.Ngn.Cl.Model.Business.Maintenance.Find.CustomerName(rawInput, out serviceRequestList, out result);
 238:                      }
 239:                      else inputIsValid = false;
 240:   
 241:                      stopwatch.RecordElapsedMilliseconds("N");
 242:   
 243:                      if (inputIsValid)
 244:                      {
 245:                          if (
 246:                          (serviceList == null || serviceList != null && serviceList.Count == 0) &&
 247:                          (agcfGatewayRecordList == null || agcfGatewayRecordList != null && agcfGatewayRecordList.Count == 0) &&
 248:                          (agcfEndpointList == null || agcfEndpointList != null && agcfEndpointList.Count == 0) &&
 249:                          (mgwList == null || mgwList != null && mgwList.Count == 0) &&
 250:                          (asbrList == null || asbrList != null && asbrList.Count == 0) &&
 251:                          (subPartyList == null || subPartyList != null && subPartyList.Count == 0) &&
 252:                          (subscriberList == null || subscriberList != null && subscriberList.Count == 0) &&
 253:                          (huSbrList == null || huSbrList != null && huSbrList.Count == 0) &&
 254:                          (owsbrList == null || owsbrList != null && owsbrList.Count == 0) &&
 255:                          (seruattrList == null || seruattrList != null && seruattrList.Count == 0) &&
 256:                          (axeSubscriberList == null || axeSubscriberList != null && axeSubscriberList.Count == 0) &&
 257:                          (ewsdSubscriberList == null || ewsdSubscriberList != null && ewsdSubscriberList.Count == 0) &&
 258:                          (nddOntList == null || nddOntList != null && nddOntList.Count == 0) &&
 259:                          (ontList == null || ontList != null && ontList.Count == 0) &&
 260:                          (ontServiceVoipList == null || ontServiceVoipList != null && ontServiceVoipList.Count == 0) &&
 261:                          (ontOntPotsList == null || ontOntPotsList != null && ontOntPotsList.Count == 0) &&
 262:                          (emsDevList == null || emsDevList != null && emsDevList.Count == 0) &&
 263:                          (emsBoardList == null || emsBoardList != null && emsBoardList.Count == 0) &&
 264:                          (emsPortList == null || emsPortList != null && emsPortList.Count == 0) &&
 265:                          (emsOntList == null || emsOntList != null && emsOntList.Count == 0) &&
 266:                          (emsOntSipInfoList == null || emsOntSipInfoList != null && emsOntSipInfoList.Count == 0) &&
 267:                          (emsVoipPstnUserList == null || emsVoipPstnUserList != null && emsVoipPstnUserList.Count == 0) &&
 268:                          (emsVagList == null || emsVagList != null && emsVagList.Count == 0) &&
 269:                          (eventList == null || eventList != null && eventList.Count == 0) &&
 270:                          (accessList == null || accessList != null && accessList.Count == 0) &&
 271:                          (serviceRequestServiceList == null || serviceRequestServiceList != null && serviceRequestServiceList.Count == 0) &&
 272:                          (serviceRequestList == null || serviceRequestList != null && serviceRequestList.Count == 0) &&
 273:                          (serviceRequestAdministrativeIssueList == null || serviceRequestAdministrativeIssueList != null && serviceRequestAdministrativeIssueList.Count == 0) &&
 274:                          (serviceRequestHistoryList == null || serviceRequestHistoryList != null && serviceRequestHistoryList.Count == 0) &&
 275:                          (serviceRequestTypeList == null || serviceRequestTypeList != null && serviceRequestTypeList.Count == 0) &&
 276:                          (serviceRequestOntList == null || serviceRequestOntList != null && serviceRequestOntList.Count == 0) &&
 277:                          (serviceRequestOntDetailList == null || serviceRequestOntDetailList != null && serviceRequestOntDetailList.Count == 0) &&
 278:                          (reportList == null || reportList != null && reportList.Count == 0) &&
 279:                          (reportHistoryList == null || reportHistoryList != null && reportHistoryList.Count == 0))
 280:                          {
 281:                              if (result.IsSuccessful)
 282:                              {
 283:                                  result.AddWarning("No data records were found for \"" + rawInput + "\" (لا توجد معلومات عن القيمة المعطاة). ");
 284:                              }
 285:                              else { };// result.AddError(result.Error);
 286:                          }
 287:                          else
 288:                          {
 289:                              /*
 290:                              if (result.IsSuccessful)
 291:                              {
 292:                                  if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
 293:                              }
 294:                              //else result.AddError(result.Error);
 295:                              */
 296:                          }
 297:                      }
 298:                      else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
 299:                  }
 300:                  else result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
 301:              }
 302:              else result.AddError("Input is null or empty (لم يتم إدخال أي شيء). ");
 303:          }
 304:   
 305:          ////////////////////////////////////////////////////////////////////////////
 306:          ////////////////////////////////////////////////////////////////////////////
 307:   
 308:   
 309:   
 310:   
 311:   
 312:   
 313:          ////////////////////////////////////////////////////////////////////////////
 314:          ////////////////////////////////////////////////////////////////////////////
 315:   
 316:          /// <summary>
 317:          ///
 318:          /// </summary>
 319:          public static void GatewayId(ref Ia.Cl.Model.Stopwatch stopwatch,
 320:              Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
 321:              bool enqueueIntoMsmq,
 322:              string input,
 323:              out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
 324:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 325:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 326:              out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
 327:              out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
 328:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
 329:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
 330:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
 331:              out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
 332:              out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
 333:              out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
 334:              out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
 335:              out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
 336:              out List<Ia.Ngn.Cl.Model.Ont> ontList,
 337:              out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
 338:              out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
 339:              out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
 340:              out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
 341:              out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
 342:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
 343:              out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 344:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 345:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
 346:              out List<Ia.Ngn.Cl.Model.Event> eventList,
 347:              out List<Ia.Ngn.Cl.Model.Access> accessList,
 348:              out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
 349:              out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
 350:              out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 351:              out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
 352:              out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
 353:              out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
 354:              out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
 355:              out List<Ia.Ngn.Cl.Model.Report> reportList,
 356:              out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
 357:              out Ia.Cl.Model.Result result)
 358:          {
 359:              int gatewayId;
 360:   
 361:              var gatewayIdList = new List<int>();
 362:   
 363:              result = new Ia.Cl.Model.Result();
 364:   
 365:              service2List = null;
 366:              agcfGatewayRecordList = null;
 367:              agcfEndpointList = null;
 368:              mgwList = null;
 369:              asbrList = null;
 370:              subPartyList = null;
 371:              subscriberList = null;
 372:              huSbrList = null;
 373:              owsbrList = null;
 374:              seruattrList = null;
 375:              axeSubscriberList = null;
 376:              ewsdSubscriberList = null;
 377:              nddOntList = null;
 378:              ontList = null;
 379:              ontServiceVoipList = null;
 380:              ontOntPotsList = null;
 381:              emsDevList = null;
 382:              emsBoardList = null;
 383:              emsPortList = null;
 384:              emsOntList = null;
 385:              emsOntSipInfoList = null;
 386:              emsVoipPstnUserList = null;
 387:              emsVagList = null;
 388:              eventList = null;
 389:              accessList = null;
 390:              serviceRequestServiceList = null;
 391:              serviceRequestList = null;
 392:              serviceRequestAdministrativeIssueList = null;
 393:              serviceRequestHistoryList = null;
 394:              serviceRequestTypeList = null;
 395:              serviceRequestOntList = null;
 396:              serviceRequestOntDetailList = null;
 397:              reportList = null;
 398:              reportHistoryList = null;
 399:   
 400:              gatewayId = int.Parse(input);
 401:   
 402:              if (gatewayId >= Ia.Ngn.Cl.Model.Business.Nokia.Ims.FirstGatewayId && gatewayId <= Ia.Ngn.Cl.Model.Business.Nokia.Ims.LastGatewayId)
 403:              {
 404:                  gatewayIdList.Add(gatewayId);
 405:   
 406:                  Ia.Ngn.Cl.Model.Business.Maintenance.Find.GatewayIdTwo(ref stopwatch, framework, enqueueIntoMsmq, gatewayIdList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 407:              }
 408:              else
 409:              {
 410:                  result.AddError("The gatewayId \"" + input + "\" is not within the allowed gatewayId range (الرقم لا ينتمي للمجال). ");
 411:              }
 412:          }
 413:   
 414:          ////////////////////////////////////////////////////////////////////////////
 415:   
 416:          /// <summary>
 417:          ///
 418:          /// </summary>
 419:          private static void GatewayIdTwo(ref Ia.Cl.Model.Stopwatch stopwatch,
 420:              Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
 421:              bool enqueueIntoMsmq,
 422:              List<int> gatewayIdList,
 423:              out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
 424:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 425:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 426:              out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
 427:              out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
 428:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
 429:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
 430:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
 431:              out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
 432:              out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
 433:              out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
 434:              out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
 435:              out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
 436:              out List<Ia.Ngn.Cl.Model.Ont> ontList,
 437:              out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
 438:              out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
 439:              out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
 440:              out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
 441:              out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
 442:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
 443:              out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 444:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 445:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
 446:              out List<Ia.Ngn.Cl.Model.Event> eventList,
 447:              out List<Ia.Ngn.Cl.Model.Access> accessList,
 448:              out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
 449:              out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
 450:              out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 451:              out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
 452:              out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
 453:              out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
 454:              out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
 455:              out List<Ia.Ngn.Cl.Model.Report> reportList,
 456:              out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
 457:              out Ia.Cl.Model.Result result)
 458:          {
 459:              var serviceList = new List<string>();
 460:   
 461:              service2List = null;
 462:              agcfGatewayRecordList = null;
 463:              agcfEndpointList = null;
 464:              mgwList = null;
 465:              asbrList = null;
 466:              subPartyList = null;
 467:              subscriberList = null;
 468:              huSbrList = null;
 469:              owsbrList = null;
 470:              seruattrList = null;
 471:              axeSubscriberList = null;
 472:              ewsdSubscriberList = null;
 473:              nddOntList = null;
 474:              ontList = null;
 475:              ontServiceVoipList = null;
 476:              ontOntPotsList = null;
 477:              emsDevList = null;
 478:              emsBoardList = null;
 479:              emsPortList = null;
 480:              emsOntList = null;
 481:              emsOntSipInfoList = null;
 482:              emsVoipPstnUserList = null;
 483:              emsVagList = null;
 484:              eventList = null;
 485:              accessList = null;
 486:              serviceRequestServiceList = null;
 487:              serviceRequestList = null;
 488:              serviceRequestAdministrativeIssueList = null;
 489:              serviceRequestHistoryList = null;
 490:              serviceRequestTypeList = null;
 491:              serviceRequestOntList = null;
 492:              serviceRequestOntDetailList = null;
 493:              reportList = null;
 494:              reportHistoryList = null;
 495:   
 496:              var serviceLongList = new List<long>();
 497:              var numberList = new List<int>();
 498:              var partyIdList = new List<string>();
 499:              var prividUserList = new List<string>();
 500:              var impuSipDomainList = new List<string>();
 501:              var sipUserNameList = new List<string>();
 502:              var serviceWithCountryCodeList = new List<string>();
 503:              var serviceIdList = new List<string>();
 504:   
 505:              var subscriberIdList = new List<string>();
 506:              var subPartyIdList = new List<string>();
 507:              var agcfEndpointIdList = new List<string>();
 508:              var agcfGatewayRecordIdList = new List<int>();
 509:              var agcfGatewayRecordIpList = new List<string>();
 510:   
 511:              var asbrIdList = new List<string>();
 512:              var mgwIdList = new List<string>();
 513:   
 514:              var sbrImpuList = new List<string>();
 515:              var owsbrImpuList = new List<string>();
 516:   
 517:              var ontIdList = new List<string>();
 518:              var ontOntPotsIdList = new List<string>();
 519:              var ontServiceVoipIdList = new List<string>();
 520:              var ontServiceVoipIpList = new List<string>();
 521:   
 522:              var ipList = new List<string>();
 523:   
 524:              var emsDevIdList = new List<int>();
 525:              var emsBoardIdList = new List<string>();
 526:              var emsPortIdList = new List<string>();
 527:              var emsOntIdList = new List<string>();
 528:              var emsVoipPstnUserIdList = new List<string>();
 529:   
 530:              result = new Ia.Cl.Model.Result();
 531:   
 532:              // gateways belong to Nokia switch
 533:              var switchVendorList = new List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor>() { Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia };
 534:   
 535:              try
 536:              {
 537:                  if (switchVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia))
 538:                  {
 539:                      agcfGatewayRecordIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordIdListFromGatewayIdList(gatewayIdList);
 540:   
 541:                      agcfGatewayRecordIpList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordIpListFromIdList(agcfGatewayRecordIdList);
 542:                      ipList.AddRange(agcfGatewayRecordIpList);
 543:                      ipList = ipList.Distinct().ToList();
 544:   
 545:                      agcfEndpointIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfEndpointIdListFromAgcfGatewayRecordIdList(agcfGatewayRecordIdList);
 546:                      subPartyIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubPartyIdListFromAgcfEndpointIdList(agcfEndpointIdList);
 547:                      subscriberIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromSubPartyIdList(subPartyIdList);
 548:                      subPartyIdList = subscriberIdList;
 549:   
 550:                      var nddOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntIdListFromIpList(ipList);
 551:   
 552:                      var accessVendorList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorListByOntIdList(nddOntIdList);
 553:   
 554:                      if (accessVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia))
 555:                      {
 556:                          ontIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntIdListFromNddOntIdList(nddOntIdList);
 557:                          ontOntPotsIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntOntPotsIdListFromOntIdList(ontIdList);
 558:                          ontServiceVoipIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipsIdListFromOntIdList(ontIdList);
 559:                          ontServiceVoipIpList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipIpList(ontServiceVoipIdList);
 560:                          ipList.AddRange(ontServiceVoipIpList);
 561:                          ipList = ipList.Distinct().ToList();
 562:                      }
 563:   
 564:                      Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 565:   
 566:                      var serviceRequestServiceIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceIdListFromServiceIdList(serviceIdList);
 567:   
 568:                      var accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromServiceIdList(serviceIdList);
 569:                      accessIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
 570:                      accessIdList = accessIdList.Distinct().ToList();
 571:   
 572:                      //Ia.Ngn.Cl.Model.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(service2IdList, ref serviceList);
 573:                      Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 574:   
 575:                      var reportIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportIdListFromServiceList(serviceList);
 576:                      reportIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportIdListFromAccessIdList(accessIdList));
 577:                      reportIdList = reportIdList.Distinct().ToList();
 578:   
 579:                      var serviceRequestIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
 580:                      serviceRequestIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
 581:                      serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
 582:   
 583:                      var serviceRequestAdministrativeIssueIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestAdministrativeIssueIdListFromServiceIdList(serviceIdList);
 584:   
 585:                      var serviceRequestHistoryIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
 586:                      var serviceRequestTypeIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestTypeIdListFromServiceRequestIdList(serviceRequestIdList);
 587:                      var serviceRequestOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntIdListFromAccessIdList(accessIdList);
 588:   
 589:                      if (accessVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei))// || aServiceInServiceListIsWithinMsanDomainList)
 590:                      {
 591:                          emsOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntIdListFromNddOntIdList(nddOntIdList);
 592:   
 593:                          emsVoipPstnUserIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromEmsOntIdList(emsOntIdList);
 594:                          emsVoipPstnUserIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromServiceList(serviceList));
 595:                          emsVoipPstnUserIdList = emsVoipPstnUserIdList.Distinct().ToList();
 596:   
 597:                          emsPortIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortIdListFromEmsOntIdList(emsOntIdList);
 598:                          emsPortIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
 599:                          emsPortIdList = emsPortIdList.Distinct().ToList();
 600:   
 601:                          emsBoardIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardIdListFromEmsPortIdList(emsPortIdList);
 602:                          emsBoardIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardIdListFromAccessIdList(accessIdList));
 603:                          emsBoardIdList = emsBoardIdList.Distinct().ToList();
 604:   
 605:                          emsDevIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsBoardIdList(emsBoardIdList);
 606:                          emsDevIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromAccessIdList(accessIdList));
 607:                          //emsDevIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
 608:                          emsDevIdList = emsDevIdList.Distinct().ToList();
 609:   
 610:                          ipList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntIpListFromNddOntIdList(nddOntIdList));
 611:                          ipList = ipList.Distinct().ToList();
 612:                      }
 613:   
 614:   
 615:   
 616:   
 617:   
 618:                      Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 619:   
 620:                      var aServiceInServiceListIsWithinMsanDomainList = Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinMsanDomainList(serviceList);
 621:   
 622:                      var service2IdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.Service2IdListFromServiceIdList(serviceIdList);
 623:   
 624:                      /*
 625:                      if (switchVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei))
 626:                      {
 627:                          asbrIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AsbrIdListFromImpuSipDomainList(impuSipDomainList);
 628:                          mgwIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwIdListFromAsbrIdList(asbrIdList);
 629:  
 630:                          sbrImpuList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SbrImpuListFromImpuSipDomainList(impuSipDomainList);
 631:                          owsbrImpuList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OwSbrImpuListFromImpuSipDomainList(impuSipDomainList);
 632:  
 633:                          Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 634:                      }
 635:                      */
 636:   
 637:                      /////////////////////////////////
 638:   
 639:                      agcfGatewayRecordList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordList(agcfGatewayRecordIdList);
 640:                      agcfEndpointList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfEndpointList(agcfEndpointIdList);
 641:                      subPartyList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubPartyList(subPartyIdList);
 642:                      subscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberList(subscriberIdList);
 643:   
 644:                      mgwList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwList(mgwIdList);
 645:                      asbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AsbrList(asbrIdList);
 646:   
 647:                      huSbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.HuSbrList(sbrImpuList);
 648:                      owsbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OwsbrList(owsbrImpuList);
 649:   
 650:                      if (Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(serviceList))
 651:                      {
 652:                          seruattrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SeruattrListFromServiceIdList(serviceIdList);
 653:                      }
 654:   
 655:                      axeSubscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AxeSubscriberListFromServiceIdList(serviceIdList);
 656:                      ewsdSubscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EwsdSubscriberListFromServiceIdList(serviceIdList);
 657:   
 658:                      ontList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntList(ontIdList);
 659:                      ontOntPotsList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntOntPotsListFromOntOntPotsIdList(ontOntPotsIdList);
 660:                      ontServiceVoipList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipList(ontServiceVoipIdList);
 661:   
 662:                      emsDevList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevList(emsDevIdList);
 663:                      emsBoardList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardList(emsBoardIdList);
 664:                      emsPortList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortList(emsPortIdList);
 665:                      emsOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntList(emsOntIdList);
 666:   
 667:                      emsOntSipInfoList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdListAndService(emsOntIdList, sipUserNameList);
 668:                      emsVoipPstnUserList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserList(emsVoipPstnUserIdList);
 669:                      emsVagList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
 670:   
 671:                      service2List = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceList(service2IdList);
 672:   
 673:                      nddOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntList(nddOntIdList);
 674:   
 675:                      accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessList(accessIdList);
 676:   
 677:                      serviceRequestServiceList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceList(serviceRequestServiceIdList);
 678:   
 679:                      serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestList(serviceRequestIdList);
 680:                      serviceRequestAdministrativeIssueList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestAdministrativeIssueList(serviceRequestAdministrativeIssueIdList);
 681:                      serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
 682:                      serviceRequestTypeList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestTypeList(serviceRequestTypeIdList);
 683:                      serviceRequestOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntList(serviceRequestOntIdList);
 684:                      serviceRequestOntDetailList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntDetailFromServieListList(serviceList); // more appropaite to display records related to the service numbers only
 685:   
 686:                      reportList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportList(reportIdList);
 687:   
 688:                      if (enqueueIntoMsmq)
 689:                      {
 690:                          foreach (var service in serviceList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadService, service);
 691:                          foreach (var nddOnt in nddOntList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadAccess, nddOnt.Access.Name);
 692:                          foreach (var gatewayId in gatewayIdList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadGateway, gatewayId);
 693:                      }
 694:                  }
 695:              }
 696:              catch (Exception ex)
 697:              {
 698:                  result.AddError("Exception: Retrieval error of data for \"" + string.Join(", ", serviceList) + "\": " + ex.ToString());
 699:              }
 700:          }
 701:   
 702:          ////////////////////////////////////////////////////////////////////////////
 703:   
 704:          /// <summary>
 705:          ///
 706:          /// </summary>
 707:          public static void Ip(string rawInput,
 708:              out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
 709:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 710:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 711:              out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
 712:              out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
 713:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
 714:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
 715:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
 716:              out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
 717:              out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
 718:              out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
 719:              out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
 720:              out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
 721:              out List<Ia.Ngn.Cl.Model.Ont> ontList,
 722:              out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
 723:              out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
 724:              out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
 725:              out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
 726:              out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
 727:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
 728:              out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 729:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 730:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
 731:              out List<Ia.Ngn.Cl.Model.Event> eventList,
 732:              out List<Ia.Ngn.Cl.Model.Access> accessList,
 733:              out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
 734:              out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
 735:              out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 736:              out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
 737:              out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
 738:              out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
 739:              out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
 740:              out List<Ia.Ngn.Cl.Model.Report> reportList,
 741:              out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
 742:              out Ia.Cl.Model.Result result)
 743:          {
 744:              string input;
 745:              List<int> agcfGatewayRecordIdList, numberList;
 746:              List<long> serviceLongList;
 747:              List<string> serviceList, serviceIdList, service2IdList, impuSipDomainList, sipUserNameList, serviceWithCountryCodeList, accessIdList, ontIdList, partyIdList, prividUserList, serviceRequestAdministrativeIssueIdList;
 748:   
 749:              service2IdList = new List<string>();
 750:              accessIdList = new List<string>();
 751:              ontIdList = new List<string>();
 752:              agcfGatewayRecordIdList = new List<int>();
 753:              numberList = new List<int>();
 754:              serviceLongList = new List<long>();
 755:              impuSipDomainList = new List<string>();
 756:              sipUserNameList = new List<string>();
 757:              serviceWithCountryCodeList = new List<string>();
 758:              serviceList = new List<string>();
 759:              partyIdList = new List<string>();
 760:              prividUserList = new List<string>();
 761:              serviceList = new List<string>();
 762:              serviceIdList = new List<string>();
 763:              serviceRequestAdministrativeIssueIdList = new List<string>();
 764:   
 765:              result = new Ia.Cl.Model.Result();
 766:   
 767:              service2List = null;
 768:   
 769:              agcfGatewayRecordList = null;
 770:              agcfEndpointList = null;
 771:              mgwList = null;
 772:              asbrList = null;
 773:              subPartyList = null;
 774:              subscriberList = null;
 775:   
 776:              huSbrList = null;
 777:              owsbrList = null;
 778:              seruattrList = null;
 779:              axeSubscriberList = null;
 780:              ewsdSubscriberList = null;
 781:   
 782:              nddOntList = null;
 783:              ontList = null;
 784:              ontServiceVoipList = null;
 785:              ontOntPotsList = null;
 786:              emsDevList = null;
 787:              emsBoardList = null;
 788:              emsPortList = null;
 789:              emsOntList = null;
 790:              emsOntSipInfoList = null;
 791:              emsVoipPstnUserList = null;
 792:              emsVagList = null;
 793:              eventList = null;
 794:              accessList = null;
 795:              serviceRequestServiceList = null;
 796:              serviceRequestList = null;
 797:              serviceRequestAdministrativeIssueList = null;
 798:              serviceRequestHistoryList = null;
 799:              serviceRequestTypeList = null;
 800:              serviceRequestOntList = null;
 801:              serviceRequestOntDetailList = null;
 802:              reportList = null;
 803:              reportHistoryList = null;
 804:   
 805:              input = rawInput.ToLower();
 806:   
 807:              // var ip = mgw.EID.Replace(":" + Ia.Ngn.Cl.Model.Business.Huawei.SoftX.RemotePort, "");
 808:   
 809:              try
 810:              {
 811:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 812:                  {
 813:                      ontServiceVoipList = (from ov in db.OntServiceVoips where ov.Ip == input select ov).Include(u => u.Ont).ToList();
 814:                      foreach (var v in ontServiceVoipList) ontIdList.Add(v.Ont.Id);
 815:                      ontIdList = ontIdList.Distinct().ToList();
 816:   
 817:                      agcfGatewayRecordList = (from gr in db.AgcfGatewayRecords
 818:                                               where gr.IP1 == input || gr.IP2 == input
 819:                                               select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
 820:                                               {
 821:                                                   Id = gr.Id,
 822:                                                   GwId = gr.GwId,
 823:                                                   GwUserId = gr.GwUserId,
 824:                                                   GwDomain = gr.GwDomain,
 825:                                                   GwName = gr.GwName,
 826:                                                   IP1 = gr.IP1,
 827:                                                   IP2 = gr.IP2,
 828:                                                   MateExternalIPAddr = gr.MateExternalIPAddr,
 829:                                                   IsPrimary = gr.IsPrimary,
 830:                                                   Created = gr.Created,
 831:                                                   Updated = gr.Updated
 832:                                               }).ToList();
 833:                      foreach (var v in agcfGatewayRecordList) agcfGatewayRecordIdList.Add(v.Id);
 834:                      agcfGatewayRecordIdList = agcfGatewayRecordIdList.Distinct().ToList();
 835:   
 836:                      agcfEndpointList = (from e in db.AgcfEndpoints
 837:                                          where agcfGatewayRecordIdList.Contains(e.AgcfGatewayRecord.Id)
 838:                                          select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint()
 839:                                          {
 840:                                              Id = e.Id,
 841:                                              PrividUser = e.PrividUser,
 842:                                              GwId = e.GwId,
 843:                                              Dn = e.Dn,
 844:                                              FlatTermID = e.FlatTermID,
 845:                                              CallHoldLc = e.CallHoldLc,
 846:                                              CallWaitingLc = e.CallWaitingLc,
 847:                                              CallToggleLc = e.CallToggleLc,
 848:                                              ThreeWayCallLc = e.ThreeWayCallLc,
 849:                                              McidLc = e.McidLc,
 850:                                              Password = e.Password,
 851:                                              CallTransferLc = e.CallTransferLc,
 852:                                              Created = e.Created,
 853:                                              Updated = e.Updated
 854:                                          }).ToList();
 855:   
 856:                      // mgwList =
 857:   
 858:                      // asbrList =
 859:   
 860:                      // agcfEndpointIdList = (from ep in agcfEndpointList select ep.Id).ToList();
 861:   
 862:                      Ia.Ngn.Cl.Model.Data.Maintenance.Find.CollectServiceListFromAgcfEndpointList(agcfEndpointList, ref serviceList);
 863:                      Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 864:   
 865:                      service2List = (from s in db.Service2
 866:                                      where serviceList.Contains(s.Service) && s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService
 867:                                      select new Ia.Ngn.Cl.Model.Ui.Service2()
 868:                                      {
 869:                                          AbbriviatedCalling = s.AbbriviatedCalling,
 870:                                          AlarmCall = s.AlarmCall,
 871:                                          CallBarring = s.CallBarring,
 872:                                          CallerId = s.CallerId,
 873:                                          CallForwarding = s.CallForwarding,
 874:                                          CallWaiting = s.CallWaiting,
 875:                                          ConferenceCall = s.ConferenceCall,
 876:                                          Created = s.Created,
 877:                                          InternationalCalling = s.InternationalCalling,
 878:                                          InternationalCallingUserControlled = s.InternationalCallingUserControlled,
 879:                                          Port = s.Port,
 880:                                          Pin = s.Pin,
 881:                                          Service = s.Service,
 882:                                          ServiceType = s.ServiceType,
 883:                                          ServiceSuspension = s.ServiceSuspension,
 884:                                          ServiceTypeName = s.ServiceType.ToString(),
 885:                                          Updated = s.Updated,
 886:                                          AccessId = s.Access.Id
 887:                                      }).ToList();
 888:   
 889:                      serviceRequestServiceList = (from srs in db.ServiceRequestServices
 890:                                                   where accessIdList.Contains(srs.Access.Id)
 891:                                                   select new Ia.Ngn.Cl.Model.Ui.ServiceRequestService()
 892:                                                   {
 893:                                                       Id = srs.Id,
 894:                                                       AbbriviatedCalling = srs.AbbriviatedCalling,
 895:                                                       Access = srs.Access,
 896:                                                       AlarmCall = srs.AlarmCall,
 897:                                                       CallBarring = srs.CallBarring,
 898:                                                       CallerId = srs.CallerId,
 899:                                                       CallForwarding = srs.CallForwarding,
 900:                                                       CallWaiting = srs.CallWaiting,
 901:                                                       ConferenceCall = srs.ConferenceCall,
 902:                                                       Created = srs.Created,
 903:                                                       InternationalCalling = srs.InternationalCalling,
 904:                                                       InternationalCallingUserControlled = srs.InternationalCallingUserControlled,
 905:                                                       LastRequestDateTime = srs.LastRequestDateTime,
 906:                                                       Provisioned = srs.Provisioned,
 907:                                                       Service = srs.Service,
 908:                                                       Serial = srs.Serial,
 909:                                                       ServiceType = srs.ServiceType,
 910:                                                       //ServiceSuspension = srs.ServiceSuspension,
 911:                                                       Type = srs.Type,
 912:                                                       Updated = srs.Updated
 913:                                                   }).ToList();
 914:   
 915:                      subscriberList = (from s in db.Subscribers
 916:                                        where partyIdList.Contains(s.PartyId)
 917:                                        select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
 918:                                        {
 919:                                            Id = s.Id,
 920:                                            AlternateOtasRealm = s.AlternateOtasRealm,
 921:                                            PartyId = s.PartyId,
 922:                                            AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
 923:                                            AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
 924:                                            CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
 925:                                            CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
 926:                                            CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
 927:                                            ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
 928:                                            InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
 929:                                            InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
 930:                                            //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
 931:                                            Created = s.Created,
 932:                                            Updated = s.Updated,
 933:                                        }).ToList();
 934:   
 935:                      subPartyList = (from sp in db.SubParties
 936:                                      where partyIdList.Contains(sp.PartyId)
 937:                                      select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
 938:                                      {
 939:                                          Id = sp.Id,
 940:                                          PartyId = sp.PartyId,
 941:                                          PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
 942:                                          DisplayName = sp.DisplayName,
 943:                                          Category = sp.Category,
 944:                                          AssocOtasRealm = sp.AssocOtasRealm,
 945:                                          ServiceSuspension = sp.ServiceSuspension,
 946:                                          Created = sp.Created,
 947:                                          Updated = sp.Updated
 948:                                      }).ToList();
 949:   
 950:   
 951:                      huSbrList = (from h in db.HuSbrs
 952:                                   where impuSipDomainList.Contains(h.IMPU)
 953:                                   select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
 954:                                   {
 955:                                       COP = h.COP,
 956:                                       CSC = h.CSC,
 957:                                       Id = h.Id,
 958:                                       IMPU = h.IMPU,
 959:                                       ITT = h.ITT,
 960:                                       LP = h.LP,
 961:                                       NS3PTY = h.NS3PTY,
 962:                                       NSABRC = h.NSABRC,
 963:                                       NSCBA = h.NSCBA,
 964:                                       NSCFU = h.NSCFU,
 965:                                       NSCLIP = h.NSCLIP,
 966:                                       NSCW = h.NSCW,
 967:                                       NSFAX = h.NSFAX,
 968:                                       NSHOLD = h.NSHOLD,
 969:                                       NSNPTY = h.NSNPTY,
 970:                                       NSWAKE_UP = h.NSWAKE_UP,
 971:                                       Created = h.Created,
 972:                                       Updated = h.Updated
 973:                                   }).ToList();
 974:   
 975:                      owsbrList = (from o in db.Owsbrs where impuSipDomainList.Contains(o.IMPU) select o).ToList();
 976:   
 977:                      serviceRequestList = (from sr in db.ServiceRequests where numberList.Contains(sr.Number) select sr).ToList();
 978:                      serviceRequestAdministrativeIssueList = (from srai in db.ServiceRequestAdministrativeIssues where serviceIdList.Contains(srai.Service) select srai).ToList();
 979:   
 980:                      //serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestList(serviceRequestHistoryIdList);
 981:                      serviceRequestTypeList = (from srt in db.ServiceRequestTypes
 982:                                                join sr in db.ServiceRequests on srt.ServiceRequest equals sr
 983:                                                where numberList.Contains(sr.Number)
 984:                                                select srt).ToList();
 985:   
 986:                      reportList = (from r in db.Reports where service2IdList.Contains(r.Service) select r).Include(u => u.ReportHistories).ToList();
 987:   
 988:   
 989:                      nddOntList = new List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont>();
 990:                      nddOntList.Add(Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntByIp(input));
 991:   
 992:                      foreach (var v in nddOntList) ontIdList.Add(v.Id);
 993:                      ontIdList = ontIdList.Distinct().ToList();
 994:   
 995:                      ontList = (from o in db.Onts where ontIdList.Contains(o.Id) select o).ToList();
 996:                      foreach (var v in ontList) ontIdList.Add(v.Id);
 997:                      ontIdList = ontIdList.Distinct().ToList();
 998:   
 999:                      foreach (var v in ontList) if (v.Access != null) accessIdList.Add(v.Access.Id);
                    accessIdList = accessIdList.Distinct().ToList();
 
                    ontOntPotsList = (from op in db.OntOntPots where ontIdList.Contains(op.Ont.Id) select op).ToList();
                    ontServiceVoipList = (from ov in db.OntServiceVoips where ontIdList.Contains(ov.Ont.Id) select ov).ToList();
 
                    foreach (var v in nddOntList)
                    {
                        //eventSystemList.Add(v.Pon.PonGroup.Olt.AmsName);
                        //eventAidOntList.Add("ONT-1-1-" + v.Card + "-" + v.Port + "-" + v.Number);
                        //eventAidOntVoipList.Add("ONTVOIP-1-1-" + v.Card + "-" + v.Port + "-1");
 
                        //foreach (var w in ontOntPotsList) eventAidOntPotsList.Add("ONTPOTS-1-1-" + v.Card + "-" + v.Port + "-" + w.Card + "-" + w.Port);
                    }
 
                    //eventSystemList = eventSystemList.Distinct().ToList();
                    //eventAidOntList = eventAidOntList.Distinct().ToList();
                    //eventAidOntVoipList = eventAidOntVoipList.Distinct().ToList();
 
                    /*
                    eventList = (from e in db.Events where eventSystemList.Contains(e.System) where eventAidOntList.Contains(e.Aid) select e)
                                .Union(from e in db.Events where eventSystemList.Contains(e.System) where eventAidOntList.Contains(e.Aid) where eventAidOntVoipList.Contains(e.Aid) select e)
                                .Union(from e in db.Events where eventSystemList.Contains(e.System) where eventAidOntList.Contains(e.Aid) where eventAidOntPotsList.Contains(e.Aid) select e)
                                .ToList();
                                */
 
                    accessList = (from a in db.Accesses where accessIdList.Contains(a.Id) select a).ToList();
                }
            }
            catch (Exception ex)
            {
                result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void Number(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string input,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            string service;
 
            var serviceList = new List<string>();
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            stopwatch.RecordElapsedMilliseconds("A");
 
            service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(input.ToLower());
 
            if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
            {
                if (Ia.Ngn.Cl.Model.Business.Authority.NumberIsWithinFrameworkSiteDomainList(framework, service))
                {
                    serviceList.Add(service);
 
                    Ia.Ngn.Cl.Model.Business.Maintenance.Find.NumberTwo(ref stopwatch, framework, enqueueIntoMsmq, serviceList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
                }
                else
                {
                    result.AddError("Number " + service + " is not in staff site domain (الرقم لا ينتمي لنطاقات المستخدم). ");
                }
            }
            else
            {
                result.AddError("The number \"" + input + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
            }
 
            stopwatch.RecordElapsedMilliseconds("M");
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void Number(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            List<string> inputList,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            string service;
 
            var serviceList = new List<string>();
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            foreach (var input in inputList)
            {
                service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(input.ToLower());
 
                if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
                {
                    if (Ia.Ngn.Cl.Model.Business.Authority.NumberIsWithinFrameworkSiteDomainList(framework, service))
                    {
                        serviceList.Add(service);
 
                        Ia.Ngn.Cl.Model.Business.Maintenance.Find.NumberTwo(ref stopwatch, framework, enqueueIntoMsmq, serviceList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
                    }
                    else
                    {
                        result.AddError("Number " + service + " is not in staff site domain (الرقم لا ينتمي لنطاقات المستخدم). ");
                    }
                }
                else
                {
                    result.AddError("The number \"" + input + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
                }
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        private static void NumberTwo(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            List<string> serviceList,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            var serviceLongList = new List<long>();
            var numberList = new List<int>();
            var partyIdList = new List<string>();
            var prividUserList = new List<string>();
            var impuSipDomainList = new List<string>();
            var sipUserNameList = new List<string>();
            var serviceWithCountryCodeList = new List<string>();
            var serviceIdList = new List<string>();
 
            var subscriberIdList = new List<string>();
            var subPartyIdList = new List<string>();
            var agcfEndpointIdList = new List<string>();
            var agcfGatewayRecordIdList = new List<int>();
            var gatewayIdList = new List<int>();
 
            var asbrIdList = new List<string>();
            var mgwIdList = new List<string>();
 
            var sbrImpuList = new List<string>();
            var owsbrImpuList = new List<string>();
 
            var ontIdList = new List<string>();
            var ontOntPotsIdList = new List<string>();
            var ontServiceVoipIdList = new List<string>();
            var ontServiceVoipIpList = new List<string>();
 
            var ipList = new List<string>();
 
            var emsDevIdList = new List<int>();
            var emsBoardIdList = new List<string>();
            var emsPortIdList = new List<string>();
            var emsOntIdList = new List<string>();
            var emsVoipPstnUserIdList = new List<string>();
 
            result = new Ia.Cl.Model.Result();
 
            stopwatch.RecordElapsedMilliseconds("B");
 
            var switchVendorList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorListByServiceList(serviceList);
 
            var serviceListHasANumberThatIsWithinMsanDomainList = Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinMsanDomainList(serviceList);
 
            try
            {
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 
                // Who uses serviceId: AxeSubscribers,EwsdSubscriners,Seruattrs,Service2,ServiceExemptions,ServiceRequestServices: Id is seviceId
                stopwatch.RecordElapsedMilliseconds("C0");
 
                var service2IdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.Service2IdListFromServiceIdList(serviceIdList);
                stopwatch.RecordElapsedMilliseconds("C1");
 
                if (switchVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia))
                {
                    subscriberIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
                    stopwatch.RecordElapsedMilliseconds("C2");
 
                    subPartyIdList = subscriberIdList; // Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
 
                    agcfEndpointIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfEndpointIdListFromPrividUserList(prividUserList);
                    stopwatch.RecordElapsedMilliseconds("C4");
 
                    agcfGatewayRecordIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordIdListFromAgcfEndpointIdList(agcfEndpointIdList);
                    stopwatch.RecordElapsedMilliseconds("C5");
 
                    gatewayIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.GatewayIdFromAgcfGatewayRecordIdListList(agcfGatewayRecordIdList);
 
                    Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
                }
 
                if (switchVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei))
                {
                    if (Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinSoftXServer(serviceList))
                    {
                        asbrIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AsbrIdListFromImpuSipDomainList(impuSipDomainList);
                        mgwIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwIdListFromAsbrIdList(asbrIdList);
                    }
 
                    sbrImpuList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SbrImpuListFromImpuSipDomainList(impuSipDomainList);
                    owsbrImpuList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OwSbrImpuListFromImpuSipDomainList(impuSipDomainList);
 
                    Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
                }
 
                stopwatch.RecordElapsedMilliseconds("D");
 
                var serviceRequestServiceIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceIdListFromServiceIdList(serviceIdList);
                stopwatch.RecordElapsedMilliseconds("D2");
 
                var accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromServiceIdList(serviceIdList);
                accessIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
                accessIdList = accessIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("D3");
 
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(service2IdList, ref serviceList);
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 
                stopwatch.RecordElapsedMilliseconds("D4");
 
                var reportIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportIdListFromServiceList(serviceList);
                stopwatch.RecordElapsedMilliseconds("D41");
 
                reportIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportIdListFromAccessIdList(accessIdList));
                stopwatch.RecordElapsedMilliseconds("D42");
 
                reportIdList = reportIdList.Distinct().ToList();
 
                var serviceRequestIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
                stopwatch.RecordElapsedMilliseconds("D52");
 
                serviceRequestIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
                stopwatch.RecordElapsedMilliseconds("D53");
 
                serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("D6");
 
                var serviceRequestAdministrativeIssueIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestAdministrativeIssueIdListFromServiceIdList(serviceIdList);
                stopwatch.RecordElapsedMilliseconds("D7");
 
                var serviceRequestHistoryIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
                stopwatch.RecordElapsedMilliseconds("D71");
 
                var serviceRequestTypeIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestTypeIdListFromServiceRequestIdList(serviceRequestIdList);
                stopwatch.RecordElapsedMilliseconds("D72");
 
                var serviceRequestOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntIdListFromAccessIdList(accessIdList);
                stopwatch.RecordElapsedMilliseconds("D73");
 
                stopwatch.RecordElapsedMilliseconds("D8");
 
                var nddOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntIdListFromAccessIdList(accessIdList);
                nddOntIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntIdListFromEmsOntSipInfoListAndEmsVoipPstnUserListByServiceList(serviceList));
                nddOntIdList = nddOntIdList.Distinct().ToList();
 
                var accessVendorList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorListByOntIdList(nddOntIdList);
 
                stopwatch.RecordElapsedMilliseconds("E");
 
                if (accessVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia))
                {
                    ontIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntIdListFromNddOntIdList(nddOntIdList);
                    ontOntPotsIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntOntPotsIdListFromOntIdList(ontIdList);
                    ontServiceVoipIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipsIdListFromOntIdList(ontIdList);
                    ontServiceVoipIpList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipIpList(ontServiceVoipIdList);
 
                    stopwatch.RecordElapsedMilliseconds("E1");
 
                    ipList = ontServiceVoipIpList;
                }
 
                if (accessVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei) || serviceListHasANumberThatIsWithinMsanDomainList)
                {
                    emsOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntIdListFromNddOntIdList(nddOntIdList);
                    stopwatch.RecordElapsedMilliseconds("E2");
 
                    emsVoipPstnUserIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromServiceList(serviceList);
                    //emsVoipPstnUserIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromEmsOntIdList(emsOntIdList)); will display other numbers, which is not appropriate
                    //emsVoipPstnUserIdList = emsVoipPstnUserIdList.Distinct().ToList();
                    stopwatch.RecordElapsedMilliseconds("E3");
 
                    emsPortIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortIdListFromEmsOntIdList(emsOntIdList);
                    emsPortIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
                    emsPortIdList = emsPortIdList.Distinct().ToList();
                    stopwatch.RecordElapsedMilliseconds("E4");
 
                    emsBoardIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardIdListFromEmsPortIdList(emsPortIdList);
                    emsBoardIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardIdListFromAccessIdList(accessIdList));
                    emsBoardIdList = emsBoardIdList.Distinct().ToList();
                    stopwatch.RecordElapsedMilliseconds("E5");
 
                    emsDevIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsBoardIdList(emsBoardIdList);
                    emsDevIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromAccessIdList(accessIdList));
                    //emsDevIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
                    emsDevIdList = emsDevIdList.Distinct().ToList();
                    stopwatch.RecordElapsedMilliseconds("E6");
 
                    ipList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntIpListFromNddOntIdList(nddOntIdList));
                    ipList = ipList.Distinct().ToList();
                }
 
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 
                stopwatch.RecordElapsedMilliseconds("F");
 
                /////////////////////////////////
 
                agcfGatewayRecordList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordList(agcfGatewayRecordIdList);
                agcfEndpointList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfEndpointList(agcfEndpointIdList);
                subPartyList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubPartyList(subPartyIdList);
                subscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberList(subscriberIdList);
 
                mgwList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwList(mgwIdList);
                asbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AsbrList(asbrIdList);
 
                huSbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.HuSbrList(sbrImpuList);
                owsbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OwsbrList(owsbrImpuList);
 
                stopwatch.RecordElapsedMilliseconds("G");
 
                if (Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(serviceList))
                {
                    seruattrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SeruattrListFromServiceIdList(serviceIdList);
                }
 
                axeSubscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AxeSubscriberListFromServiceIdList(serviceIdList);
                ewsdSubscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EwsdSubscriberListFromServiceIdList(serviceIdList);
 
                ontList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntList(ontIdList);
                ontOntPotsList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntOntPotsListFromOntOntPotsIdList(ontOntPotsIdList);
                ontServiceVoipList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipList(ontServiceVoipIdList);
 
                emsDevList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevList(emsDevIdList);
                emsBoardList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardList(emsBoardIdList);
                emsPortList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortList(emsPortIdList);
                emsOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntList(emsOntIdList);
 
                emsOntSipInfoList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdListAndService(emsOntIdList, sipUserNameList);
                emsVoipPstnUserList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserList(emsVoipPstnUserIdList);
                emsVagList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
 
                stopwatch.RecordElapsedMilliseconds("H");
 
                service2List = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceList(service2IdList);
                stopwatch.RecordElapsedMilliseconds("H2");
 
                nddOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntList(nddOntIdList);
                stopwatch.RecordElapsedMilliseconds("H3");
 
                accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessList(accessIdList);
                stopwatch.RecordElapsedMilliseconds("H4");
 
                serviceRequestServiceList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceList(serviceRequestServiceIdList);
                stopwatch.RecordElapsedMilliseconds("H5");
 
                serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestList(serviceRequestIdList);
                stopwatch.RecordElapsedMilliseconds("H51");
 
                serviceRequestAdministrativeIssueList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestAdministrativeIssueList(serviceRequestAdministrativeIssueIdList);
                stopwatch.RecordElapsedMilliseconds("H52");
 
                serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
                stopwatch.RecordElapsedMilliseconds("H53");
 
                serviceRequestTypeList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestTypeList(serviceRequestTypeIdList);
                stopwatch.RecordElapsedMilliseconds("H54");
 
                serviceRequestOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntList(serviceRequestOntIdList);
                stopwatch.RecordElapsedMilliseconds("H55");
 
                serviceRequestOntDetailList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntDetailFromServieListList(serviceList); // more appropriate to display records related to the service numbers only
                stopwatch.RecordElapsedMilliseconds("H66");
 
                reportList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportList(reportIdList);
                stopwatch.RecordElapsedMilliseconds("H7");
 
                if (enqueueIntoMsmq)
                {
                    foreach (var service in serviceList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadService, service);
                    foreach (var nddOnt in nddOntList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadAccess, nddOnt.Access.Name);
                    foreach (var gatewayId in gatewayIdList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadGateway, gatewayId);
                }
 
                stopwatch.RecordElapsedMilliseconds("I");
            }
            catch (Exception ex)
            {
                stopwatch.RecordElapsedMilliseconds("Exception");
 
                result.AddError("Exception: Retrieval error of data for \"" + string.Join(", ", serviceList) + "\": " + ex.ToString());
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void OntName(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string rawInput,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            string input;
            Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
            List<string> accessIdList, nddOntIdList, ipList;
 
            ipList = new List<string>();
            nddOntIdList = new List<string>();
            accessIdList = new List<string>();
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            input = rawInput.ToUpper();
 
            stopwatch.RecordElapsedMilliseconds("A");
 
            nddOnt = Ia.Ngn.Cl.Model.Business.Default.NddOntUsingExtractedAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(input);
 
            if (nddOnt != null)
            {
                if (Ia.Ngn.Cl.Model.Business.Authority.AccessNameIsWithinFrameworkSiteAreaSymbolList(framework, nddOnt.Access.Name))
                {
                    try
                    {
                        ipList.Add(nddOnt.Ip);
 
                        accessIdList.Add(nddOnt.Access.Id);
 
                        nddOntIdList.Add(nddOnt.Id);
 
                        stopwatch.RecordElapsedMilliseconds("B");
 
                        OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMsmq, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList);
                    }
                    catch (Exception ex)
                    {
                        result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
                    }
                }
                else
                {
                    result.AddError("Access " + nddOnt.Access.Name + " is not in staff site access list (رقم الجهاز لا ينتمي لمقسم المستخدم). ");
                }
            }
            else
            {
                result.AddError("The ONT \"" + rawInput + "\" does not belong to the network (الجهاز لا ينتمي للشبكة). ");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void PonName(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string rawInput,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            int oltId, ponNumber;
            string input, ponName;
            Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pon nddPon;
            List<string> accessIdList, nddOntIdList, ipList;
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            input = rawInput.ToUpper();
 
            ponName = Ia.Ngn.Cl.Model.Business.Default.ExtractPonNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(input);
 
            nddPon = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PonList where p.Name == ponName select p).SingleOrDefault();
 
            if (nddPon != null)
            {
                oltId = nddPon.PonGroup.Olt.Id;
                ponNumber = nddPon.Number;
 
                try
                {
                    ipList = new List<string>(); // pass empty
 
                    accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdList(oltId, ponNumber);
 
                    nddOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntIdList(oltId, ponNumber);
 
                    OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMsmq, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList);
                }
                catch (Exception ex)
                {
                    result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
                }
            }
            else
            {
                result.AddError("The PON \"" + rawInput + "\" had a null values. ");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void OntPosition(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string rawInput,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            int oltId, ponNumber, ontInternalNumber;
            string input;
            Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
            List<string> accessIdList, nddOntIdList, ipList;
 
            ipList = new List<string>();
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            input = rawInput.ToUpper();
 
            nddOnt = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntByPosition(input);
 
            if (nddOnt != null)
            {
                oltId = nddOnt.Pon.PonGroup.Olt.Id;
                ponNumber = nddOnt.Pon.Number;
                ontInternalNumber = nddOnt.InternalNumber;
 
                try
                {
                    ipList.Add(nddOnt.Ip);
 
                    accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdList(oltId, ponNumber, ontInternalNumber);
 
                    nddOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntIdList(oltId, ponNumber, ontInternalNumber);
 
                    OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMsmq, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList);
                }
                catch (Exception ex)
                {
                    result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
                }
            }
            else
            {
                result.AddError("The ONT position \"" + rawInput + "\" was not found in the network. ");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void MsanDevLicPosition(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string input,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            string service;
 
            var serviceList = new List<string>();
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            stopwatch.RecordElapsedMilliseconds("A");
 
            var lic = Ia.Ngn.Cl.Model.Business.Huawei.Dev.MsanDev.Lic.Parse(input);
 
            if (lic != null)
            {
                service = lic.Service;
 
                if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
                {
                    if (Ia.Ngn.Cl.Model.Business.Authority.NumberIsWithinFrameworkSiteDomainList(framework, service))
                    {
                        serviceList.Add(service);
 
                        Ia.Ngn.Cl.Model.Business.Maintenance.Find.NumberTwo(ref stopwatch, framework, enqueueIntoMsmq, serviceList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
                    }
                    else
                    {
                        result.AddError("Number " + service + " is not in staff site domain (الرقم لا ينتمي لنطاقات المستخدم). ");
                    }
                }
                else
                {
                    result.AddError("The number \"" + input + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
                }
 
                stopwatch.RecordElapsedMilliseconds("M");
            }
            else
            {
                result.AddError("The LIC \"" + input + "\" is empty or does not belong to the network (رقم الربط شاغر أو لا ينتمي للشبكة).");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void Serial(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string rawInput,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            string input;
            Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor accessVendor;
            List<string> accessIdList, nddOntIdList, ipList;
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            input = rawInput;
 
            if (Ia.Ngn.Cl.Model.Business.Nokia.Ont.IsValidSerialNumber(input))
            {
                accessVendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia;
 
                accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromOntSerial(input.ToUpper());
            }
            else if (Ia.Ngn.Cl.Model.Business.Huawei.Ont.IsValidSerialNumber(input))
            {
                accessVendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei;
 
                accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromEmsOntSerial(input.ToUpper());
            }
            else
            {
                accessVendor = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Undefined;
 
                accessIdList = new List<string>();
            }
 
            if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia || accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
            {
                if (accessIdList.Count > 0)
                {
                    nddOntIdList = new List<string>();
                    ipList = new List<string>();
 
                    try
                    {
                        OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMsmq, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList);
                    }
                    catch (Exception ex)
                    {
                        result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
                    }
                }
                else
                {
                    result.AddError("Did not find any accesses with serial number " + input.ToUpper() + " (لا يوجد جهاز برقم تسلسل). ");
                }
            }
            else
            {
                result.AddError("Access vendor is undefined (مزود الجهاز غير معرف). ");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void Paci(ref Ia.Cl.Model.Stopwatch stopwatch,
            Ia.Ngn.Cl.Model.Business.Administration.Framework framework,
            bool enqueueIntoMsmq,
            string rawInput,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> eventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
            out Ia.Cl.Model.Result result)
        {
            string input;
            List<string> accessIdList, nddOntIdList, ipList;
 
            result = new Ia.Cl.Model.Result();
 
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            eventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            input = rawInput.ToLower();
 
            if (int.TryParse(input, out int paci))
            {
                accessIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessIdListFromPaci(paci);
 
                if (accessIdList.Count > 0)
                {
                    nddOntIdList = new List<string>();
                    ipList = new List<string>();
 
                    try
                    {
                        OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMsmq, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out seruattrList, out axeSubscriberList, out ewsdSubscriberList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsDevList, out emsBoardList, out emsPortList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out emsVagList, out eventList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList);
                    }
                    catch (Exception ex)
                    {
                        result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
                    }
                }
                else result.AddError("Did not find any accesses with PACI number " + input.ToUpper() + " (لا يوجد أي جهاز بالرقم المدني). ");
            }
            else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void OntNameOrPonNameOrPositionOrSerialOrPaci(ref Ia.Cl.Model.Stopwatch stopwatch,
            bool enqueueIntoMsmq,
            List<string> nddOntIdList,
            List<string> accessIdList,
            List<string> ipList,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
            out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
            out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
            out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
            out List<Ia.Ngn.Cl.Model.Ont> ontList,
            out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
            out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
            out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
            out List<Ia.Ngn.Cl.Model.Event> amsEventList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
            out List<Ia.Ngn.Cl.Model.Report> reportList,
            out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList)
        {
            service2List = null;
            agcfGatewayRecordList = null;
            agcfEndpointList = null;
            mgwList = null;
            asbrList = null;
            subPartyList = null;
            subscriberList = null;
            huSbrList = null;
            owsbrList = null;
            seruattrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            nddOntList = null;
            ontList = null;
            ontServiceVoipList = null;
            ontOntPotsList = null;
            emsDevList = null;
            emsBoardList = null;
            emsPortList = null;
            emsOntList = null;
            emsOntSipInfoList = null;
            emsVoipPstnUserList = null;
            emsVagList = null;
            amsEventList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestTypeList = null;
            serviceRequestOntList = null;
            serviceRequestOntDetailList = null;
            reportList = null;
            reportHistoryList = null;
 
            var serviceList = new List<string>();
            var serviceLongList = new List<long>();
            var numberList = new List<int>();
            var partyIdList = new List<string>();
            var prividUserList = new List<string>();
            var impuSipDomainList = new List<string>();
            var sipUserNameList = new List<string>();
            var serviceWithCountryCodeList = new List<string>();
            var serviceIdList = new List<string>();
 
            var subscriberIdList = new List<string>();
            var subPartyIdList = new List<string>();
            var agcfEndpointIdList = new List<string>();
            var agcfGatewayRecordIdList = new List<int>();
            var gatewayIdList = new List<int>();
 
            var asbrIdList = new List<string>();
            var mgwIdList = new List<string>();
 
            var sbrImpuList = new List<string>();
            var owsbrImpuList = new List<string>();
 
            var ontIdList = new List<string>();
            var ontOntPotsIdList = new List<string>();
            var ontServiceVoipIdList = new List<string>();
            var ontServiceVoipIpList = new List<string>();
 
            var emsDevIdList = new List<int>();
            var emsBoardIdList = new List<string>();
            var emsPortIdList = new List<string>();
            var emsOntIdList = new List<string>();
            var emsVoipPstnUserIdList = new List<string>();
 
            stopwatch.RecordElapsedMilliseconds("C");
 
            nddOntIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntIdListFromAccessIdList(accessIdList));
            nddOntIdList = nddOntIdList.Distinct().ToList();
 
            var accessVendorList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorListByOntIdList(nddOntIdList);
            var switchVendorList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorListByOntIdList(nddOntIdList);
 
            stopwatch.RecordElapsedMilliseconds("D");
 
            var service2IdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceIdListFromAccessIdList(accessIdList);
 
            stopwatch.RecordElapsedMilliseconds("E");
 
            Ia.Ngn.Cl.Model.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(service2IdList, ref serviceList);
            Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 
 
            stopwatch.RecordElapsedMilliseconds("F");
 
            if (accessVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia))
            {
                ontIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntIdListFromNddOntIdList(nddOntIdList);
                ontOntPotsIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntOntPotsIdListFromOntIdList(ontIdList);
                ontServiceVoipIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipsIdListFromOntIdList(ontIdList);
                ontServiceVoipIpList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipIpList(ontServiceVoipIdList);
                //amsEventIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EventIdListFromNddOntIdList(nddOntIdList, 10);
 
                ipList.AddRange(ontServiceVoipIpList);
                ipList = ipList.Distinct().ToList();
            }
 
            stopwatch.RecordElapsedMilliseconds("G");
 
            var serviceListHasANumberThatIsWithinMsanDomainList = Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinMsanDomainList(serviceList);
 
            if (accessVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei) || serviceListHasANumberThatIsWithinMsanDomainList)
            {
                emsOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntIdListFromNddOntIdList(nddOntIdList);
 
                stopwatch.RecordElapsedMilliseconds("H");
 
                emsVoipPstnUserIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromEmsOntIdList(emsOntIdList);
                emsVoipPstnUserIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromServiceList(serviceList));
                emsVoipPstnUserIdList = emsVoipPstnUserIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("I");
 
                emsPortIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortIdListFromEmsOntIdList(emsOntIdList);
                emsPortIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
                emsPortIdList = emsPortIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("J");
 
                emsBoardIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardIdListFromEmsPortIdList(emsPortIdList);
                emsBoardIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardIdListFromAccessIdList(accessIdList));
                emsBoardIdList = emsBoardIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("K");
 
                emsDevIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsBoardIdList(emsBoardIdList);
                emsDevIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromAccessIdList(accessIdList));
                //emsDevIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
                emsDevIdList = emsDevIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("L");
 
                ipList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntIpListFromNddOntIdList(nddOntIdList));
                ipList = ipList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("M");
 
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.CollectServiceListFromEmsOntSipInfoListAndEmsVoipPstnUserListByEmsOntIdList(emsOntIdList, ref serviceList);
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
            }
 
            stopwatch.RecordElapsedMilliseconds("N");
 
            if (switchVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia))
            {
                subscriberIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
                subPartyIdList = subscriberIdList; // Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
                agcfEndpointIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfEndpointIdListFromPrividUserList(prividUserList);
 
                stopwatch.RecordElapsedMilliseconds("O");
 
                agcfGatewayRecordIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordIdListFromAgcfEndpointIdList(agcfEndpointIdList);
                agcfGatewayRecordIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordIdListFromIpList(ipList));
                agcfGatewayRecordIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordIdListFromNddOntIdList(nddOntIdList));
                agcfGatewayRecordIdList = agcfGatewayRecordIdList.Distinct().ToList();
 
                stopwatch.RecordElapsedMilliseconds("O4");
 
                gatewayIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.GatewayIdFromAgcfGatewayRecordIdListList(agcfGatewayRecordIdList);
 
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
            }
 
            stopwatch.RecordElapsedMilliseconds("P");
 
            var serviceRequestServiceIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceIdListFromAccessIdList(accessIdList);
 
            stopwatch.RecordElapsedMilliseconds("Q");
 
            Ia.Ngn.Cl.Model.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(serviceRequestServiceIdList, ref serviceList);
            Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 
            stopwatch.RecordElapsedMilliseconds("R");
 
            serviceRequestServiceIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceIdListFromServiceIdList(serviceIdList));
            serviceRequestServiceIdList = serviceRequestServiceIdList.Distinct().ToList();
 
            stopwatch.RecordElapsedMilliseconds("S");
 
            var reportIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportIdListFromServiceList(serviceList);
            reportIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportIdListFromAccessIdList(accessIdList));
 
            stopwatch.RecordElapsedMilliseconds("T");
 
            service2IdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.Service2IdListFromServiceIdList(serviceIdList));
            service2IdList = service2IdList.Distinct().ToList();
 
            stopwatch.RecordElapsedMilliseconds("U");
 
            var serviceRequestIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
            serviceRequestIdList.AddRange(Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
            serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
 
            stopwatch.RecordElapsedMilliseconds("V");
 
            var serviceRequestAdministrativeIssueIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestAdministrativeIssueIdListFromServiceIdList(serviceIdList);
 
            stopwatch.RecordElapsedMilliseconds("W");
 
            var serviceRequestHistoryIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
            var serviceRequestTypeIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestTypeIdListFromServiceRequestIdList(serviceRequestIdList);
            var serviceRequestOntIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntIdListFromAccessIdList(accessIdList);
 
            if (switchVendorList.Contains(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei))
            {
                if (Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinSoftXServer(serviceList))
                {
                    stopwatch.RecordElapsedMilliseconds("X");
                    asbrIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AsbrIdListFromImpuSipDomainList(impuSipDomainList);
                    stopwatch.RecordElapsedMilliseconds("X1");
                    mgwIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwIdListFromAsbrIdList(asbrIdList);
                    stopwatch.RecordElapsedMilliseconds("X2");
                    mgwIdList = mgwIdList.Union(Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwIdListFromIpList(ipList)).Distinct().ToList(); ;
                    stopwatch.RecordElapsedMilliseconds("X3");
                }
 
                sbrImpuList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SbrImpuListFromImpuSipDomainList(impuSipDomainList);
                owsbrImpuList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OwSbrImpuListFromImpuSipDomainList(impuSipDomainList);
 
                Ia.Ngn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
            }
 
            stopwatch.RecordElapsedMilliseconds("Z");
 
            /////////////////////////////////
 
            agcfGatewayRecordList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfGatewayRecordList(agcfGatewayRecordIdList);
            agcfEndpointList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AgcfEndpointList(agcfEndpointIdList);
            subPartyList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubPartyList(subPartyIdList);
            subscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SubscriberList(subscriberIdList);
 
            mgwList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.MgwList(mgwIdList);
            asbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AsbrList(asbrIdList);
 
            huSbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.HuSbrList(sbrImpuList);
            owsbrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OwsbrList(owsbrImpuList);
 
            if (Ia.Ngn.Cl.Model.Data.Service.ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(serviceList))
            {
                seruattrList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.SeruattrListFromServiceIdList(serviceIdList);
            }
 
            axeSubscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AxeSubscriberListFromServiceIdList(serviceIdList);
            ewsdSubscriberList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EwsdSubscriberListFromServiceIdList(serviceIdList);
 
            ontList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntList(ontIdList);
            ontOntPotsList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntOntPotsListFromOntOntPotsIdList(ontOntPotsIdList);
            ontServiceVoipList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.OntServiceVoipList(ontServiceVoipIdList);
            //amsEventList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EventList(amsEventIdList);
 
            emsDevList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsDevList(emsDevIdList);
            emsBoardList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsBoardList(emsBoardIdList);
            emsPortList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsPortList(emsPortIdList);
            emsOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntList(emsOntIdList);
 
            emsOntSipInfoList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdListAndService(emsOntIdList, sipUserNameList);
            emsVoipPstnUserList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserList(emsVoipPstnUserIdList);
            emsVagList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
 
            /*
            emsOntSipInfoList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdList(emsOntIdList);
            emsVoipPstnUserList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserListFromEmsOntIdList(emsOntIdList);
            emsVagList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
            */
 
            service2List = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceList(service2IdList);
 
            nddOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.NddOntList(nddOntIdList);
            accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessList(accessIdList);
 
            serviceRequestServiceList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestServiceList(serviceRequestServiceIdList);
 
            serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestList(serviceRequestIdList);
            serviceRequestAdministrativeIssueList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestAdministrativeIssueList(serviceRequestAdministrativeIssueIdList);
            serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
            serviceRequestTypeList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestTypeList(serviceRequestTypeIdList);
            serviceRequestOntList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntList(serviceRequestOntIdList);
            serviceRequestOntDetailList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestOntDetailList(serviceRequestOntIdList);
 
            stopwatch.RecordElapsedMilliseconds("ZA");
 
            reportList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ReportList(reportIdList);
 
            if (enqueueIntoMsmq)
            {
                foreach (var v in serviceList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadService, v);
                foreach (var v in nddOntList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadAccess, v.Access.Name);
                foreach (var v in gatewayIdList) Ia.Ngn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(Ia.Ngn.Cl.Model.Business.Msmq.Application.OfnApplication, Ia.Ngn.Cl.Model.Business.Msmq.Process.ReadGateway, v);
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void MigrationReview(Ia.Ngn.Cl.Model.Business.Administration.Framework framework, string accessName, List<string> serviceList,
            out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
            out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
            out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
            out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
            out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
            out List<Ia.Ngn.Cl.Model.Access> accessList,
            out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
            out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
            out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
            out Ia.Cl.Model.Result result)
        {
            string input;
 
            service2List = null;
            subscriberList = null;
            huSbrList = null;
            axeSubscriberList = null;
            ewsdSubscriberList = null;
            accessList = null;
            serviceRequestServiceList = null;
            serviceRequestList = null;
            serviceRequestAdministrativeIssueList = null;
            serviceRequestHistoryList = null;
            serviceRequestOntList = null;
 
            var stopwatch = new Ia.Cl.Model.Stopwatch();
 
            result = new Ia.Cl.Model.Result();
 
            if (!string.IsNullOrEmpty(accessName))
            {
                accessName = accessName.Trim().ToUpper();
                input = accessName;
 
                if (input.Length > 0)
                {
                    Ia.Ngn.Cl.Model.Business.Maintenance.Find.OntName(ref stopwatch, framework, true, accessName, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out accessList, out _, out _, out _, out _, out _, out serviceRequestOntList, out _, out _, out _, out Ia.Cl.Model.Result result1);
 
                    Ia.Ngn.Cl.Model.Business.Maintenance.Find.Number(ref stopwatch, framework, true, serviceList, out service2List, out _, out _, out _, out _, out _, out subscriberList, out huSbrList, out _, out _, out axeSubscriberList, out ewsdSubscriberList, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out _, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out _, out _, out _, out _, out _, out Ia.Cl.Model.Result result2);
 
                    if (
                    (service2List == null || service2List != null && service2List.Count == 0) &&
                    (subscriberList == null || subscriberList != null && subscriberList.Count == 0) &&
                    (huSbrList == null || huSbrList != null && huSbrList.Count == 0) &&
                    (axeSubscriberList == null || axeSubscriberList != null && axeSubscriberList.Count == 0) &&
                    (ewsdSubscriberList == null || ewsdSubscriberList != null && ewsdSubscriberList.Count == 0) &&
                    (accessList == null || accessList != null && accessList.Count == 0) &&
                    (serviceRequestServiceList == null || serviceRequestServiceList != null && serviceRequestServiceList.Count == 0) &&
                    (serviceRequestList == null || serviceRequestList != null && serviceRequestList.Count == 0) &&
                    (serviceRequestAdministrativeIssueList == null || serviceRequestAdministrativeIssueList != null && serviceRequestAdministrativeIssueList.Count == 0) &&
                    (serviceRequestHistoryList == null || serviceRequestHistoryList != null && serviceRequestHistoryList.Count == 0) &&
                    (serviceRequestOntList == null || serviceRequestOntList != null && serviceRequestOntList.Count == 0))
                    {
                        if (result.IsSuccessful)
                        {
                            result.AddWarning("No data records were found for \"" + accessName + "\" (لا توجد معلومات عن القيمة المعطاة). ");
                        }
                        else { };// result.AddError(result.Error);
                    }
                    else
                    {
                        /*
                        if (result.IsSuccessful)
                        {
                            if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
                        }
                        //else result.AddError(result.Error);
                        */
                    }
                }
                else result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
            }
            else result.AddError("Input is null or empty (لم يتم إدخال أي شيء). ");
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void BulkSearch(string rawInput, out List<Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName> serviceAccessNameList, out Ia.Cl.Model.Result result)
        {
            bool inputIsValid;
            string input;
 
            //inputIsValid = false;
            //result = null;
 
            serviceAccessNameList = null;
 
            result = new Ia.Cl.Model.Result();
 
            if (!string.IsNullOrEmpty(rawInput))
            {
                rawInput = rawInput.Trim();
                input = rawInput;
 
                if (input.Length > 0)
                {
                    inputIsValid = true;
 
                    Ia.Ngn.Cl.Model.Business.Maintenance.Find.NumberStringListToAccessNameList(rawInput, out serviceAccessNameList, out result);
 
 
                    //var v = Ia.Ngn.Cl.Model.Data.Access.IdToAccessDictionary;
 
                    if (inputIsValid)
                    {
                        if (serviceAccessNameList == null || serviceAccessNameList != null && serviceAccessNameList.Count == 0)
                        {
                            if (result.IsSuccessful)
                            {
                                result.AddWarning("No data records were found for \"" + rawInput + "\" (لا توجد معلومات عن القيمة أو القيم المعطاة)");
                            }
                            else { };// result.AddError(result.Error);
                        }
                        else
                        {
                            if (result.IsSuccessful)
                            {
                                if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
                            }
                            //else result.AddError(result.Error);
                        }
                    }
                    else result.AddError("Input format is unknown (قيمة غير مفهومة)");
                }
                else result.AddError("No input was entered (لم يتم إدخال أي شيء)");
            }
            else result.AddError("Input is null or empty (لم يتم إدخال أي شيء)");
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void BulkSearch(string rawInput, out List<Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessNameAddress> serviceAccessNameAddressList, out Ia.Cl.Model.Result result)
        {
            bool inputIsValid;
            string input;
 
            //inputIsValid = false;
            //result = null;
 
            serviceAccessNameAddressList = null;
 
            result = new Ia.Cl.Model.Result();
 
            if (!string.IsNullOrEmpty(rawInput))
            {
                rawInput = rawInput.Trim();
                input = rawInput.ToLower();
 
                if (input.Length > 0)
                {
                    inputIsValid = true;
 
                    Ia.Ngn.Cl.Model.Business.Maintenance.Find.NumberStringListToAccessNameAddressList(rawInput, out serviceAccessNameAddressList, out result);
 
                    if (inputIsValid)
                    {
                        if (serviceAccessNameAddressList == null || serviceAccessNameAddressList != null && serviceAccessNameAddressList.Count == 0)
                        {
                            if (result.IsSuccessful)
                            {
                                result.AddWarning("No data records were found for \"" + rawInput + "\" (لا توجد معلومات عن القيمة أو القيم المعطاة). ");
                            }
                            else { };// result.AddError(result.Error);
                        }
                        else
                        {
                            if (result.IsSuccessful)
                            {
                                if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
                            }
                            //else result.AddError(result.Error);
                        }
                    }
                    else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
                }
                else result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
            }
            else result.AddError("Input is null or empty (لم يتم إدخال أي شيء). ");
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void NumberStringListToAccessNameList(string rawInput, out List<Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName> serviceAccessNameList, out Ia.Cl.Model.Result result)
        {
            string input, serviceId;
            int number;
            string numberString;
            Dictionary<string, string> serviceToAccessNameDictionary;
            MatchCollection matchCollection;
            Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName serviceAccessName;
 
            result = new Ia.Cl.Model.Result();
 
            serviceAccessNameList = new List<Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName>();
 
            input = rawInput.ToLower();
 
            serviceToAccessNameDictionary = Ia.Ngn.Cl.Model.Data.Service2.ServiceIdToAccessNameDictionary;
 
            matchCollection = Regex.Matches(input, @"\d{8}");
 
            if (matchCollection.Count > 0)
            {
                foreach (Match match in matchCollection)
                {
                    numberString = match.Value;
 
                    number = int.Parse(numberString);
 
                    if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
                    {
                        serviceAccessName = new Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName();
 
                        serviceId = numberString + ":1:965";
 
                        serviceAccessName.Service = number.ToString();
 
                        if (serviceToAccessNameDictionary.ContainsKey(serviceId))
                        {
                            serviceAccessName.AccessName = serviceToAccessNameDictionary[serviceId];
                        }
 
                        serviceAccessNameList.Add(serviceAccessName);
                    }
                    else
                    {
                        result.AddWarning("The number \"" + numberString + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
                    }
                }
            }
            else
            {
                result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void NumberStringListToAccessNameAddressList(string rawInput, out List<Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessNameAddress> serviceAccessNameAddressList, out Ia.Cl.Model.Result result)
        {
            string input, serviceId;
            int number;
            string numberString;
            MatchCollection matchCollection;
            Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessNameAddress serviceAccessNameAddress;
 
            result = new Ia.Cl.Model.Result();
 
            serviceAccessNameAddressList = new List<Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessNameAddress>();
 
            input = rawInput.ToLower();
 
            var serviceToAccessNameDictionary = Ia.Ngn.Cl.Model.Data.Service2.ServiceIdToAccessNameDictionary;
            var serviceIdToAccessIdDictionary = Ia.Ngn.Cl.Model.Data.Service2.ServiceIdToAccessIdDictionary;
            var accessIdToAccessDictionary = Ia.Ngn.Cl.Model.Data.Access.IdToAccessDictionary;
 
            matchCollection = Regex.Matches(input, @"\d{8}");
 
            if (matchCollection.Count > 0)
            {
                foreach (Match match in matchCollection)
                {
                    numberString = match.Value;
 
                    number = int.Parse(numberString);
 
                    if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
                    {
                        serviceAccessNameAddress = new Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessNameAddress();
 
                        serviceId = numberString + ":1:965";
 
                        serviceAccessNameAddress.Service = number.ToString();
 
                        if (serviceToAccessNameDictionary.ContainsKey(serviceId))
                        {
                            serviceAccessNameAddress.AccessName = serviceToAccessNameDictionary[serviceId];
                        }
 
                        if (serviceIdToAccessIdDictionary.ContainsKey(serviceId))
                        {
                            var accessId = serviceIdToAccessIdDictionary[serviceId];
 
                            if (accessIdToAccessDictionary.ContainsKey(accessId))
                            {
                                serviceAccessNameAddress.Address = accessIdToAccessDictionary[accessId].Address;
                            }
                        }
 
                        serviceAccessNameAddressList.Add(serviceAccessNameAddress);
                    }
                    else
                    {
                        result.AddWarning("The number \"" + numberString + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
                    }
                }
            }
            else
            {
                result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void AreaBlock(string rawInput, out List<Ia.Ngn.Cl.Model.Access> accessList, out Ia.Cl.Model.Result result)
        {
            string input;
 
            result = new Ia.Cl.Model.Result();
            accessList = null;
 
            input = rawInput.ToLower();
 
            try
            {
                // note that this returns 0 int values for missing fields
                ExtractAreaBlockFromSearchAreaBlockTerm(input, out Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea, out string block);
 
                if (kuwaitOfnArea != null)
                {
                    //using (var db = new Ia.Ngn.Cl.Model.Ngn())
                    //{
                    accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessListFromAreaAndBlock(kuwaitOfnArea.Id, block);
                    //}
                }
                else
                {
                    result.AddError("The area of \"" + rawInput + "\" is unrecognized. ");
                }
            }
            catch (Exception ex)
            {
                result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void Address(string rawInput, out List<Ia.Ngn.Cl.Model.Access> accessList, out Ia.Cl.Model.Result result)
        {
            string input;
 
            result = new Ia.Cl.Model.Result();
            accessList = null;
 
            input = rawInput.ToLower();
 
            try
            {
                // note that this returns 0 int values for missing fields
                ExtractAddressFromSearchAddressTerm(input, out Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea, out string block, out int street, out int premisesOld, out int premisesNew);
 
                if (kuwaitOfnArea != null)
                {
                    accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessListFromAddress(kuwaitOfnArea.Id, block, street, premisesOld, premisesNew);
                }
                else
                {
                    result.AddError("The area of \"" + rawInput + "\" is unrecognized. ");
                }
            }
            catch (Exception ex)
            {
                result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void CustomerName(string rawInput, out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList, out Ia.Cl.Model.Result result)
        {
            string input;
            int maxNumberOfResults = 1000;
            string customerName;
 
            result = new Ia.Cl.Model.Result();
            serviceRequestList = null;
 
            input = rawInput.ToLower();
 
            try
            {
                //using (var db = new Ia.Ngn.Cl.Model.Ngn())
                //{
                customerName = Ia.Ngn.Cl.Model.Business.Default.CorrectCustomerName(input);
 
                //if (!string.IsNullOrEmpty(customerName))
                //{
                serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestListForCustomerName(customerName, maxNumberOfResults);
 
                if (serviceRequestList.Count >= maxNumberOfResults) result.AddSuccess("The search returned " + maxNumberOfResults + " or more results. The output is limited to " + maxNumberOfResults + ". ");
                //}
                //else
                //{
                //    serviceRequestList = null;
                //}
                //}
            }
            catch (Exception ex)
            {
                result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        ///
        /// </summary>
        public static void CustomerId(string rawInput, out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList, out Ia.Cl.Model.Result result)
        {
            string input;
            int customerId, maxNumberOfResults = 10000;
 
            result = new Ia.Cl.Model.Result();
            serviceRequestList = null;
 
            input = rawInput.ToLower();
 
            try
            {
                using (var db = new Ia.Ngn.Cl.Model.Ngn())
                {
                    customerId = int.Parse(input);
 
                    serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestListForCustomerId(customerId, maxNumberOfResults);
 
                    if (serviceRequestList.Count >= maxNumberOfResults) result.AddSuccess("The search returned " + maxNumberOfResults + " or more results. The output is limited to " + maxNumberOfResults + ". ");
                }
            }
            catch (Exception ex)
            {
                result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
            }
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        /// Extract area,block from search term like "SLA,2" {kuwaitAreaSymbol,block}
        /// </summary>
        private static void ExtractAreaBlockFromSearchAreaBlockTerm(string addressTerm, out Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea, out string block)
        {
            //int i;
            string kuwaitOfnAreaSymbol;
            Match match;
 
            // "SLA,2"
            match = Regex.Match(addressTerm, @"^([a-zA-Z]{3}),(\d{1,3})$");
 
            kuwaitOfnAreaSymbol = match.Groups[1].Value.ToUpper();
            block = match.Groups[2].Value;
 
            kuwaitOfnArea = Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaBySymbol(kuwaitOfnAreaSymbol);
        }
 
        ////////////////////////////////////////////////////////////////////////////
 
        /// <summary>
        /// Extract address from search term like "SLA,2,202,339,36" {kuwaitAreaSymbol,block,street,old premises,new premises}
        /// </summary>
        private static void ExtractAddressFromSearchAddressTerm(string addressTerm, out Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea, out string block, out int street, out int premisesOld, out int premisesNew)
        {
            string kuwaitOfnAreaSymbol;
            Match match;
 
            // "SLA,2,202,339,36"
            match = Regex.Match(addressTerm, @"^([a-zA-Z]{3}),(\d{0,3}),(\d{0,3}),(\d{0,3}),(\d{0,3})$");
 
            kuwaitOfnAreaSymbol = match.Groups[1].Value.ToUpper();
            block = match.Groups[2].Value;
            street = int.TryParse(match.Groups[3].Value, out int i) ? i : 0;
            premisesOld = int.TryParse(match.Groups[4].Value, out i) ? i : 0;
            premisesNew = int.TryParse(match.Groups[5].Value, out i) ? i : 0;
 
            kuwaitOfnArea = Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaBySymbol(kuwaitOfnAreaSymbol);
        }
 
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////   
    }
 
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////   
}