)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Find (Ia.Ftn.Cl.Models.Business.Maintenance)

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 Fixed Telecommunications Network business model

    1: using Microsoft.AspNetCore.Identity;
    2: using Microsoft.EntityFrameworkCore;
    3: using System;
    4: using System.Collections.Generic;
    5: using System.Data;
    6: using System.Linq;
    7: using System.Net;
    8: using System.Text.RegularExpressions;
    9:  
   10: namespace Ia.Ftn.Cl.Models.Business.Maintenance
   11: {
   12:     ////////////////////////////////////////////////////////////////////////////
   13:  
   14:     /// <summary publish="true">
   15:     /// Find subscriber and network information support class for the Fixed Telecommunications Network business model
   16:     /// </summary>
   17:     /// 
   18:     /// <remarks> 
   19:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   20:     ///
   21:     /// 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
   22:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   23:     ///
   24:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   25:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   26:     /// 
   27:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   28:     /// 
   29:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   30:     /// </remarks> 
   31:     public class Find
   32:     {
   33:         public const string ServiceRequestCustomerIdInputTypeString = "serviceRequestCustomerId";
   34:         public const string PaciInputTypeString = "paci";
   35:  
   36:         ////////////////////////////////////////////////////////////////////////////
   37:  
   38:         /// <summary>
   39:         ///
   40:         /// </summary>
   41:         public Find() { }
   42:  
   43:         ////////////////////////////////////////////////////////////////////////////
   44:  
   45:         /// <summary>
   46:         ///
   47:         /// </summary>
   48:         public static string Url(string input)
   49:         {
   50:             return "/maintenance/find?input=" + WebUtility.UrlEncode(input);
   51:         }
   52:  
   53:         ////////////////////////////////////////////////////////////////////////////
   54:  
   55:         /// <summary>
   56:         ///
   57:         /// </summary>
   58:         public static void Search(Ia.Ftn.Cl.Models.Business.Administration.Framework framework, string rawInput, string inputType, out List<Ia.Ftn.Cl.Models.Ui.Service2> serviceList, out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList, out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList, out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList, out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList, out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList, out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList, out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList, out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList, out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList, out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList, out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList, out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList, out List<Ia.Ftn.Cl.Models.Ont> ontList, out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList, out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList, out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList, out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList, out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList, out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList, out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList, out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList, out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList, out List<Ia.Ftn.Cl.Models.Event> eventList, out List<Ia.Ftn.Cl.Models.Access> accessList, out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList, out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList, out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList, out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList, out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList, out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList, out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList, out List<Ia.Ftn.Cl.Models.Report> reportList, out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList, out Ia.Cl.Models.Result result)
   59:         {
   60:             var enqueueIntoMessageQueue = true;
   61:             var stopwatch = new Ia.Cl.Models.Stopwatch();
   62:  
   63:             Ia.Ftn.Cl.Models.Business.Maintenance.Find.Search(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, inputType, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
   64:         }
   65:  
   66:         ////////////////////////////////////////////////////////////////////////////
   67:  
   68:         /// <summary>
   69:         ///
   70:         /// </summary>
   71:         public static Ia.Cl.Models.Result TriggerSearchToRefreshAspNetAndDatabaseConnection(string input)
   72:         {
   73:             var enqueueIntoMessageQueue = false;
   74:             var inputType = string.Empty;
   75:             var stopwatch = new Ia.Cl.Models.Stopwatch();
   76:  
   77:             var staff = Ia.Ftn.Cl.Models.Business.Authority.ApplicationStaff() ?? Ia.Ftn.Cl.Models.Business.Authority.SuperStaff();
   78:  
   79:             Ia.Ftn.Cl.Models.Business.Maintenance.Find.Search(ref stopwatch, staff.Framework, enqueueIntoMessageQueue, 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.Models.Result result);
   80:  
   81:             return result;
   82:         }
   83:  
   84:         ////////////////////////////////////////////////////////////////////////////
   85:  
   86:         /// <summary>
   87:         ///
   88:         /// </summary>
   89:         public static void Search(ref Ia.Cl.Models.Stopwatch stopwatch,
   90:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
   91:             bool enqueueIntoMessageQueue,
   92:             string rawInput,
   93:             string inputType,
   94:             out List<Ia.Ftn.Cl.Models.Ui.Service2> serviceList,
   95:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
   96:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
   97:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
   98:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
   99:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
  100:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
  101:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
  102:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
  103:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
  104:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
  105:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
  106:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
  107:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
  108:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
  109:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
  110:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
  111:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
  112:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
  113:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
  114:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
  115:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
  116:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
  117:             out List<Ia.Ftn.Cl.Models.Event> eventList,
  118:             out List<Ia.Ftn.Cl.Models.Access> accessList,
  119:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
  120:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
  121:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
  122:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
  123:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
  124:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
  125:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
  126:             out List<Ia.Ftn.Cl.Models.Report> reportList,
  127:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
  128:             out Ia.Cl.Models.Result result)
  129:         {
  130:             bool inputIsValid;
  131:             string input;
  132:  
  133:             serviceList = null;
  134:             agcfGatewayRecordList = null;
  135:             agcfEndpointList = null;
  136:             mgwList = null;
  137:             asbrList = null;
  138:             subPartyList = null;
  139:             subscriberList = null;
  140:             sbrList = null;
  141:             owsbrList = null;
  142:             seruattrList = null;
  143:             axeSubscriberList = null;
  144:             ewsdSubscriberList = null;
  145:             nddOntList = null;
  146:             ontList = null;
  147:             ontServiceVoipList = null;
  148:             ontOntPotsList = null;
  149:             emsDevList = null;
  150:             emsBoardList = null;
  151:             emsPortList = null;
  152:             emsOntList = null;
  153:             emsOntSipInfoList = null;
  154:             emsVoipPstnUserList = null;
  155:             emsVagList = null;
  156:             eventList = null;
  157:             accessList = null;
  158:             serviceRequestServiceList = null;
  159:             serviceRequestList = null;
  160:             serviceRequestAdministrativeIssueList = null;
  161:             serviceRequestHistoryList = null;
  162:             serviceRequestTypeList = null;
  163:             serviceRequestOntList = null;
  164:             serviceRequestOntDetailList = null;
  165:             reportList = null;
  166:             reportHistoryList = null;
  167:  
  168:             result = new Ia.Cl.Models.Result();
  169:  
  170:             if (!string.IsNullOrEmpty(rawInput))
  171:             {
  172:                 rawInput = rawInput.Trim();
  173:                 input = rawInput.ToLower();
  174:  
  175:                 if (input.Length > 0)
  176:                 {
  177:                     inputIsValid = true;
  178:  
  179:                     if (Ia.Ftn.Cl.Models.Business.Service.ServiceHasEightDigitsAndIsWithinKuwaitLandlineDomainList(input) || Ia.Ftn.Cl.Models.Business.NumberFormatConverter.IsMatchToServiceWithCountryCode(input) || Ia.Ftn.Cl.Models.Business.NumberFormatConverter.IsMatchToImpuSipDomain(input))
  180:                     {
  181:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.Number(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  182:                     }
  183:                     else if (Ia.Ftn.Cl.Models.Business.Access.AccessNameIsInAValidFormat(input))
  184:                     {
  185:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.OntName(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  186:                     }
  187:                     else if (Ia.Ftn.Cl.Models.Business.Access.PonNameIsInValidFormat(input))
  188:                     {
  189:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.PonName(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  190:                     }
  191:                     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()
  192:                     {
  193:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.MsanDevLicPosition(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  194:                     }
  195:                     else if (Regex.IsMatch(input, @"^[\w\d\-]+\-\d{1,2}\-\d{1,2}\-\d{1,2}$"))
  196:                     {
  197:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.OntPosition(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  198:                     }
  199:                     else if (Ia.Ftn.Cl.Models.Business.Huawei.Ont.IsValidSerialNumber(input) || Ia.Ftn.Cl.Models.Business.Nokia.Ont.IsValidSerialNumber(input)) // Huawei or Nokia ONT serial
  200:                     {
  201:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.Serial(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  202:                     }
  203:                     else if (Ia.Ftn.Cl.Models.Business.Access.PaciIsInAValidFormat(input))
  204:                     {
  205:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.Paci(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  206:  
  207:                         /*
  208:                         if (!string.IsNullOrEmpty(inputType) && inputType == Ia.Ftn.Cl.Model.Business.Maintenance.Find.PaciInputTypeString)
  209:                         {
  210:                             Ia.Ftn.Cl.Model.Business.Maintenance.Find.Paci(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  211:                         }
  212:                         */
  213:                     }
  214:                     else if (Ia.Cl.Models.Default.IsValidIpv4(input))
  215:                     {
  216:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.Ip(rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  217:                     }
  218:                     else if (Regex.IsMatch(input, @"^[a-zA-Z]{3},\d{1,3}$"))
  219:                     {
  220:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.AreaBlock(rawInput, out accessList, out result);
  221:                     }
  222:                     else if (Regex.IsMatch(input, @"^[a-zA-Z]{3},\d{0,3},\d{0,3},\d{0,3},\d{0,3}$"))
  223:                     {
  224:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.Address(rawInput, out accessList, out result);
  225:                     }
  226:                     else if (Regex.IsMatch(input, @"^\d{1,7}$"))
  227:                     {
  228:                         if (!string.IsNullOrEmpty(inputType) && inputType == Ia.Ftn.Cl.Models.Business.Maintenance.Find.ServiceRequestCustomerIdInputTypeString)
  229:                         {
  230:                             // max value of ServiceRequest CustomerId is a 7 digit number
  231:  
  232:                             Ia.Ftn.Cl.Models.Business.Maintenance.Find.CustomerId(rawInput, out serviceRequestList, out result);
  233:                         }
  234:                         else Ia.Ftn.Cl.Models.Business.Maintenance.Find.GatewayId(ref stopwatch, framework, enqueueIntoMessageQueue, rawInput, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  235:                     }
  236:                     else if (Regex.IsMatch(input, @"^[\p{L}|\s]+$")) // "\p{L}" matches unicode characters
  237:                     {
  238:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.CustomerName(rawInput, out serviceRequestList, out result);
  239:                     }
  240:                     else inputIsValid = false;
  241:  
  242:                     stopwatch.RecordElapsedMilliseconds("N");
  243:  
  244:                     if (inputIsValid)
  245:                     {
  246:                         if (
  247:                         (serviceList == null || serviceList != null && serviceList.Count == 0) &&
  248:                         (agcfGatewayRecordList == null || agcfGatewayRecordList != null && agcfGatewayRecordList.Count == 0) &&
  249:                         (agcfEndpointList == null || agcfEndpointList != null && agcfEndpointList.Count == 0) &&
  250:                         (mgwList == null || mgwList != null && mgwList.Count == 0) &&
  251:                         (asbrList == null || asbrList != null && asbrList.Count == 0) &&
  252:                         (subPartyList == null || subPartyList != null && subPartyList.Count == 0) &&
  253:                         (subscriberList == null || subscriberList != null && subscriberList.Count == 0) &&
  254:                         (sbrList == null || sbrList != null && sbrList.Count == 0) &&
  255:                         (owsbrList == null || owsbrList != null && owsbrList.Count == 0) &&
  256:                         (seruattrList == null || seruattrList != null && seruattrList.Count == 0) &&
  257:                         (axeSubscriberList == null || axeSubscriberList != null && axeSubscriberList.Count == 0) &&
  258:                         (ewsdSubscriberList == null || ewsdSubscriberList != null && ewsdSubscriberList.Count == 0) &&
  259:                         (nddOntList == null || nddOntList != null && nddOntList.Count == 0) &&
  260:                         (ontList == null || ontList != null && ontList.Count == 0) &&
  261:                         (ontServiceVoipList == null || ontServiceVoipList != null && ontServiceVoipList.Count == 0) &&
  262:                         (ontOntPotsList == null || ontOntPotsList != null && ontOntPotsList.Count == 0) &&
  263:                         (emsDevList == null || emsDevList != null && emsDevList.Count == 0) &&
  264:                         (emsBoardList == null || emsBoardList != null && emsBoardList.Count == 0) &&
  265:                         (emsPortList == null || emsPortList != null && emsPortList.Count == 0) &&
  266:                         (emsOntList == null || emsOntList != null && emsOntList.Count == 0) &&
  267:                         (emsOntSipInfoList == null || emsOntSipInfoList != null && emsOntSipInfoList.Count == 0) &&
  268:                         (emsVoipPstnUserList == null || emsVoipPstnUserList != null && emsVoipPstnUserList.Count == 0) &&
  269:                         (emsVagList == null || emsVagList != null && emsVagList.Count == 0) &&
  270:                         (eventList == null || eventList != null && eventList.Count == 0) &&
  271:                         (accessList == null || accessList != null && accessList.Count == 0) &&
  272:                         (serviceRequestServiceList == null || serviceRequestServiceList != null && serviceRequestServiceList.Count == 0) &&
  273:                         (serviceRequestList == null || serviceRequestList != null && serviceRequestList.Count == 0) &&
  274:                         (serviceRequestAdministrativeIssueList == null || serviceRequestAdministrativeIssueList != null && serviceRequestAdministrativeIssueList.Count == 0) &&
  275:                         (serviceRequestHistoryList == null || serviceRequestHistoryList != null && serviceRequestHistoryList.Count == 0) &&
  276:                         (serviceRequestTypeList == null || serviceRequestTypeList != null && serviceRequestTypeList.Count == 0) &&
  277:                         (serviceRequestOntList == null || serviceRequestOntList != null && serviceRequestOntList.Count == 0) &&
  278:                         (serviceRequestOntDetailList == null || serviceRequestOntDetailList != null && serviceRequestOntDetailList.Count == 0) &&
  279:                         (reportList == null || reportList != null && reportList.Count == 0) &&
  280:                         (reportHistoryList == null || reportHistoryList != null && reportHistoryList.Count == 0))
  281:                         {
  282:                             if (result.IsSuccessful)
  283:                             {
  284:                                 result.AddWarning("No data records were found for \"" + rawInput + "\" (لا توجد معلومات عن القيمة المعطاة). ");
  285:                             }
  286:                             else { };// result.AddError(result.Error);
  287:                         }
  288:                         else
  289:                         {
  290:                             /*
  291:                             if (result.IsSuccessful)
  292:                             {
  293:                                 if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
  294:                             }
  295:                             //else result.AddError(result.Error);
  296:                             */
  297:                         }
  298:                     }
  299:                     else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
  300:                 }
  301:                 else result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
  302:             }
  303:             else result.AddError("Input is null or empty (لم يتم إدخال أي شيء). ");
  304:         }
  305:  
  306:         ////////////////////////////////////////////////////////////////////////////
  307:         ////////////////////////////////////////////////////////////////////////////
  308:  
  309:  
  310:  
  311:  
  312:  
  313:  
  314:         ////////////////////////////////////////////////////////////////////////////
  315:         ////////////////////////////////////////////////////////////////////////////
  316:  
  317:         /// <summary>
  318:         ///
  319:         /// </summary>
  320:         public static void GatewayId(ref Ia.Cl.Models.Stopwatch stopwatch,
  321:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
  322:             bool enqueueIntoMessageQueue,
  323:             string input,
  324:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
  325:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
  326:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
  327:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
  328:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
  329:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
  330:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
  331:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
  332:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
  333:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
  334:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
  335:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
  336:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
  337:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
  338:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
  339:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
  340:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
  341:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
  342:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
  343:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
  344:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
  345:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
  346:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
  347:             out List<Ia.Ftn.Cl.Models.Event> eventList,
  348:             out List<Ia.Ftn.Cl.Models.Access> accessList,
  349:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
  350:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
  351:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
  352:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
  353:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
  354:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
  355:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
  356:             out List<Ia.Ftn.Cl.Models.Report> reportList,
  357:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
  358:             out Ia.Cl.Models.Result result)
  359:         {
  360:             int gatewayId;
  361:  
  362:             var gatewayIdList = new List<int>();
  363:  
  364:             result = new Ia.Cl.Models.Result();
  365:  
  366:             service2List = null;
  367:             agcfGatewayRecordList = null;
  368:             agcfEndpointList = null;
  369:             mgwList = null;
  370:             asbrList = null;
  371:             subPartyList = null;
  372:             subscriberList = null;
  373:             sbrList = null;
  374:             owsbrList = null;
  375:             seruattrList = null;
  376:             axeSubscriberList = null;
  377:             ewsdSubscriberList = null;
  378:             nddOntList = null;
  379:             ontList = null;
  380:             ontServiceVoipList = null;
  381:             ontOntPotsList = null;
  382:             emsDevList = null;
  383:             emsBoardList = null;
  384:             emsPortList = null;
  385:             emsOntList = null;
  386:             emsOntSipInfoList = null;
  387:             emsVoipPstnUserList = null;
  388:             emsVagList = null;
  389:             eventList = null;
  390:             accessList = null;
  391:             serviceRequestServiceList = null;
  392:             serviceRequestList = null;
  393:             serviceRequestAdministrativeIssueList = null;
  394:             serviceRequestHistoryList = null;
  395:             serviceRequestTypeList = null;
  396:             serviceRequestOntList = null;
  397:             serviceRequestOntDetailList = null;
  398:             reportList = null;
  399:             reportHistoryList = null;
  400:  
  401:             gatewayId = int.Parse(input);
  402:  
  403:             if (gatewayId >= Ia.Ftn.Cl.Models.Business.Nokia.Ims.FirstGatewayId && gatewayId <= Ia.Ftn.Cl.Models.Business.Nokia.Ims.LastGatewayId)
  404:             {
  405:                 gatewayIdList.Add(gatewayId);
  406:  
  407:                 Ia.Ftn.Cl.Models.Business.Maintenance.Find.GatewayIdTwo(ref stopwatch, framework, enqueueIntoMessageQueue, gatewayIdList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
  408:             }
  409:             else
  410:             {
  411:                 result.AddError("The gatewayId \"" + input + "\" is not within the allowed gatewayId range (الرقم لا ينتمي للمجال). ");
  412:             }
  413:         }
  414:  
  415:         ////////////////////////////////////////////////////////////////////////////
  416:  
  417:         /// <summary>
  418:         ///
  419:         /// </summary>
  420:         private static void GatewayIdTwo(ref Ia.Cl.Models.Stopwatch stopwatch,
  421:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
  422:             bool enqueueIntoMessageQueue,
  423:             List<int> gatewayIdList,
  424:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
  425:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
  426:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
  427:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
  428:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
  429:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
  430:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
  431:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
  432:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
  433:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
  434:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
  435:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
  436:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
  437:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
  438:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
  439:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
  440:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
  441:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
  442:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
  443:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
  444:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
  445:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
  446:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
  447:             out List<Ia.Ftn.Cl.Models.Event> eventList,
  448:             out List<Ia.Ftn.Cl.Models.Access> accessList,
  449:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
  450:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
  451:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
  452:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
  453:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
  454:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
  455:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
  456:             out List<Ia.Ftn.Cl.Models.Report> reportList,
  457:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
  458:             out Ia.Cl.Models.Result result)
  459:         {
  460:             var serviceList = new List<string>();
  461:  
  462:             service2List = null;
  463:             agcfGatewayRecordList = null;
  464:             agcfEndpointList = null;
  465:             mgwList = null;
  466:             asbrList = null;
  467:             subPartyList = null;
  468:             subscriberList = null;
  469:             sbrList = null;
  470:             owsbrList = null;
  471:             seruattrList = null;
  472:             axeSubscriberList = null;
  473:             ewsdSubscriberList = null;
  474:             nddOntList = null;
  475:             ontList = null;
  476:             ontServiceVoipList = null;
  477:             ontOntPotsList = null;
  478:             emsDevList = null;
  479:             emsBoardList = null;
  480:             emsPortList = null;
  481:             emsOntList = null;
  482:             emsOntSipInfoList = null;
  483:             emsVoipPstnUserList = null;
  484:             emsVagList = null;
  485:             eventList = null;
  486:             accessList = null;
  487:             serviceRequestServiceList = null;
  488:             serviceRequestList = null;
  489:             serviceRequestAdministrativeIssueList = null;
  490:             serviceRequestHistoryList = null;
  491:             serviceRequestTypeList = null;
  492:             serviceRequestOntList = null;
  493:             serviceRequestOntDetailList = null;
  494:             reportList = null;
  495:             reportHistoryList = null;
  496:  
  497:             var serviceLongList = new List<long>();
  498:             var numberList = new List<int>();
  499:             var partyIdList = new List<string>();
  500:             var prividUserList = new List<string>();
  501:             var impuSipDomainList = new List<string>();
  502:             var sipUserNameList = new List<string>();
  503:             var serviceWithCountryCodeList = new List<string>();
  504:             var serviceIdList = new List<string>();
  505:  
  506:             var subscriberIdList = new List<string>();
  507:             var subPartyIdList = new List<string>();
  508:             var agcfEndpointIdList = new List<string>();
  509:             var agcfGatewayRecordIdList = new List<int>();
  510:             var agcfGatewayRecordIpList = new List<string>();
  511:  
  512:             var asbrIdList = new List<string>();
  513:             var mgwIdList = new List<string>();
  514:  
  515:             var sbrImpuList = new List<string>();
  516:             var owsbrImpuList = new List<string>();
  517:  
  518:             var ontIdList = new List<string>();
  519:             var ontOntPotsIdList = new List<string>();
  520:             var ontServiceVoipIdList = new List<string>();
  521:             var ontServiceVoipIpList = new List<string>();
  522:  
  523:             var ipList = new List<string>();
  524:  
  525:             var emsDevIdList = new List<int>();
  526:             var emsBoardIdList = new List<string>();
  527:             var emsPortIdList = new List<string>();
  528:             var emsOntIdList = new List<string>();
  529:             var emsVoipPstnUserIdList = new List<string>();
  530:  
  531:             result = new Ia.Cl.Models.Result();
  532:  
  533:             // gateways belong to Nokia switch
  534:             var switchVendorList = new List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor>() { Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia };
  535:  
  536:             try
  537:             {
  538:                 if (switchVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia))
  539:                 {
  540:                     agcfGatewayRecordIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordIdListFromGatewayIdList(gatewayIdList);
  541:  
  542:                     agcfGatewayRecordIpList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordIpListFromIdList(agcfGatewayRecordIdList);
  543:                     ipList.AddRange(agcfGatewayRecordIpList);
  544:                     ipList = ipList.Distinct().ToList();
  545:  
  546:                     agcfEndpointIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfEndpointIdListFromAgcfGatewayRecordIdList(agcfGatewayRecordIdList);
  547:                     subPartyIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubPartyIdListFromAgcfEndpointIdList(agcfEndpointIdList);
  548:                     subscriberIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubscriberIdListFromSubPartyIdList(subPartyIdList);
  549:                     subPartyIdList = subscriberIdList;
  550:  
  551:                     var nddOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntIdListFromIpList(ipList);
  552:  
  553:                     var accessVendorList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessVendorListByOntIdList(nddOntIdList);
  554:  
  555:                     if (accessVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia))
  556:                     {
  557:                         ontIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntIdListFromNddOntIdList(nddOntIdList);
  558:                         ontOntPotsIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntOntPotsIdListFromOntIdList(ontIdList);
  559:                         ontServiceVoipIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipsIdListFromOntIdList(ontIdList);
  560:                         ontServiceVoipIpList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipIpList(ontServiceVoipIdList);
  561:                         ipList.AddRange(ontServiceVoipIpList);
  562:                         ipList = ipList.Distinct().ToList();
  563:                     }
  564:  
  565:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
  566:  
  567:                     var serviceRequestServiceIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceIdListFromServiceIdList(serviceIdList);
  568:  
  569:                     var accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromServiceIdList(serviceIdList);
  570:                     accessIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
  571:                     accessIdList = accessIdList.Distinct().ToList();
  572:  
  573:                     //Ia.Ftn.Cl.Model.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(service2IdList, ref serviceList);
  574:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
  575:  
  576:                     var reportIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportIdListFromServiceList(serviceList);
  577:                     reportIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportIdListFromAccessIdList(accessIdList));
  578:                     reportIdList = reportIdList.Distinct().ToList();
  579:  
  580:                     var serviceRequestIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
  581:                     serviceRequestIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
  582:                     serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
  583:  
  584:                     var serviceRequestAdministrativeIssueIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestAdministrativeIssueIdListFromServiceIdList(serviceIdList);
  585:  
  586:                     var serviceRequestHistoryIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
  587:                     var serviceRequestTypeIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestTypeIdListFromServiceRequestIdList(serviceRequestIdList);
  588:                     var serviceRequestOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntIdListFromAccessIdList(accessIdList);
  589:  
  590:                     if (accessVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei))// || aServiceInServiceListIsWithinMsanDomainList)
  591:                     {
  592:                         emsOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntIdListFromNddOntIdList(nddOntIdList);
  593:  
  594:                         emsVoipPstnUserIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserIdListFromEmsOntIdList(emsOntIdList);
  595:                         emsVoipPstnUserIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserIdListFromServiceList(serviceList));
  596:                         emsVoipPstnUserIdList = emsVoipPstnUserIdList.Distinct().ToList();
  597:  
  598:                         emsPortIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortIdListFromEmsOntIdList(emsOntIdList);
  599:                         emsPortIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
  600:                         emsPortIdList = emsPortIdList.Distinct().ToList();
  601:  
  602:                         emsBoardIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardIdListFromEmsPortIdList(emsPortIdList);
  603:                         emsBoardIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardIdListFromAccessIdList(accessIdList));
  604:                         emsBoardIdList = emsBoardIdList.Distinct().ToList();
  605:  
  606:                         emsDevIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevIdListFromEmsBoardIdList(emsBoardIdList);
  607:                         emsDevIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevIdListFromAccessIdList(accessIdList));
  608:                         //emsDevIdList.AddRange(Ia.Ftn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
  609:                         emsDevIdList = emsDevIdList.Distinct().ToList();
  610:  
  611:                         ipList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntIpListFromNddOntIdList(nddOntIdList));
  612:                         ipList = ipList.Distinct().ToList();
  613:                     }
  614:  
  615:  
  616:  
  617:  
  618:  
  619:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
  620:  
  621:                     var aServiceInServiceListIsWithinMsanDomainList = Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinMsanDomainList(serviceList);
  622:  
  623:                     var service2IdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.Service2IdListFromServiceIdList(serviceIdList);
  624:  
  625:                     /*
  626:                     if (switchVendorList.Contains(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei))
  627:                     {
  628:                         asbrIdList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.AsbrIdListFromImpuSipDomainList(impuSipDomainList);
  629:                         mgwIdList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.MgwIdListFromAsbrIdList(asbrIdList);
  630: 
  631:                         sbrImpuList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.SbrImpuListFromImpuSipDomainList(impuSipDomainList);
  632:                         owsbrImpuList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.OwSbrImpuListFromImpuSipDomainList(impuSipDomainList);
  633: 
  634:                         Ia.Ftn.Cl.Model.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
  635:                     }
  636:                     */
  637:  
  638:                     /////////////////////////////////
  639:  
  640:                     agcfGatewayRecordList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordList(agcfGatewayRecordIdList);
  641:                     agcfEndpointList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfEndpointList(agcfEndpointIdList);
  642:                     subPartyList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubPartyList(subPartyIdList);
  643:                     subscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubscriberList(subscriberIdList);
  644:  
  645:                     mgwList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.MgwList(mgwIdList);
  646:                     asbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AsbrList(asbrIdList);
  647:  
  648:                     sbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SbrList(sbrImpuList);
  649:                     owsbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OwsbrList(owsbrImpuList);
  650:  
  651:                     if (Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(serviceList))
  652:                     {
  653:                         seruattrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SeruattrListFromServiceIdList(serviceIdList);
  654:                     }
  655:  
  656:                     axeSubscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AxeSubscriberListFromServiceIdList(serviceIdList);
  657:                     ewsdSubscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EwsdSubscriberListFromServiceIdList(serviceIdList);
  658:  
  659:                     ontList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntList(ontIdList);
  660:                     ontOntPotsList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntOntPotsListFromOntOntPotsIdList(ontOntPotsIdList);
  661:                     ontServiceVoipList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipList(ontServiceVoipIdList);
  662:  
  663:                     emsDevList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevList(emsDevIdList);
  664:                     emsBoardList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardList(emsBoardIdList);
  665:                     emsPortList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortList(emsPortIdList);
  666:                     emsOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntList(emsOntIdList);
  667:  
  668:                     emsOntSipInfoList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdListAndService(emsOntIdList, sipUserNameList);
  669:                     emsVoipPstnUserList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserList(emsVoipPstnUserIdList);
  670:                     emsVagList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
  671:  
  672:                     service2List = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceList(service2IdList);
  673:  
  674:                     nddOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntList(nddOntIdList);
  675:  
  676:                     accessList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessList(accessIdList);
  677:  
  678:                     serviceRequestServiceList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceList(serviceRequestServiceIdList);
  679:  
  680:                     serviceRequestList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestList(serviceRequestIdList);
  681:                     serviceRequestAdministrativeIssueList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestAdministrativeIssueList(serviceRequestAdministrativeIssueIdList);
  682:                     serviceRequestHistoryList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
  683:                     serviceRequestTypeList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestTypeList(serviceRequestTypeIdList);
  684:                     serviceRequestOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntList(serviceRequestOntIdList);
  685:                     serviceRequestOntDetailList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntDetailFromServieListList(serviceList); // more appropaite to display records related to the service numbers only
  686:  
  687:                     reportList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportList(reportIdList);
  688:  
  689:                     if (enqueueIntoMessageQueue)
  690:                     {
  691:                         foreach (var service in serviceList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadService, service);
  692:                         foreach (var nddOnt in nddOntList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadAccess, nddOnt.Access.Name);
  693:                         foreach (var gatewayId in gatewayIdList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadGateway, gatewayId);
  694:                     }
  695:                 }
  696:             }
  697:             catch (Exception ex)
  698:             {
  699:                 result.AddError("Exception: Retrieval error of data for \"" + string.Join(", ", serviceList) + "\": " + ex.ToString());
  700:             }
  701:         }
  702:  
  703:         ////////////////////////////////////////////////////////////////////////////
  704:  
  705:         /// <summary>
  706:         ///
  707:         /// </summary>
  708:         public static void Ip(string rawInput,
  709:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
  710:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
  711:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
  712:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
  713:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
  714:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
  715:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
  716:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
  717:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
  718:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
  719:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
  720:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
  721:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
  722:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
  723:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
  724:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
  725:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
  726:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
  727:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
  728:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
  729:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
  730:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
  731:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
  732:             out List<Ia.Ftn.Cl.Models.Event> eventList,
  733:             out List<Ia.Ftn.Cl.Models.Access> accessList,
  734:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
  735:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
  736:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
  737:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
  738:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
  739:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
  740:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
  741:             out List<Ia.Ftn.Cl.Models.Report> reportList,
  742:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
  743:             out Ia.Cl.Models.Result result)
  744:         {
  745:             string input;
  746:             List<int> agcfGatewayRecordIdList, numberList;
  747:             List<long> serviceLongList;
  748:             List<string> serviceList, serviceIdList, service2IdList, impuSipDomainList, sipUserNameList, serviceWithCountryCodeList, accessIdList, ontIdList, partyIdList, prividUserList, serviceRequestAdministrativeIssueIdList;
  749:  
  750:             service2IdList = new List<string>();
  751:             accessIdList = new List<string>();
  752:             ontIdList = new List<string>();
  753:             agcfGatewayRecordIdList = new List<int>();
  754:             numberList = new List<int>();
  755:             serviceLongList = new List<long>();
  756:             impuSipDomainList = new List<string>();
  757:             sipUserNameList = new List<string>();
  758:             serviceWithCountryCodeList = new List<string>();
  759:             serviceList = new List<string>();
  760:             partyIdList = new List<string>();
  761:             prividUserList = new List<string>();
  762:             serviceList = new List<string>();
  763:             serviceIdList = new List<string>();
  764:             serviceRequestAdministrativeIssueIdList = new List<string>();
  765:  
  766:             result = new Ia.Cl.Models.Result();
  767:  
  768:             service2List = null;
  769:  
  770:             agcfGatewayRecordList = null;
  771:             agcfEndpointList = null;
  772:             mgwList = null;
  773:             asbrList = null;
  774:             subPartyList = null;
  775:             subscriberList = null;
  776:  
  777:             sbrList = null;
  778:             owsbrList = null;
  779:             seruattrList = null;
  780:             axeSubscriberList = null;
  781:             ewsdSubscriberList = null;
  782:  
  783:             nddOntList = null;
  784:             ontList = null;
  785:             ontServiceVoipList = null;
  786:             ontOntPotsList = null;
  787:             emsDevList = null;
  788:             emsBoardList = null;
  789:             emsPortList = null;
  790:             emsOntList = null;
  791:             emsOntSipInfoList = null;
  792:             emsVoipPstnUserList = null;
  793:             emsVagList = null;
  794:             eventList = null;
  795:             accessList = null;
  796:             serviceRequestServiceList = null;
  797:             serviceRequestList = null;
  798:             serviceRequestAdministrativeIssueList = null;
  799:             serviceRequestHistoryList = null;
  800:             serviceRequestTypeList = null;
  801:             serviceRequestOntList = null;
  802:             serviceRequestOntDetailList = null;
  803:             reportList = null;
  804:             reportHistoryList = null;
  805:  
  806:             input = rawInput.ToLower();
  807:  
  808:             // var ip = mgw.EID.Replace(":" + Ia.Ftn.Cl.Model.Business.Huawei.SoftX.RemotePort, "");
  809:  
  810:             try
  811:             {
  812:                 using (var db = new Ia.Ftn.Cl.Db())
  813:                 {
  814:                     ontServiceVoipList = (from ov in db.OntServiceVoips where ov.Ip == input select ov).Include(u => u.Ont).ToList();
  815:                     foreach (var v in ontServiceVoipList) ontIdList.Add(v.Ont.Id);
  816:                     ontIdList = ontIdList.Distinct().ToList();
  817:  
  818:                     agcfGatewayRecordList = (from gr in db.AgcfGatewayRecords
  819:                                              where gr.IP1 == input || gr.IP2 == input
  820:                                              select new Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord()
  821:                                              {
  822:                                                  Id = gr.Id,
  823:                                                  GwId = gr.GwId,
  824:                                                  GwUserId = gr.GwUserId,
  825:                                                  GwDomain = gr.GwDomain,
  826:                                                  GwName = gr.GwName,
  827:                                                  IP1 = gr.IP1,
  828:                                                  IP2 = gr.IP2,
  829:                                                  MateExternalIPAddr = gr.MateExternalIPAddr,
  830:                                                  IsPrimary = gr.IsPrimary,
  831:                                                  Created = gr.Created,
  832:                                                  Updated = gr.Updated
  833:                                              }).ToList();
  834:                     foreach (var v in agcfGatewayRecordList) agcfGatewayRecordIdList.Add(v.Id);
  835:                     agcfGatewayRecordIdList = agcfGatewayRecordIdList.Distinct().ToList();
  836:  
  837:                     agcfEndpointList = (from e in db.AgcfEndpoints
  838:                                         where agcfGatewayRecordIdList.Contains(e.AgcfGatewayRecord.Id)
  839:                                         select new Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint()
  840:                                         {
  841:                                             Id = e.Id,
  842:                                             PrividUser = e.PrividUser,
  843:                                             GwId = e.GwId,
  844:                                             Dn = e.Dn,
  845:                                             FlatTermID = e.FlatTermID,
  846:                                             CallHoldLc = e.CallHoldLc,
  847:                                             CallWaitingLc = e.CallWaitingLc,
  848:                                             CallToggleLc = e.CallToggleLc,
  849:                                             ThreeWayCallLc = e.ThreeWayCallLc,
  850:                                             McidLc = e.McidLc,
  851:                                             Password = e.Password,
  852:                                             CallTransferLc = e.CallTransferLc,
  853:                                             Created = e.Created,
  854:                                             Updated = e.Updated
  855:                                         }).ToList();
  856:  
  857:                     // mgwList =
  858:  
  859:                     // asbrList =
  860:  
  861:                     // agcfEndpointIdList = (from ep in agcfEndpointList select ep.Id).ToList();
  862:  
  863:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.CollectServiceListFromAgcfEndpointList(agcfEndpointList, ref serviceList);
  864:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
  865:  
  866:                     service2List = (from s in db.Service2
  867:                                     where serviceList.Contains(s.Service) && s.ServiceType == Ia.Ftn.Cl.Models.Business.Service.ServiceType.ImsService
  868:                                     select new Ia.Ftn.Cl.Models.Ui.Service2()
  869:                                     {
  870:                                         AbbriviatedCalling = s.AbbriviatedCalling,
  871:                                         AlarmCall = s.AlarmCall,
  872:                                         CallBarring = s.CallBarring,
  873:                                         CallerId = s.CallerId,
  874:                                         CallForwarding = s.CallForwarding,
  875:                                         CallWaiting = s.CallWaiting,
  876:                                         ConferenceCall = s.ConferenceCall,
  877:                                         Created = s.Created,
  878:                                         InternationalCalling = s.InternationalCalling,
  879:                                         InternationalCallingUserControlled = s.InternationalCallingUserControlled,
  880:                                         Port = s.Port,
  881:                                         Pin = s.Pin,
  882:                                         Service = s.Service,
  883:                                         ServiceType = s.ServiceType,
  884:                                         ServiceSuspension = s.ServiceSuspension,
  885:                                         ServiceTypeName = s.ServiceType.ToString(),
  886:                                         Updated = s.Updated,
  887:                                         AccessId = s.Access.Id
  888:                                     }).ToList();
  889:  
  890:                     serviceRequestServiceList = (from srs in db.ServiceRequestServices
  891:                                                  where accessIdList.Contains(srs.Access.Id)
  892:                                                  select new Ia.Ftn.Cl.Models.Ui.ServiceRequestService()
  893:                                                  {
  894:                                                      Id = srs.Id,
  895:                                                      AbbriviatedCalling = srs.AbbriviatedCalling,
  896:                                                      Access = srs.Access,
  897:                                                      AlarmCall = srs.AlarmCall,
  898:                                                      CallBarring = srs.CallBarring,
  899:                                                      CallerId = srs.CallerId,
  900:                                                      CallForwarding = srs.CallForwarding,
  901:                                                      CallWaiting = srs.CallWaiting,
  902:                                                      ConferenceCall = srs.ConferenceCall,
  903:                                                      Created = srs.Created,
  904:                                                      InternationalCalling = srs.InternationalCalling,
  905:                                                      InternationalCallingUserControlled = srs.InternationalCallingUserControlled,
  906:                                                      LastRequestDateTime = srs.LastRequestDateTime,
  907:                                                      Provisioned = srs.Provisioned,
  908:                                                      Service = srs.Service,
  909:                                                      Serial = srs.Serial,
  910:                                                      ServiceType = srs.ServiceType,
  911:                                                      //ServiceSuspension = srs.ServiceSuspension,
  912:                                                      Type = srs.Type,
  913:                                                      Updated = srs.Updated
  914:                                                  }).ToList();
  915:  
  916:                     subscriberList = (from s in db.Subscribers
  917:                                       where partyIdList.Contains(s.PartyId)
  918:                                       select s).AsEnumerable().Select(s => new Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber()
  919:                                       {
  920:                                           Id = s.Id,
  921:                                           AlternateOtasRealm = s.AlternateOtasRealm,
  922:                                           PartyId = s.PartyId,
  923:                                           AbbriviatedCalling = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
  924:                                           AlarmCall = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
  925:                                           CallerId = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
  926:                                           CallForwarding = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
  927:                                           CallWaiting = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
  928:                                           ConferenceCall = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
  929:                                           InternationalCalling = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
  930:                                           InternationalCallingUserControlled = Ia.Ftn.Cl.Models.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
  931:                                           //ServiceSuspention = Ia.Ftn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
  932:                                           Created = s.Created,
  933:                                           Updated = s.Updated,
  934:                                       }).ToList();
  935:  
  936:                     subPartyList = (from sp in db.SubParties
  937:                                     where partyIdList.Contains(sp.PartyId)
  938:                                     select new Ia.Ftn.Cl.Models.Ui.Nokia.SubParty()
  939:                                     {
  940:                                         Id = sp.Id,
  941:                                         PartyId = sp.PartyId,
  942:                                         PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
  943:                                         DisplayName = sp.DisplayName,
  944:                                         Category = sp.Category,
  945:                                         AssocOtasRealm = sp.AssocOtasRealm,
  946:                                         ServiceSuspension = sp.ServiceSuspension,
  947:                                         Created = sp.Created,
  948:                                         Updated = sp.Updated
  949:                                     }).ToList();
  950:  
  951:  
  952:                     sbrList = (from h in db.Sbrs
  953:                                where impuSipDomainList.Contains(h.IMPU)
  954:                                select new Ia.Ftn.Cl.Models.Ui.Huawei.Sbr()
  955:                                {
  956:                                    COP = h.COP,
  957:                                    CSC = h.CSC,
  958:                                    Id = h.Id,
  959:                                    IMPU = h.IMPU,
  960:                                    ITT = h.ITT,
  961:                                    LP = h.LP,
  962:                                    NS3PTY = h.NS3PTY,
  963:                                    NSABRC = h.NSABRC,
  964:                                    NSCBA = h.NSCBA,
  965:                                    NSCFU = h.NSCFU,
  966:                                    NSCLIP = h.NSCLIP,
  967:                                    NSCW = h.NSCW,
  968:                                    NSFAX = h.NSFAX,
  969:                                    NSHOLD = h.NSHOLD,
  970:                                    NSNPTY = h.NSNPTY,
  971:                                    NSWAKE_UP = h.NSWAKE_UP,
  972:                                    Created = h.Created,
  973:                                    Updated = h.Updated
  974:                                }).ToList();
  975:  
  976:                     owsbrList = (from o in db.Owsbrs where impuSipDomainList.Contains(o.IMPU) select o).ToList();
  977:  
  978:                     serviceRequestList = (from sr in db.ServiceRequests where numberList.Contains(sr.Number) select sr).ToList();
  979:                     serviceRequestAdministrativeIssueList = (from srai in db.ServiceRequestAdministrativeIssues where serviceIdList.Contains(srai.Service) select srai).ToList();
  980:  
  981:                     //serviceRequestHistoryList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.ServiceRequestList(serviceRequestHistoryIdList);
  982:                     serviceRequestTypeList = (from srt in db.ServiceRequestTypes
  983:                                               join sr in db.ServiceRequests on srt.ServiceRequest equals sr
  984:                                               where numberList.Contains(sr.Number)
  985:                                               select srt).ToList();
  986:  
  987:                     reportList = (from r in db.Reports where service2IdList.Contains(r.Service) select r).Include(u => u.ReportHistories).ToList();
  988:  
  989:  
  990:                     nddOntList = new List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont>();
  991:                     nddOntList.Add(Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByIp(input));
  992:  
  993:                     foreach (var v in nddOntList) ontIdList.Add(v.Id);
  994:                     ontIdList = ontIdList.Distinct().ToList();
  995:  
  996:                     ontList = (from o in db.Onts where ontIdList.Contains(o.Id) select o).ToList();
  997:                     foreach (var v in ontList) ontIdList.Add(v.Id);
  998:                     ontIdList = ontIdList.Distinct().ToList();
  999:  
 1000:                     foreach (var v in ontList) if (v.Access != null) accessIdList.Add(v.Access.Id);
 1001:                     accessIdList = accessIdList.Distinct().ToList();
 1002:  
 1003:                     ontOntPotsList = (from op in db.OntOntPots where ontIdList.Contains(op.Ont.Id) select op).ToList();
 1004:                     ontServiceVoipList = (from ov in db.OntServiceVoips where ontIdList.Contains(ov.Ont.Id) select ov).ToList();
 1005:  
 1006:                     foreach (var v in nddOntList)
 1007:                     {
 1008:                         //eventSystemList.Add(v.Pon.PonGroup.Olt.AmsName);
 1009:                         //eventAidOntList.Add("ONT-1-1-" + v.Card + "-" + v.Port + "-" + v.Number);
 1010:                         //eventAidOntVoipList.Add("ONTVOIP-1-1-" + v.Card + "-" + v.Port + "-1");
 1011:  
 1012:                         //foreach (var w in ontOntPotsList) eventAidOntPotsList.Add("ONTPOTS-1-1-" + v.Card + "-" + v.Port + "-" + w.Card + "-" + w.Port);
 1013:                     }
 1014:  
 1015:                     //eventSystemList = eventSystemList.Distinct().ToList();
 1016:                     //eventAidOntList = eventAidOntList.Distinct().ToList();
 1017:                     //eventAidOntVoipList = eventAidOntVoipList.Distinct().ToList();
 1018:  
 1019:                     /*
 1020:                     eventList = (from e in db.Events where eventSystemList.Contains(e.System) where eventAidOntList.Contains(e.Aid) select e)
 1021:                                 .Union(from e in db.Events where eventSystemList.Contains(e.System) where eventAidOntList.Contains(e.Aid) where eventAidOntVoipList.Contains(e.Aid) select e)
 1022:                                 .Union(from e in db.Events where eventSystemList.Contains(e.System) where eventAidOntList.Contains(e.Aid) where eventAidOntPotsList.Contains(e.Aid) select e)
 1023:                                 .ToList();
 1024:                                 */
 1025:  
 1026:                     accessList = (from a in db.Accesses where accessIdList.Contains(a.Id) select a).ToList();
 1027:                 }
 1028:             }
 1029:             catch (Exception ex)
 1030:             {
 1031:                 result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 1032:             }
 1033:         }
 1034:  
 1035:         ////////////////////////////////////////////////////////////////////////////
 1036:         ////////////////////////////////////////////////////////////////////////////
 1037:  
 1038:         /// <summary>
 1039:         ///
 1040:         /// </summary>
 1041:         public static void Number(ref Ia.Cl.Models.Stopwatch stopwatch,
 1042:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1043:             bool enqueueIntoMessageQueue,
 1044:             string input,
 1045:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1046:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1047:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1048:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1049:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1050:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1051:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1052:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1053:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1054:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1055:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1056:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 1057:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 1058:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 1059:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 1060:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 1061:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 1062:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 1063:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 1064:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 1065:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 1066:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 1067:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 1068:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 1069:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 1070:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 1071:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 1072:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 1073:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 1074:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 1075:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 1076:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 1077:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 1078:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 1079:             out Ia.Cl.Models.Result result)
 1080:         {
 1081:             string service;
 1082:  
 1083:             var serviceList = new List<string>();
 1084:  
 1085:             result = new Ia.Cl.Models.Result();
 1086:  
 1087:             service2List = null;
 1088:             agcfGatewayRecordList = null;
 1089:             agcfEndpointList = null;
 1090:             mgwList = null;
 1091:             asbrList = null;
 1092:             subPartyList = null;
 1093:             subscriberList = null;
 1094:             sbrList = null;
 1095:             owsbrList = null;
 1096:             seruattrList = null;
 1097:             axeSubscriberList = null;
 1098:             ewsdSubscriberList = null;
 1099:             nddOntList = null;
 1100:             ontList = null;
 1101:             ontServiceVoipList = null;
 1102:             ontOntPotsList = null;
 1103:             emsDevList = null;
 1104:             emsBoardList = null;
 1105:             emsPortList = null;
 1106:             emsOntList = null;
 1107:             emsOntSipInfoList = null;
 1108:             emsVoipPstnUserList = null;
 1109:             emsVagList = null;
 1110:             eventList = null;
 1111:             accessList = null;
 1112:             serviceRequestServiceList = null;
 1113:             serviceRequestList = null;
 1114:             serviceRequestAdministrativeIssueList = null;
 1115:             serviceRequestHistoryList = null;
 1116:             serviceRequestTypeList = null;
 1117:             serviceRequestOntList = null;
 1118:             serviceRequestOntDetailList = null;
 1119:             reportList = null;
 1120:             reportHistoryList = null;
 1121:  
 1122:             stopwatch.RecordElapsedMilliseconds("A");
 1123:  
 1124:             service = Ia.Ftn.Cl.Models.Business.NumberFormatConverter.Service(input.ToLower());
 1125:  
 1126:             if (Ia.Ftn.Cl.Models.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
 1127:             {
 1128:                 if (Ia.Ftn.Cl.Models.Business.Authority.NumberIsWithinFrameworkSiteDomainList(framework, service))
 1129:                 {
 1130:                     serviceList.Add(service);
 1131:  
 1132:                     Ia.Ftn.Cl.Models.Business.Maintenance.Find.NumberTwo(ref stopwatch, framework, enqueueIntoMessageQueue, serviceList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 1133:                 }
 1134:                 else
 1135:                 {
 1136:                     result.AddError("Number " + service + " is not in staff site domain (الرقم لا ينتمي لنطاقات المستخدم). ");
 1137:                 }
 1138:             }
 1139:             else
 1140:             {
 1141:                 result.AddError("The number \"" + input + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
 1142:             }
 1143:  
 1144:             stopwatch.RecordElapsedMilliseconds("M");
 1145:         }
 1146:  
 1147:         ////////////////////////////////////////////////////////////////////////////
 1148:  
 1149:         /// <summary>
 1150:         ///
 1151:         /// </summary>
 1152:         public static void Number(ref Ia.Cl.Models.Stopwatch stopwatch,
 1153:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1154:             bool enqueueIntoMessageQueue,
 1155:             List<string> inputList,
 1156:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1157:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1158:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1159:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1160:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1161:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1162:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1163:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1164:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1165:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1166:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1167:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 1168:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 1169:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 1170:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 1171:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 1172:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 1173:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 1174:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 1175:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 1176:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 1177:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 1178:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 1179:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 1180:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 1181:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 1182:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 1183:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 1184:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 1185:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 1186:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 1187:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 1188:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 1189:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 1190:             out Ia.Cl.Models.Result result)
 1191:         {
 1192:             string service;
 1193:  
 1194:             var serviceList = new List<string>();
 1195:  
 1196:             result = new Ia.Cl.Models.Result();
 1197:  
 1198:             service2List = null;
 1199:             agcfGatewayRecordList = null;
 1200:             agcfEndpointList = null;
 1201:             mgwList = null;
 1202:             asbrList = null;
 1203:             subPartyList = null;
 1204:             subscriberList = null;
 1205:             sbrList = null;
 1206:             owsbrList = null;
 1207:             seruattrList = null;
 1208:             axeSubscriberList = null;
 1209:             ewsdSubscriberList = null;
 1210:             nddOntList = null;
 1211:             ontList = null;
 1212:             ontServiceVoipList = null;
 1213:             ontOntPotsList = null;
 1214:             emsDevList = null;
 1215:             emsBoardList = null;
 1216:             emsPortList = null;
 1217:             emsOntList = null;
 1218:             emsOntSipInfoList = null;
 1219:             emsVoipPstnUserList = null;
 1220:             emsVagList = null;
 1221:             eventList = null;
 1222:             accessList = null;
 1223:             serviceRequestServiceList = null;
 1224:             serviceRequestList = null;
 1225:             serviceRequestAdministrativeIssueList = null;
 1226:             serviceRequestHistoryList = null;
 1227:             serviceRequestTypeList = null;
 1228:             serviceRequestOntList = null;
 1229:             serviceRequestOntDetailList = null;
 1230:             reportList = null;
 1231:             reportHistoryList = null;
 1232:  
 1233:             foreach (var input in inputList)
 1234:             {
 1235:                 service = Ia.Ftn.Cl.Models.Business.NumberFormatConverter.Service(input.ToLower());
 1236:  
 1237:                 if (Ia.Ftn.Cl.Models.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
 1238:                 {
 1239:                     if (Ia.Ftn.Cl.Models.Business.Authority.NumberIsWithinFrameworkSiteDomainList(framework, service))
 1240:                     {
 1241:                         serviceList.Add(service);
 1242:  
 1243:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.NumberTwo(ref stopwatch, framework, enqueueIntoMessageQueue, serviceList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 1244:                     }
 1245:                     else
 1246:                     {
 1247:                         result.AddError("Number " + service + " is not in staff site domain (الرقم لا ينتمي لنطاقات المستخدم). ");
 1248:                     }
 1249:                 }
 1250:                 else
 1251:                 {
 1252:                     result.AddError("The number \"" + input + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
 1253:                 }
 1254:             }
 1255:         }
 1256:  
 1257:         ////////////////////////////////////////////////////////////////////////////
 1258:  
 1259:         /// <summary>
 1260:         ///
 1261:         /// </summary>
 1262:         private static void NumberTwo(ref Ia.Cl.Models.Stopwatch stopwatch,
 1263:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1264:             bool enqueueIntoMessageQueue,
 1265:             List<string> serviceList,
 1266:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1267:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1268:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1269:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1270:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1271:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1272:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1273:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1274:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1275:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1276:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1277:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 1278:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 1279:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 1280:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 1281:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 1282:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 1283:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 1284:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 1285:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 1286:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 1287:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 1288:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 1289:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 1290:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 1291:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 1292:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 1293:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 1294:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 1295:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 1296:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 1297:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 1298:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 1299:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 1300:             out Ia.Cl.Models.Result result)
 1301:         {
 1302:             service2List = null;
 1303:             agcfGatewayRecordList = null;
 1304:             agcfEndpointList = null;
 1305:             mgwList = null;
 1306:             asbrList = null;
 1307:             subPartyList = null;
 1308:             subscriberList = null;
 1309:             sbrList = null;
 1310:             owsbrList = null;
 1311:             seruattrList = null;
 1312:             axeSubscriberList = null;
 1313:             ewsdSubscriberList = null;
 1314:             nddOntList = null;
 1315:             ontList = null;
 1316:             ontServiceVoipList = null;
 1317:             ontOntPotsList = null;
 1318:             emsDevList = null;
 1319:             emsBoardList = null;
 1320:             emsPortList = null;
 1321:             emsOntList = null;
 1322:             emsOntSipInfoList = null;
 1323:             emsVoipPstnUserList = null;
 1324:             emsVagList = null;
 1325:             eventList = null;
 1326:             accessList = null;
 1327:             serviceRequestServiceList = null;
 1328:             serviceRequestList = null;
 1329:             serviceRequestAdministrativeIssueList = null;
 1330:             serviceRequestHistoryList = null;
 1331:             serviceRequestTypeList = null;
 1332:             serviceRequestOntList = null;
 1333:             serviceRequestOntDetailList = null;
 1334:             reportList = null;
 1335:             reportHistoryList = null;
 1336:  
 1337:             var serviceLongList = new List<long>();
 1338:             var numberList = new List<int>();
 1339:             var partyIdList = new List<string>();
 1340:             var prividUserList = new List<string>();
 1341:             var impuSipDomainList = new List<string>();
 1342:             var sipUserNameList = new List<string>();
 1343:             var serviceWithCountryCodeList = new List<string>();
 1344:             var serviceIdList = new List<string>();
 1345:  
 1346:             var subscriberIdList = new List<string>();
 1347:             var subPartyIdList = new List<string>();
 1348:             var agcfEndpointIdList = new List<string>();
 1349:             var agcfGatewayRecordIdList = new List<int>();
 1350:             var gatewayIdList = new List<int>();
 1351:  
 1352:             var asbrIdList = new List<string>();
 1353:             var mgwIdList = new List<string>();
 1354:  
 1355:             var sbrImpuList = new List<string>();
 1356:             var owsbrImpuList = new List<string>();
 1357:  
 1358:             var ontIdList = new List<string>();
 1359:             var ontOntPotsIdList = new List<string>();
 1360:             var ontServiceVoipIdList = new List<string>();
 1361:             var ontServiceVoipIpList = new List<string>();
 1362:  
 1363:             var ipList = new List<string>();
 1364:  
 1365:             var emsDevIdList = new List<int>();
 1366:             var emsBoardIdList = new List<string>();
 1367:             var emsPortIdList = new List<string>();
 1368:             var emsOntIdList = new List<string>();
 1369:             var emsVoipPstnUserIdList = new List<string>();
 1370:  
 1371:             result = new Ia.Cl.Models.Result();
 1372:  
 1373:             stopwatch.RecordElapsedMilliseconds("B");
 1374:  
 1375:             var switchVendorList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.SwitchVendorListByServiceList(serviceList);
 1376:  
 1377:             var serviceListHasANumberThatIsWithinMsanDomainList = Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinMsanDomainList(serviceList);
 1378:  
 1379:             try
 1380:             {
 1381:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 1382:  
 1383:                 // Who uses serviceId: AxeSubscribers,EwsdSubscriners,Seruattrs,Service2,ServiceExemptions,ServiceRequestServices: Id is seviceId
 1384:                 stopwatch.RecordElapsedMilliseconds("C0");
 1385:  
 1386:                 var service2IdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.Service2IdListFromServiceIdList(serviceIdList);
 1387:                 stopwatch.RecordElapsedMilliseconds("C1");
 1388:  
 1389:                 if (switchVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia))
 1390:                 {
 1391:                     subscriberIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
 1392:                     stopwatch.RecordElapsedMilliseconds("C2");
 1393:  
 1394:                     subPartyIdList = subscriberIdList; // Ia.Ftn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
 1395:  
 1396:                     agcfEndpointIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfEndpointIdListFromPrividUserList(prividUserList);
 1397:                     stopwatch.RecordElapsedMilliseconds("C4");
 1398:  
 1399:                     agcfGatewayRecordIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordIdListFromAgcfEndpointIdList(agcfEndpointIdList);
 1400:                     stopwatch.RecordElapsedMilliseconds("C5");
 1401:  
 1402:                     gatewayIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.GatewayIdFromAgcfGatewayRecordIdListList(agcfGatewayRecordIdList);
 1403:  
 1404:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 1405:                 }
 1406:  
 1407:                 if (switchVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei))
 1408:                 {
 1409:                     if (Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinSoftXServer(serviceList))
 1410:                     {
 1411:                         asbrIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AsbrIdListFromImpuSipDomainList(impuSipDomainList);
 1412:                         mgwIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.MgwIdListFromAsbrIdList(asbrIdList);
 1413:                     }
 1414:  
 1415:                     sbrImpuList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SbrImpuListFromImpuSipDomainList(impuSipDomainList);
 1416:                     owsbrImpuList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OwSbrImpuListFromImpuSipDomainList(impuSipDomainList);
 1417:  
 1418:                     Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 1419:                 }
 1420:  
 1421:                 stopwatch.RecordElapsedMilliseconds("D");
 1422:  
 1423:                 var serviceRequestServiceIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceIdListFromServiceIdList(serviceIdList);
 1424:                 stopwatch.RecordElapsedMilliseconds("D2");
 1425:  
 1426:                 var accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromServiceIdList(serviceIdList);
 1427:                 accessIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
 1428:                 accessIdList = accessIdList.Distinct().ToList();
 1429:  
 1430:                 stopwatch.RecordElapsedMilliseconds("D3");
 1431:  
 1432:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(service2IdList, ref serviceList);
 1433:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 1434:  
 1435:                 stopwatch.RecordElapsedMilliseconds("D4");
 1436:  
 1437:                 var reportIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportIdListFromServiceList(serviceList);
 1438:                 stopwatch.RecordElapsedMilliseconds("D41");
 1439:  
 1440:                 reportIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportIdListFromAccessIdList(accessIdList));
 1441:                 stopwatch.RecordElapsedMilliseconds("D42");
 1442:  
 1443:                 reportIdList = reportIdList.Distinct().ToList();
 1444:  
 1445:                 var serviceRequestIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
 1446:                 stopwatch.RecordElapsedMilliseconds("D52");
 1447:  
 1448:                 serviceRequestIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
 1449:                 stopwatch.RecordElapsedMilliseconds("D53");
 1450:  
 1451:                 serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
 1452:  
 1453:                 stopwatch.RecordElapsedMilliseconds("D6");
 1454:  
 1455:                 var serviceRequestAdministrativeIssueIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestAdministrativeIssueIdListFromServiceIdList(serviceIdList);
 1456:                 stopwatch.RecordElapsedMilliseconds("D7");
 1457:  
 1458:                 var serviceRequestHistoryIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
 1459:                 stopwatch.RecordElapsedMilliseconds("D71");
 1460:  
 1461:                 var serviceRequestTypeIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestTypeIdListFromServiceRequestIdList(serviceRequestIdList);
 1462:                 stopwatch.RecordElapsedMilliseconds("D72");
 1463:  
 1464:                 var serviceRequestOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntIdListFromAccessIdList(accessIdList);
 1465:                 stopwatch.RecordElapsedMilliseconds("D73");
 1466:  
 1467:                 stopwatch.RecordElapsedMilliseconds("D8");
 1468:  
 1469:                 var nddOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntIdListFromAccessIdList(accessIdList);
 1470:                 nddOntIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntIdListFromEmsOntSipInfoListAndEmsVoipPstnUserListByServiceList(serviceList));
 1471:                 nddOntIdList = nddOntIdList.Distinct().ToList();
 1472:  
 1473:                 var accessVendorList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessVendorListByOntIdList(nddOntIdList);
 1474:  
 1475:                 stopwatch.RecordElapsedMilliseconds("E");
 1476:  
 1477:                 if (accessVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia))
 1478:                 {
 1479:                     ontIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntIdListFromNddOntIdList(nddOntIdList);
 1480:                     ontOntPotsIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntOntPotsIdListFromOntIdList(ontIdList);
 1481:                     ontServiceVoipIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipsIdListFromOntIdList(ontIdList);
 1482:                     ontServiceVoipIpList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipIpList(ontServiceVoipIdList);
 1483:  
 1484:                     stopwatch.RecordElapsedMilliseconds("E1");
 1485:  
 1486:                     ipList = ontServiceVoipIpList;
 1487:                 }
 1488:  
 1489:                 if (accessVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei) || serviceListHasANumberThatIsWithinMsanDomainList)
 1490:                 {
 1491:                     emsOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntIdListFromNddOntIdList(nddOntIdList);
 1492:                     stopwatch.RecordElapsedMilliseconds("E2");
 1493:  
 1494:                     emsVoipPstnUserIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserIdListFromServiceList(serviceList);
 1495:                     //emsVoipPstnUserIdList.AddRange(Ia.Ftn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserIdListFromEmsOntIdList(emsOntIdList)); will display other numbers, which is not appropriate
 1496:                     //emsVoipPstnUserIdList = emsVoipPstnUserIdList.Distinct().ToList();
 1497:                     stopwatch.RecordElapsedMilliseconds("E3");
 1498:  
 1499:                     emsPortIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortIdListFromEmsOntIdList(emsOntIdList);
 1500:                     emsPortIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
 1501:                     emsPortIdList = emsPortIdList.Distinct().ToList();
 1502:                     stopwatch.RecordElapsedMilliseconds("E4");
 1503:  
 1504:                     emsBoardIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardIdListFromEmsPortIdList(emsPortIdList);
 1505:                     emsBoardIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardIdListFromAccessIdList(accessIdList));
 1506:                     emsBoardIdList = emsBoardIdList.Distinct().ToList();
 1507:                     stopwatch.RecordElapsedMilliseconds("E5");
 1508:  
 1509:                     emsDevIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevIdListFromEmsBoardIdList(emsBoardIdList);
 1510:                     emsDevIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevIdListFromAccessIdList(accessIdList));
 1511:                     //emsDevIdList.AddRange(Ia.Ftn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
 1512:                     emsDevIdList = emsDevIdList.Distinct().ToList();
 1513:                     stopwatch.RecordElapsedMilliseconds("E6");
 1514:  
 1515:                     ipList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntIpListFromNddOntIdList(nddOntIdList));
 1516:                     ipList = ipList.Distinct().ToList();
 1517:                 }
 1518:  
 1519:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 1520:  
 1521:                 stopwatch.RecordElapsedMilliseconds("F");
 1522:  
 1523:                 /////////////////////////////////
 1524:  
 1525:                 agcfGatewayRecordList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordList(agcfGatewayRecordIdList);
 1526:                 agcfEndpointList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfEndpointList(agcfEndpointIdList);
 1527:                 subPartyList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubPartyList(subPartyIdList);
 1528:                 subscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubscriberList(subscriberIdList);
 1529:  
 1530:                 mgwList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.MgwList(mgwIdList);
 1531:                 asbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AsbrList(asbrIdList);
 1532:  
 1533:                 sbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SbrList(sbrImpuList);
 1534:                 owsbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OwsbrList(owsbrImpuList);
 1535:  
 1536:                 stopwatch.RecordElapsedMilliseconds("G");
 1537:  
 1538:                 if (Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(serviceList))
 1539:                 {
 1540:                     seruattrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SeruattrListFromServiceIdList(serviceIdList);
 1541:                 }
 1542:  
 1543:                 axeSubscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AxeSubscriberListFromServiceIdList(serviceIdList);
 1544:                 ewsdSubscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EwsdSubscriberListFromServiceIdList(serviceIdList);
 1545:  
 1546:                 ontList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntList(ontIdList);
 1547:                 ontOntPotsList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntOntPotsListFromOntOntPotsIdList(ontOntPotsIdList);
 1548:                 ontServiceVoipList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipList(ontServiceVoipIdList);
 1549:  
 1550:                 emsDevList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevList(emsDevIdList);
 1551:                 emsBoardList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardList(emsBoardIdList);
 1552:                 emsPortList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortList(emsPortIdList);
 1553:                 emsOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntList(emsOntIdList);
 1554:  
 1555:                 emsOntSipInfoList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdListAndService(emsOntIdList, sipUserNameList);
 1556:                 emsVoipPstnUserList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserList(emsVoipPstnUserIdList);
 1557:                 emsVagList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
 1558:  
 1559:                 stopwatch.RecordElapsedMilliseconds("H");
 1560:  
 1561:                 service2List = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceList(service2IdList);
 1562:                 stopwatch.RecordElapsedMilliseconds("H2");
 1563:  
 1564:                 nddOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntList(nddOntIdList);
 1565:                 stopwatch.RecordElapsedMilliseconds("H3");
 1566:  
 1567:                 accessList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessList(accessIdList);
 1568:                 stopwatch.RecordElapsedMilliseconds("H4");
 1569:  
 1570:                 serviceRequestServiceList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceList(serviceRequestServiceIdList);
 1571:                 stopwatch.RecordElapsedMilliseconds("H5");
 1572:  
 1573:                 serviceRequestList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestList(serviceRequestIdList);
 1574:                 stopwatch.RecordElapsedMilliseconds("H51");
 1575:  
 1576:                 serviceRequestAdministrativeIssueList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestAdministrativeIssueList(serviceRequestAdministrativeIssueIdList);
 1577:                 stopwatch.RecordElapsedMilliseconds("H52");
 1578:  
 1579:                 serviceRequestHistoryList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
 1580:                 stopwatch.RecordElapsedMilliseconds("H53");
 1581:  
 1582:                 serviceRequestTypeList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestTypeList(serviceRequestTypeIdList);
 1583:                 stopwatch.RecordElapsedMilliseconds("H54");
 1584:  
 1585:                 serviceRequestOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntList(serviceRequestOntIdList);
 1586:                 stopwatch.RecordElapsedMilliseconds("H55");
 1587:  
 1588:                 serviceRequestOntDetailList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntDetailFromServieListList(serviceList); // more appropriate to display records related to the service numbers only
 1589:                 stopwatch.RecordElapsedMilliseconds("H66");
 1590:  
 1591:                 reportList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportList(reportIdList);
 1592:                 stopwatch.RecordElapsedMilliseconds("H7");
 1593:  
 1594:                 if (enqueueIntoMessageQueue)
 1595:                 {
 1596:                     foreach (var service in serviceList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadService, service);
 1597:                     foreach (var nddOnt in nddOntList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadAccess, nddOnt.Access.Name);
 1598:                     foreach (var gatewayId in gatewayIdList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadGateway, gatewayId);
 1599:                 }
 1600:  
 1601:                 stopwatch.RecordElapsedMilliseconds("I");
 1602:             }
 1603:             catch (Exception ex)
 1604:             {
 1605:                 stopwatch.RecordElapsedMilliseconds("Exception");
 1606:  
 1607:                 result.AddError("Exception: Retrieval error of data for \"" + string.Join(", ", serviceList) + "\": " + ex.ToString());
 1608:             }
 1609:         }
 1610:  
 1611:         ////////////////////////////////////////////////////////////////////////////
 1612:         ////////////////////////////////////////////////////////////////////////////
 1613:  
 1614:         /// <summary>
 1615:         ///
 1616:         /// </summary>
 1617:         public static void OntName(ref Ia.Cl.Models.Stopwatch stopwatch,
 1618:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1619:             bool enqueueIntoMessageQueue,
 1620:             string rawInput,
 1621:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1622:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1623:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1624:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1625:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1626:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1627:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1628:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1629:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1630:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1631:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1632:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 1633:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 1634:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 1635:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 1636:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 1637:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 1638:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 1639:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 1640:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 1641:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 1642:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 1643:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 1644:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 1645:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 1646:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 1647:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 1648:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 1649:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 1650:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 1651:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 1652:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 1653:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 1654:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 1655:             out Ia.Cl.Models.Result result)
 1656:         {
 1657:             string input;
 1658:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
 1659:             List<string> accessIdList, nddOntIdList, ipList;
 1660:  
 1661:             ipList = new List<string>();
 1662:             nddOntIdList = new List<string>();
 1663:             accessIdList = new List<string>();
 1664:  
 1665:             result = new Ia.Cl.Models.Result();
 1666:  
 1667:             service2List = null;
 1668:             agcfGatewayRecordList = null;
 1669:             agcfEndpointList = null;
 1670:             mgwList = null;
 1671:             asbrList = null;
 1672:             subPartyList = null;
 1673:             subscriberList = null;
 1674:             sbrList = null;
 1675:             owsbrList = null;
 1676:             seruattrList = null;
 1677:             axeSubscriberList = null;
 1678:             ewsdSubscriberList = null;
 1679:             nddOntList = null;
 1680:             ontList = null;
 1681:             ontServiceVoipList = null;
 1682:             ontOntPotsList = null;
 1683:             emsDevList = null;
 1684:             emsBoardList = null;
 1685:             emsPortList = null;
 1686:             emsOntList = null;
 1687:             emsOntSipInfoList = null;
 1688:             emsVoipPstnUserList = null;
 1689:             emsVagList = null;
 1690:             eventList = null;
 1691:             accessList = null;
 1692:             serviceRequestServiceList = null;
 1693:             serviceRequestList = null;
 1694:             serviceRequestAdministrativeIssueList = null;
 1695:             serviceRequestHistoryList = null;
 1696:             serviceRequestTypeList = null;
 1697:             serviceRequestOntList = null;
 1698:             serviceRequestOntDetailList = null;
 1699:             reportList = null;
 1700:             reportHistoryList = null;
 1701:  
 1702:             input = rawInput.ToUpper();
 1703:  
 1704:             stopwatch.RecordElapsedMilliseconds("A");
 1705:  
 1706:             nddOnt = Ia.Ftn.Cl.Models.Business.Default.NddOntUsingExtractedAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(input);
 1707:  
 1708:             if (nddOnt != null)
 1709:             {
 1710:                 if (Ia.Ftn.Cl.Models.Business.Authority.AccessNameIsWithinFrameworkSiteAreaSymbolList(framework, nddOnt.Access.Name))
 1711:                 {
 1712:                     try
 1713:                     {
 1714:                         ipList.Add(nddOnt.Ip);
 1715:  
 1716:                         accessIdList.Add(nddOnt.Access.Id);
 1717:  
 1718:                         nddOntIdList.Add(nddOnt.Id);
 1719:  
 1720:                         stopwatch.RecordElapsedMilliseconds("B");
 1721:  
 1722:                         OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMessageQueue, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 1723:                     }
 1724:                     catch (Exception ex)
 1725:                     {
 1726:                         result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 1727:                     }
 1728:                 }
 1729:                 else
 1730:                 {
 1731:                     result.AddError("Access " + nddOnt.Access.Name + " is not in staff site access list (رقم الجهاز لا ينتمي لمقسم المستخدم). ");
 1732:                 }
 1733:             }
 1734:             else
 1735:             {
 1736:                 result.AddError("The ONT \"" + rawInput + "\" does not belong to the network (الجهاز لا ينتمي للشبكة). ");
 1737:             }
 1738:         }
 1739:  
 1740:         ////////////////////////////////////////////////////////////////////////////
 1741:  
 1742:         /// <summary>
 1743:         ///
 1744:         /// </summary>
 1745:         public static void PonName(ref Ia.Cl.Models.Stopwatch stopwatch,
 1746:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1747:             bool enqueueIntoMessageQueue,
 1748:             string rawInput,
 1749:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1750:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1751:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1752:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1753:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1754:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1755:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1756:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1757:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1758:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1759:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1760:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 1761:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 1762:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 1763:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 1764:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 1765:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 1766:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 1767:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 1768:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 1769:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 1770:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 1771:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 1772:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 1773:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 1774:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 1775:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 1776:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 1777:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 1778:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 1779:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 1780:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 1781:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 1782:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 1783:             out Ia.Cl.Models.Result result)
 1784:         {
 1785:             int oltId, ponNumber;
 1786:             string input, ponName;
 1787:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pon nddPon;
 1788:             List<string> accessIdList, nddOntIdList, ipList;
 1789:  
 1790:             result = new Ia.Cl.Models.Result();
 1791:  
 1792:             service2List = null;
 1793:             agcfGatewayRecordList = null;
 1794:             agcfEndpointList = null;
 1795:             mgwList = null;
 1796:             asbrList = null;
 1797:             subPartyList = null;
 1798:             subscriberList = null;
 1799:             sbrList = null;
 1800:             owsbrList = null;
 1801:             seruattrList = null;
 1802:             axeSubscriberList = null;
 1803:             ewsdSubscriberList = null;
 1804:             nddOntList = null;
 1805:             ontList = null;
 1806:             ontServiceVoipList = null;
 1807:             ontOntPotsList = null;
 1808:             emsDevList = null;
 1809:             emsBoardList = null;
 1810:             emsPortList = null;
 1811:             emsOntList = null;
 1812:             emsOntSipInfoList = null;
 1813:             emsVoipPstnUserList = null;
 1814:             emsVagList = null;
 1815:             eventList = null;
 1816:             accessList = null;
 1817:             serviceRequestServiceList = null;
 1818:             serviceRequestList = null;
 1819:             serviceRequestAdministrativeIssueList = null;
 1820:             serviceRequestHistoryList = null;
 1821:             serviceRequestTypeList = null;
 1822:             serviceRequestOntList = null;
 1823:             serviceRequestOntDetailList = null;
 1824:             reportList = null;
 1825:             reportHistoryList = null;
 1826:  
 1827:             input = rawInput.ToUpper();
 1828:  
 1829:             ponName = Ia.Ftn.Cl.Models.Business.Default.ExtractPonNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(input);
 1830:  
 1831:             nddPon = (from p in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PonList where p.Name == ponName select p).SingleOrDefault();
 1832:  
 1833:             if (nddPon != null)
 1834:             {
 1835:                 oltId = nddPon.PonGroup.Olt.Id;
 1836:                 ponNumber = nddPon.Number;
 1837:  
 1838:                 try
 1839:                 {
 1840:                     ipList = new List<string>(); // pass empty
 1841:  
 1842:                     accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdList(oltId, ponNumber);
 1843:  
 1844:                     nddOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntIdList(oltId, ponNumber);
 1845:  
 1846:                     OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMessageQueue, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 1847:                 }
 1848:                 catch (Exception ex)
 1849:                 {
 1850:                     result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 1851:                 }
 1852:             }
 1853:             else
 1854:             {
 1855:                 result.AddError("The PON \"" + rawInput + "\" had a null values. ");
 1856:             }
 1857:         }
 1858:  
 1859:         ////////////////////////////////////////////////////////////////////////////
 1860:  
 1861:         /// <summary>
 1862:         ///
 1863:         /// </summary>
 1864:         public static void OntPosition(ref Ia.Cl.Models.Stopwatch stopwatch,
 1865:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1866:             bool enqueueIntoMessageQueue,
 1867:             string rawInput,
 1868:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1869:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1870:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1871:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1872:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1873:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1874:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1875:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1876:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1877:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1878:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1879:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 1880:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 1881:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 1882:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 1883:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 1884:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 1885:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 1886:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 1887:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 1888:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 1889:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 1890:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 1891:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 1892:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 1893:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 1894:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 1895:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 1896:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 1897:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 1898:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 1899:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 1900:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 1901:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 1902:             out Ia.Cl.Models.Result result)
 1903:         {
 1904:             int oltId, ponNumber, ontInternalNumber;
 1905:             string input;
 1906:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
 1907:             List<string> accessIdList, nddOntIdList, ipList;
 1908:  
 1909:             ipList = new List<string>();
 1910:  
 1911:             result = new Ia.Cl.Models.Result();
 1912:  
 1913:             service2List = null;
 1914:             agcfGatewayRecordList = null;
 1915:             agcfEndpointList = null;
 1916:             mgwList = null;
 1917:             asbrList = null;
 1918:             subPartyList = null;
 1919:             subscriberList = null;
 1920:             sbrList = null;
 1921:             owsbrList = null;
 1922:             seruattrList = null;
 1923:             axeSubscriberList = null;
 1924:             ewsdSubscriberList = null;
 1925:             nddOntList = null;
 1926:             ontList = null;
 1927:             ontServiceVoipList = null;
 1928:             ontOntPotsList = null;
 1929:             emsDevList = null;
 1930:             emsBoardList = null;
 1931:             emsPortList = null;
 1932:             emsOntList = null;
 1933:             emsOntSipInfoList = null;
 1934:             emsVoipPstnUserList = null;
 1935:             emsVagList = null;
 1936:             eventList = null;
 1937:             accessList = null;
 1938:             serviceRequestServiceList = null;
 1939:             serviceRequestList = null;
 1940:             serviceRequestAdministrativeIssueList = null;
 1941:             serviceRequestHistoryList = null;
 1942:             serviceRequestTypeList = null;
 1943:             serviceRequestOntList = null;
 1944:             serviceRequestOntDetailList = null;
 1945:             reportList = null;
 1946:             reportHistoryList = null;
 1947:  
 1948:             input = rawInput.ToUpper();
 1949:  
 1950:             nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByPosition(input);
 1951:  
 1952:             if (nddOnt != null)
 1953:             {
 1954:                 oltId = nddOnt.Pon.PonGroup.Olt.Id;
 1955:                 ponNumber = nddOnt.Pon.Number;
 1956:                 ontInternalNumber = nddOnt.InternalNumber;
 1957:  
 1958:                 try
 1959:                 {
 1960:                     ipList.Add(nddOnt.Ip);
 1961:  
 1962:                     accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdList(oltId, ponNumber, ontInternalNumber);
 1963:  
 1964:                     nddOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntIdList(oltId, ponNumber, ontInternalNumber);
 1965:  
 1966:                     OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMessageQueue, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 1967:                 }
 1968:                 catch (Exception ex)
 1969:                 {
 1970:                     result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 1971:                 }
 1972:             }
 1973:             else
 1974:             {
 1975:                 result.AddError("The ONT position \"" + rawInput + "\" was not found in the network. ");
 1976:             }
 1977:         }
 1978:  
 1979:         ////////////////////////////////////////////////////////////////////////////
 1980:  
 1981:         /// <summary>
 1982:         ///
 1983:         /// </summary>
 1984:         public static void MsanDevLicPosition(ref Ia.Cl.Models.Stopwatch stopwatch,
 1985:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 1986:             bool enqueueIntoMessageQueue,
 1987:             string input,
 1988:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 1989:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 1990:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 1991:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 1992:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 1993:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 1994:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 1995:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 1996:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 1997:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 1998:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 1999:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 2000:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 2001:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 2002:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 2003:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 2004:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 2005:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 2006:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 2007:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 2008:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 2009:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 2010:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 2011:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 2012:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 2013:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 2014:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 2015:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 2016:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 2017:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 2018:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 2019:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 2020:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 2021:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 2022:             out Ia.Cl.Models.Result result)
 2023:         {
 2024:             string service;
 2025:  
 2026:             var serviceList = new List<string>();
 2027:  
 2028:             result = new Ia.Cl.Models.Result();
 2029:  
 2030:             service2List = null;
 2031:             agcfGatewayRecordList = null;
 2032:             agcfEndpointList = null;
 2033:             mgwList = null;
 2034:             asbrList = null;
 2035:             subPartyList = null;
 2036:             subscriberList = null;
 2037:             sbrList = null;
 2038:             owsbrList = null;
 2039:             seruattrList = null;
 2040:             axeSubscriberList = null;
 2041:             ewsdSubscriberList = null;
 2042:             nddOntList = null;
 2043:             ontList = null;
 2044:             ontServiceVoipList = null;
 2045:             ontOntPotsList = null;
 2046:             emsDevList = null;
 2047:             emsBoardList = null;
 2048:             emsPortList = null;
 2049:             emsOntList = null;
 2050:             emsOntSipInfoList = null;
 2051:             emsVoipPstnUserList = null;
 2052:             emsVagList = null;
 2053:             eventList = null;
 2054:             accessList = null;
 2055:             serviceRequestServiceList = null;
 2056:             serviceRequestList = null;
 2057:             serviceRequestAdministrativeIssueList = null;
 2058:             serviceRequestHistoryList = null;
 2059:             serviceRequestTypeList = null;
 2060:             serviceRequestOntList = null;
 2061:             serviceRequestOntDetailList = null;
 2062:             reportList = null;
 2063:             reportHistoryList = null;
 2064:  
 2065:             stopwatch.RecordElapsedMilliseconds("A");
 2066:  
 2067:             var lic = Ia.Ftn.Cl.Models.Business.Huawei.Dev.MsanDev.Lic.Parse(input);
 2068:  
 2069:             if (lic != null)
 2070:             {
 2071:                 service = lic.Service;
 2072:  
 2073:                 if (Ia.Ftn.Cl.Models.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
 2074:                 {
 2075:                     if (Ia.Ftn.Cl.Models.Business.Authority.NumberIsWithinFrameworkSiteDomainList(framework, service))
 2076:                     {
 2077:                         serviceList.Add(service);
 2078:  
 2079:                         Ia.Ftn.Cl.Models.Business.Maintenance.Find.NumberTwo(ref stopwatch, framework, enqueueIntoMessageQueue, serviceList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 2080:                     }
 2081:                     else
 2082:                     {
 2083:                         result.AddError("Number " + service + " is not in staff site domain (الرقم لا ينتمي لنطاقات المستخدم). ");
 2084:                     }
 2085:                 }
 2086:                 else
 2087:                 {
 2088:                     result.AddError("The number \"" + input + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
 2089:                 }
 2090:  
 2091:                 stopwatch.RecordElapsedMilliseconds("M");
 2092:             }
 2093:             else
 2094:             {
 2095:                 result.AddError("The LIC \"" + input + "\" is empty or does not belong to the network (رقم الربط شاغر أو لا ينتمي للشبكة).");
 2096:             }
 2097:         }
 2098:  
 2099:         ////////////////////////////////////////////////////////////////////////////
 2100:  
 2101:         /// <summary>
 2102:         ///
 2103:         /// </summary>
 2104:         public static void Serial(ref Ia.Cl.Models.Stopwatch stopwatch,
 2105:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 2106:             bool enqueueIntoMessageQueue,
 2107:             string rawInput,
 2108:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 2109:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 2110:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 2111:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 2112:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 2113:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 2114:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 2115:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 2116:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 2117:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 2118:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 2119:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 2120:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 2121:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 2122:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 2123:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 2124:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 2125:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 2126:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 2127:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 2128:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 2129:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 2130:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 2131:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 2132:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 2133:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 2134:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 2135:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 2136:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 2137:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 2138:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 2139:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 2140:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 2141:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 2142:             out Ia.Cl.Models.Result result)
 2143:         {
 2144:             string input;
 2145:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor accessVendor;
 2146:             List<string> accessIdList, nddOntIdList, ipList;
 2147:  
 2148:             result = new Ia.Cl.Models.Result();
 2149:  
 2150:             service2List = null;
 2151:             agcfGatewayRecordList = null;
 2152:             agcfEndpointList = null;
 2153:             mgwList = null;
 2154:             asbrList = null;
 2155:             subPartyList = null;
 2156:             subscriberList = null;
 2157:             sbrList = null;
 2158:             owsbrList = null;
 2159:             seruattrList = null;
 2160:             axeSubscriberList = null;
 2161:             ewsdSubscriberList = null;
 2162:             nddOntList = null;
 2163:             ontList = null;
 2164:             ontServiceVoipList = null;
 2165:             ontOntPotsList = null;
 2166:             emsDevList = null;
 2167:             emsBoardList = null;
 2168:             emsPortList = null;
 2169:             emsOntList = null;
 2170:             emsOntSipInfoList = null;
 2171:             emsVoipPstnUserList = null;
 2172:             emsVagList = null;
 2173:             eventList = null;
 2174:             accessList = null;
 2175:             serviceRequestServiceList = null;
 2176:             serviceRequestList = null;
 2177:             serviceRequestAdministrativeIssueList = null;
 2178:             serviceRequestHistoryList = null;
 2179:             serviceRequestTypeList = null;
 2180:             serviceRequestOntList = null;
 2181:             serviceRequestOntDetailList = null;
 2182:             reportList = null;
 2183:             reportHistoryList = null;
 2184:  
 2185:             input = rawInput;
 2186:  
 2187:             if (Ia.Ftn.Cl.Models.Business.Nokia.Ont.IsValidSerialNumber(input))
 2188:             {
 2189:                 accessVendor = Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia;
 2190:  
 2191:                 accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromOntSerial(input.ToUpper());
 2192:             }
 2193:             else if (Ia.Ftn.Cl.Models.Business.Huawei.Ont.IsValidSerialNumber(input))
 2194:             {
 2195:                 accessVendor = Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei;
 2196:  
 2197:                 accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromEmsOntSerial(input.ToUpper());
 2198:             }
 2199:             else
 2200:             {
 2201:                 accessVendor = Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Undefined;
 2202:  
 2203:                 accessIdList = new List<string>();
 2204:             }
 2205:  
 2206:             if (accessVendor == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia || accessVendor == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei)
 2207:             {
 2208:                 if (accessIdList.Count > 0)
 2209:                 {
 2210:                     nddOntIdList = new List<string>();
 2211:                     ipList = new List<string>();
 2212:  
 2213:                     try
 2214:                     {
 2215:                         OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMessageQueue, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 2216:                     }
 2217:                     catch (Exception ex)
 2218:                     {
 2219:                         result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 2220:                     }
 2221:                 }
 2222:                 else
 2223:                 {
 2224:                     result.AddError("Did not find any accesses with serial number " + input.ToUpper() + " (لا يوجد جهاز برقم تسلسل). ");
 2225:                 }
 2226:             }
 2227:             else
 2228:             {
 2229:                 result.AddError("Access vendor is undefined (مزود الجهاز غير معرف). ");
 2230:             }
 2231:         }
 2232:  
 2233:         ////////////////////////////////////////////////////////////////////////////
 2234:  
 2235:         /// <summary>
 2236:         ///
 2237:         /// </summary>
 2238:         public static void Paci(ref Ia.Cl.Models.Stopwatch stopwatch,
 2239:             Ia.Ftn.Cl.Models.Business.Administration.Framework framework,
 2240:             bool enqueueIntoMessageQueue,
 2241:             string rawInput,
 2242:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 2243:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 2244:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 2245:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 2246:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 2247:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 2248:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 2249:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 2250:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 2251:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 2252:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 2253:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 2254:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 2255:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 2256:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 2257:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 2258:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 2259:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 2260:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 2261:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 2262:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 2263:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 2264:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 2265:             out List<Ia.Ftn.Cl.Models.Event> eventList,
 2266:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 2267:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 2268:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 2269:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 2270:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 2271:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 2272:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 2273:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 2274:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 2275:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList,
 2276:             out Ia.Cl.Models.Result result)
 2277:         {
 2278:             string input;
 2279:             List<string> accessIdList, nddOntIdList, ipList;
 2280:  
 2281:             result = new Ia.Cl.Models.Result();
 2282:  
 2283:             service2List = null;
 2284:             agcfGatewayRecordList = null;
 2285:             agcfEndpointList = null;
 2286:             mgwList = null;
 2287:             asbrList = null;
 2288:             subPartyList = null;
 2289:             subscriberList = null;
 2290:             sbrList = null;
 2291:             owsbrList = null;
 2292:             seruattrList = null;
 2293:             axeSubscriberList = null;
 2294:             ewsdSubscriberList = null;
 2295:             nddOntList = null;
 2296:             ontList = null;
 2297:             ontServiceVoipList = null;
 2298:             ontOntPotsList = null;
 2299:             emsDevList = null;
 2300:             emsBoardList = null;
 2301:             emsPortList = null;
 2302:             emsOntList = null;
 2303:             emsOntSipInfoList = null;
 2304:             emsVoipPstnUserList = null;
 2305:             emsVagList = null;
 2306:             eventList = null;
 2307:             accessList = null;
 2308:             serviceRequestServiceList = null;
 2309:             serviceRequestList = null;
 2310:             serviceRequestAdministrativeIssueList = null;
 2311:             serviceRequestHistoryList = null;
 2312:             serviceRequestTypeList = null;
 2313:             serviceRequestOntList = null;
 2314:             serviceRequestOntDetailList = null;
 2315:             reportList = null;
 2316:             reportHistoryList = null;
 2317:  
 2318:             input = rawInput.ToLower();
 2319:  
 2320:             if (int.TryParse(input, out int paci))
 2321:             {
 2322:                 accessIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessIdListFromPaci(paci);
 2323:  
 2324:                 if (accessIdList.Count > 0)
 2325:                 {
 2326:                     nddOntIdList = new List<string>();
 2327:                     ipList = new List<string>();
 2328:  
 2329:                     try
 2330:                     {
 2331:                         OntNameOrPonNameOrPositionOrSerialOrPaci(ref stopwatch, enqueueIntoMessageQueue, nddOntIdList, accessIdList, ipList, out service2List, out agcfGatewayRecordList, out agcfEndpointList, out mgwList, out asbrList, out subPartyList, out subscriberList, out sbrList, 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);
 2332:                     }
 2333:                     catch (Exception ex)
 2334:                     {
 2335:                         result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 2336:                     }
 2337:                 }
 2338:                 else result.AddError("Did not find any accesses with PACI number " + input.ToUpper() + " (لا يوجد أي جهاز بالرقم المدني). ");
 2339:             }
 2340:             else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
 2341:         }
 2342:  
 2343:         ////////////////////////////////////////////////////////////////////////////
 2344:  
 2345:         /// <summary>
 2346:         ///
 2347:         /// </summary>
 2348:         public static void OntNameOrPonNameOrPositionOrSerialOrPaci(ref Ia.Cl.Models.Stopwatch stopwatch,
 2349:             bool enqueueIntoMessageQueue,
 2350:             List<string> nddOntIdList,
 2351:             List<string> accessIdList,
 2352:             List<string> ipList,
 2353:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 2354:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
 2355:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
 2356:             out List<Ia.Ftn.Cl.Models.Huawei.Mgw> mgwList,
 2357:             out List<Ia.Ftn.Cl.Models.Huawei.Asbr> asbrList,
 2358:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.SubParty> subPartyList,
 2359:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 2360:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 2361:             out List<Ia.Ftn.Cl.Models.Huawei.Owsbr> owsbrList,
 2362:             out List<Ia.Ftn.Cl.Models.Huawei.Seruattr> seruattrList,
 2363:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 2364:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 2365:             out List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> nddOntList,
 2366:             out List<Ia.Ftn.Cl.Models.Ont> ontList,
 2367:             out List<Ia.Ftn.Cl.Models.OntServiceVoip> ontServiceVoipList,
 2368:             out List<Ia.Ftn.Cl.Models.OntOntPots> ontOntPotsList,
 2369:             out List<Ia.Ftn.Cl.Models.Huawei.EmsDev> emsDevList,
 2370:             out List<Ia.Ftn.Cl.Models.Huawei.EmsBoard> emsBoardList,
 2371:             out List<Ia.Ftn.Cl.Models.Huawei.EmsPort> emsPortList,
 2372:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt> emsOntList,
 2373:             out List<Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo> emsOntSipInfoList,
 2374:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
 2375:             out List<Ia.Ftn.Cl.Models.Huawei.EmsVag> emsVagList,
 2376:             out List<Ia.Ftn.Cl.Models.Event> amsEventList,
 2377:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 2378:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 2379:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 2380:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 2381:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 2382:             out List<Ia.Ftn.Cl.Models.ServiceRequestType> serviceRequestTypeList,
 2383:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 2384:             out List<Ia.Ftn.Cl.Models.ServiceRequestOntDetail> serviceRequestOntDetailList,
 2385:             out List<Ia.Ftn.Cl.Models.Report> reportList,
 2386:             out List<Ia.Ftn.Cl.Models.ReportHistory> reportHistoryList)
 2387:         {
 2388:             service2List = null;
 2389:             agcfGatewayRecordList = null;
 2390:             agcfEndpointList = null;
 2391:             mgwList = null;
 2392:             asbrList = null;
 2393:             subPartyList = null;
 2394:             subscriberList = null;
 2395:             sbrList = null;
 2396:             owsbrList = null;
 2397:             seruattrList = null;
 2398:             axeSubscriberList = null;
 2399:             ewsdSubscriberList = null;
 2400:             nddOntList = null;
 2401:             ontList = null;
 2402:             ontServiceVoipList = null;
 2403:             ontOntPotsList = null;
 2404:             emsDevList = null;
 2405:             emsBoardList = null;
 2406:             emsPortList = null;
 2407:             emsOntList = null;
 2408:             emsOntSipInfoList = null;
 2409:             emsVoipPstnUserList = null;
 2410:             emsVagList = null;
 2411:             amsEventList = null;
 2412:             accessList = null;
 2413:             serviceRequestServiceList = null;
 2414:             serviceRequestList = null;
 2415:             serviceRequestAdministrativeIssueList = null;
 2416:             serviceRequestHistoryList = null;
 2417:             serviceRequestTypeList = null;
 2418:             serviceRequestOntList = null;
 2419:             serviceRequestOntDetailList = null;
 2420:             reportList = null;
 2421:             reportHistoryList = null;
 2422:  
 2423:             var serviceList = new List<string>();
 2424:             var serviceLongList = new List<long>();
 2425:             var numberList = new List<int>();
 2426:             var partyIdList = new List<string>();
 2427:             var prividUserList = new List<string>();
 2428:             var impuSipDomainList = new List<string>();
 2429:             var sipUserNameList = new List<string>();
 2430:             var serviceWithCountryCodeList = new List<string>();
 2431:             var serviceIdList = new List<string>();
 2432:  
 2433:             var subscriberIdList = new List<string>();
 2434:             var subPartyIdList = new List<string>();
 2435:             var agcfEndpointIdList = new List<string>();
 2436:             var agcfGatewayRecordIdList = new List<int>();
 2437:             var gatewayIdList = new List<int>();
 2438:  
 2439:             var asbrIdList = new List<string>();
 2440:             var mgwIdList = new List<string>();
 2441:  
 2442:             var sbrImpuList = new List<string>();
 2443:             var owsbrImpuList = new List<string>();
 2444:  
 2445:             var ontIdList = new List<string>();
 2446:             var ontOntPotsIdList = new List<string>();
 2447:             var ontServiceVoipIdList = new List<string>();
 2448:             var ontServiceVoipIpList = new List<string>();
 2449:  
 2450:             var emsDevIdList = new List<int>();
 2451:             var emsBoardIdList = new List<string>();
 2452:             var emsPortIdList = new List<string>();
 2453:             var emsOntIdList = new List<string>();
 2454:             var emsVoipPstnUserIdList = new List<string>();
 2455:  
 2456:             stopwatch.RecordElapsedMilliseconds("C");
 2457:  
 2458:             nddOntIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntIdListFromAccessIdList(accessIdList));
 2459:             nddOntIdList = nddOntIdList.Distinct().ToList();
 2460:  
 2461:             var accessVendorList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessVendorListByOntIdList(nddOntIdList);
 2462:             var switchVendorList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.SwitchVendorListByOntIdList(nddOntIdList);
 2463:  
 2464:             stopwatch.RecordElapsedMilliseconds("D");
 2465:  
 2466:             var service2IdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceIdListFromAccessIdList(accessIdList);
 2467:  
 2468:             stopwatch.RecordElapsedMilliseconds("E");
 2469:  
 2470:             Ia.Ftn.Cl.Models.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(service2IdList, ref serviceList);
 2471:             Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 2472:  
 2473:  
 2474:             stopwatch.RecordElapsedMilliseconds("F");
 2475:  
 2476:             if (accessVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia))
 2477:             {
 2478:                 ontIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntIdListFromNddOntIdList(nddOntIdList);
 2479:                 ontOntPotsIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntOntPotsIdListFromOntIdList(ontIdList);
 2480:                 ontServiceVoipIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipsIdListFromOntIdList(ontIdList);
 2481:                 ontServiceVoipIpList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipIpList(ontServiceVoipIdList);
 2482:                 //amsEventIdList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.EventIdListFromNddOntIdList(nddOntIdList, 10);
 2483:  
 2484:                 ipList.AddRange(ontServiceVoipIpList);
 2485:                 ipList = ipList.Distinct().ToList();
 2486:             }
 2487:  
 2488:             stopwatch.RecordElapsedMilliseconds("G");
 2489:  
 2490:             var serviceListHasANumberThatIsWithinMsanDomainList = Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinMsanDomainList(serviceList);
 2491:  
 2492:             if (accessVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei) || serviceListHasANumberThatIsWithinMsanDomainList)
 2493:             {
 2494:                 emsOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntIdListFromNddOntIdList(nddOntIdList);
 2495:  
 2496:                 stopwatch.RecordElapsedMilliseconds("H");
 2497:  
 2498:                 emsVoipPstnUserIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserIdListFromEmsOntIdList(emsOntIdList);
 2499:                 emsVoipPstnUserIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserIdListFromServiceList(serviceList));
 2500:                 emsVoipPstnUserIdList = emsVoipPstnUserIdList.Distinct().ToList();
 2501:  
 2502:                 stopwatch.RecordElapsedMilliseconds("I");
 2503:  
 2504:                 emsPortIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortIdListFromEmsOntIdList(emsOntIdList);
 2505:                 emsPortIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
 2506:                 emsPortIdList = emsPortIdList.Distinct().ToList();
 2507:  
 2508:                 stopwatch.RecordElapsedMilliseconds("J");
 2509:  
 2510:                 emsBoardIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardIdListFromEmsPortIdList(emsPortIdList);
 2511:                 emsBoardIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardIdListFromAccessIdList(accessIdList));
 2512:                 emsBoardIdList = emsBoardIdList.Distinct().ToList();
 2513:  
 2514:                 stopwatch.RecordElapsedMilliseconds("K");
 2515:  
 2516:                 emsDevIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevIdListFromEmsBoardIdList(emsBoardIdList);
 2517:                 emsDevIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevIdListFromAccessIdList(accessIdList));
 2518:                 //emsDevIdList.AddRange(Ia.Ftn.Cl.Model.Data.Maintenance.Find.EmsDevIdListFromEmsVoipPstnUserIdList(emsVoipPstnUserIdList));
 2519:                 emsDevIdList = emsDevIdList.Distinct().ToList();
 2520:  
 2521:                 stopwatch.RecordElapsedMilliseconds("L");
 2522:  
 2523:                 ipList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntIpListFromNddOntIdList(nddOntIdList));
 2524:                 ipList = ipList.Distinct().ToList();
 2525:  
 2526:                 stopwatch.RecordElapsedMilliseconds("M");
 2527:  
 2528:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.CollectServiceListFromEmsOntSipInfoListAndEmsVoipPstnUserListByEmsOntIdList(emsOntIdList, ref serviceList);
 2529:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 2530:             }
 2531:  
 2532:             stopwatch.RecordElapsedMilliseconds("N");
 2533:  
 2534:             if (switchVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia))
 2535:             {
 2536:                 subscriberIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
 2537:                 subPartyIdList = subscriberIdList; // Ia.Ftn.Cl.Model.Data.Maintenance.Find.SubscriberIdListFromPartyIdList(partyIdList);
 2538:                 agcfEndpointIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfEndpointIdListFromPrividUserList(prividUserList);
 2539:  
 2540:                 stopwatch.RecordElapsedMilliseconds("O");
 2541:  
 2542:                 agcfGatewayRecordIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordIdListFromAgcfEndpointIdList(agcfEndpointIdList);
 2543:                 agcfGatewayRecordIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordIdListFromIpList(ipList));
 2544:                 agcfGatewayRecordIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordIdListFromNddOntIdList(nddOntIdList));
 2545:                 agcfGatewayRecordIdList = agcfGatewayRecordIdList.Distinct().ToList();
 2546:  
 2547:                 stopwatch.RecordElapsedMilliseconds("O4");
 2548:  
 2549:                 gatewayIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.GatewayIdFromAgcfGatewayRecordIdListList(agcfGatewayRecordIdList);
 2550:  
 2551:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 2552:             }
 2553:  
 2554:             stopwatch.RecordElapsedMilliseconds("P");
 2555:  
 2556:             var serviceRequestServiceIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceIdListFromAccessIdList(accessIdList);
 2557:  
 2558:             stopwatch.RecordElapsedMilliseconds("Q");
 2559:  
 2560:             Ia.Ftn.Cl.Models.Data.Maintenance.Find.UpdateServiceListFromServiceRequestServiceIdOrService2IdList(serviceRequestServiceIdList, ref serviceList);
 2561:             Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 2562:  
 2563:             stopwatch.RecordElapsedMilliseconds("R");
 2564:  
 2565:             serviceRequestServiceIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceIdListFromServiceIdList(serviceIdList));
 2566:             serviceRequestServiceIdList = serviceRequestServiceIdList.Distinct().ToList();
 2567:  
 2568:             stopwatch.RecordElapsedMilliseconds("S");
 2569:  
 2570:             var reportIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportIdListFromServiceList(serviceList);
 2571:             reportIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportIdListFromAccessIdList(accessIdList));
 2572:  
 2573:             stopwatch.RecordElapsedMilliseconds("T");
 2574:  
 2575:             service2IdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.Service2IdListFromServiceIdList(serviceIdList));
 2576:             service2IdList = service2IdList.Distinct().ToList();
 2577:  
 2578:             stopwatch.RecordElapsedMilliseconds("U");
 2579:  
 2580:             var serviceRequestIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
 2581:             serviceRequestIdList.AddRange(Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestIdListFromServiceRequestServiceIdList(serviceRequestServiceIdList));
 2582:             serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
 2583:  
 2584:             stopwatch.RecordElapsedMilliseconds("V");
 2585:  
 2586:             var serviceRequestAdministrativeIssueIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestAdministrativeIssueIdListFromServiceIdList(serviceIdList);
 2587:  
 2588:             stopwatch.RecordElapsedMilliseconds("W");
 2589:  
 2590:             var serviceRequestHistoryIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceAndRelatedChangedAndChangedToServiceList(serviceList);
 2591:             var serviceRequestTypeIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestTypeIdListFromServiceRequestIdList(serviceRequestIdList);
 2592:             var serviceRequestOntIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntIdListFromAccessIdList(accessIdList);
 2593:  
 2594:             if (switchVendorList.Contains(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei))
 2595:             {
 2596:                 if (Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinSoftXServer(serviceList))
 2597:                 {
 2598:                     stopwatch.RecordElapsedMilliseconds("X");
 2599:                     asbrIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AsbrIdListFromImpuSipDomainList(impuSipDomainList);
 2600:                     stopwatch.RecordElapsedMilliseconds("X1");
 2601:                     mgwIdList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.MgwIdListFromAsbrIdList(asbrIdList);
 2602:                     stopwatch.RecordElapsedMilliseconds("X2");
 2603:                     mgwIdList = mgwIdList.Union(Ia.Ftn.Cl.Models.Data.Maintenance.Find.MgwIdListFromIpList(ipList)).Distinct().ToList(); ;
 2604:                     stopwatch.RecordElapsedMilliseconds("X3");
 2605:                 }
 2606:  
 2607:                 sbrImpuList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SbrImpuListFromImpuSipDomainList(impuSipDomainList);
 2608:                 owsbrImpuList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OwSbrImpuListFromImpuSipDomainList(impuSipDomainList);
 2609:  
 2610:                 Ia.Ftn.Cl.Models.Data.Maintenance.Find.SynchronizeNumberFormatLists(ref partyIdList, ref prividUserList, ref serviceList, ref numberList, ref serviceLongList, ref impuSipDomainList, ref sipUserNameList, ref serviceWithCountryCodeList, ref serviceIdList);
 2611:             }
 2612:  
 2613:             stopwatch.RecordElapsedMilliseconds("Z");
 2614:  
 2615:             /////////////////////////////////
 2616:  
 2617:             agcfGatewayRecordList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfGatewayRecordList(agcfGatewayRecordIdList);
 2618:             agcfEndpointList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AgcfEndpointList(agcfEndpointIdList);
 2619:             subPartyList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubPartyList(subPartyIdList);
 2620:             subscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SubscriberList(subscriberIdList);
 2621:  
 2622:             mgwList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.MgwList(mgwIdList);
 2623:             asbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AsbrList(asbrIdList);
 2624:  
 2625:             sbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SbrList(sbrImpuList);
 2626:             owsbrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OwsbrList(owsbrImpuList);
 2627:  
 2628:             if (Ia.Ftn.Cl.Models.Data.Service.ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(serviceList))
 2629:             {
 2630:                 seruattrList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.SeruattrListFromServiceIdList(serviceIdList);
 2631:             }
 2632:  
 2633:             axeSubscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AxeSubscriberListFromServiceIdList(serviceIdList);
 2634:             ewsdSubscriberList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EwsdSubscriberListFromServiceIdList(serviceIdList);
 2635:  
 2636:             ontList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntList(ontIdList);
 2637:             ontOntPotsList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntOntPotsListFromOntOntPotsIdList(ontOntPotsIdList);
 2638:             ontServiceVoipList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.OntServiceVoipList(ontServiceVoipIdList);
 2639:             //amsEventList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.EventList(amsEventIdList);
 2640:  
 2641:             emsDevList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsDevList(emsDevIdList);
 2642:             emsBoardList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsBoardList(emsBoardIdList);
 2643:             emsPortList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsPortList(emsPortIdList);
 2644:             emsOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntList(emsOntIdList);
 2645:  
 2646:             emsOntSipInfoList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdListAndService(emsOntIdList, sipUserNameList);
 2647:             emsVoipPstnUserList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.EmsVoipPstnUserList(emsVoipPstnUserIdList);
 2648:             emsVagList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
 2649:  
 2650:             /*
 2651:             emsOntSipInfoList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.EmsOntSipInfoListFromEmsOntIdList(emsOntIdList);
 2652:             emsVoipPstnUserList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.EmsVoipPstnUserListFromEmsOntIdList(emsOntIdList);
 2653:             emsVagList = Ia.Ftn.Cl.Model.Data.Maintenance.Find.VagListFromEmsOntIdList(emsOntIdList);
 2654:             */
 2655:  
 2656:             service2List = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceList(service2IdList);
 2657:  
 2658:             nddOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.NddOntList(nddOntIdList);
 2659:             accessList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessList(accessIdList);
 2660:  
 2661:             serviceRequestServiceList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestServiceList(serviceRequestServiceIdList);
 2662:  
 2663:             serviceRequestList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestList(serviceRequestIdList);
 2664:             serviceRequestAdministrativeIssueList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestAdministrativeIssueList(serviceRequestAdministrativeIssueIdList);
 2665:             serviceRequestHistoryList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
 2666:             serviceRequestTypeList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestTypeList(serviceRequestTypeIdList);
 2667:             serviceRequestOntList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntList(serviceRequestOntIdList);
 2668:             serviceRequestOntDetailList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestOntDetailList(serviceRequestOntIdList);
 2669:  
 2670:             stopwatch.RecordElapsedMilliseconds("ZA");
 2671:  
 2672:             reportList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ReportList(reportIdList);
 2673:  
 2674:             if (enqueueIntoMessageQueue)
 2675:             {
 2676:                 foreach (var v in serviceList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadService, v);
 2677:                 foreach (var v in nddOntList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadAccess, v.Access.Name);
 2678:                 foreach (var v in gatewayIdList) Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadGateway, v);
 2679:             }
 2680:         }
 2681:  
 2682:         ////////////////////////////////////////////////////////////////////////////
 2683:         ////////////////////////////////////////////////////////////////////////////
 2684:  
 2685:         /// <summary>
 2686:         ///
 2687:         /// </summary>
 2688:         public static void MigrationReview(Ia.Ftn.Cl.Models.Business.Administration.Framework framework, string accessName, List<string> serviceList,
 2689:             out List<Ia.Ftn.Cl.Models.Ui.Service2> service2List,
 2690:             out List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList,
 2691:             out List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList,
 2692:             out List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList,
 2693:             out List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList,
 2694:             out List<Ia.Ftn.Cl.Models.Access> accessList,
 2695:             out List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList,
 2696:             out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList,
 2697:             out List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
 2698:             out List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList,
 2699:             out List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList,
 2700:             out Ia.Cl.Models.Result result)
 2701:         {
 2702:             string input;
 2703:  
 2704:             service2List = null;
 2705:             subscriberList = null;
 2706:             sbrList = null;
 2707:             axeSubscriberList = null;
 2708:             ewsdSubscriberList = null;
 2709:             accessList = null;
 2710:             serviceRequestServiceList = null;
 2711:             serviceRequestList = null;
 2712:             serviceRequestAdministrativeIssueList = null;
 2713:             serviceRequestHistoryList = null;
 2714:             serviceRequestOntList = null;
 2715:  
 2716:             var stopwatch = new Ia.Cl.Models.Stopwatch();
 2717:  
 2718:             result = new Ia.Cl.Models.Result();
 2719:  
 2720:             if (!string.IsNullOrEmpty(accessName))
 2721:             {
 2722:                 accessName = accessName.Trim().ToUpper();
 2723:                 input = accessName;
 2724:  
 2725:                 if (input.Length > 0)
 2726:                 {
 2727:                     Ia.Ftn.Cl.Models.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.Models.Result result1);
 2728:  
 2729:                     Ia.Ftn.Cl.Models.Business.Maintenance.Find.Number(ref stopwatch, framework, true, serviceList, out service2List, out _, out _, out _, out _, out _, out subscriberList, out sbrList, 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.Models.Result result2);
 2730:  
 2731:                     if (
 2732:                     (service2List == null || service2List != null && service2List.Count == 0) &&
 2733:                     (subscriberList == null || subscriberList != null && subscriberList.Count == 0) &&
 2734:                     (sbrList == null || sbrList != null && sbrList.Count == 0) &&
 2735:                     (axeSubscriberList == null || axeSubscriberList != null && axeSubscriberList.Count == 0) &&
 2736:                     (ewsdSubscriberList == null || ewsdSubscriberList != null && ewsdSubscriberList.Count == 0) &&
 2737:                     (accessList == null || accessList != null && accessList.Count == 0) &&
 2738:                     (serviceRequestServiceList == null || serviceRequestServiceList != null && serviceRequestServiceList.Count == 0) &&
 2739:                     (serviceRequestList == null || serviceRequestList != null && serviceRequestList.Count == 0) &&
 2740:                     (serviceRequestAdministrativeIssueList == null || serviceRequestAdministrativeIssueList != null && serviceRequestAdministrativeIssueList.Count == 0) &&
 2741:                     (serviceRequestHistoryList == null || serviceRequestHistoryList != null && serviceRequestHistoryList.Count == 0) &&
 2742:                     (serviceRequestOntList == null || serviceRequestOntList != null && serviceRequestOntList.Count == 0))
 2743:                     {
 2744:                         if (result.IsSuccessful)
 2745:                         {
 2746:                             result.AddWarning("No data records were found for \"" + accessName + "\" (لا توجد معلومات عن القيمة المعطاة). ");
 2747:                         }
 2748:                         else { };// result.AddError(result.Error);
 2749:                     }
 2750:                     else
 2751:                     {
 2752:                         /*
 2753:                         if (result.IsSuccessful)
 2754:                         {
 2755:                             if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
 2756:                         }
 2757:                         //else result.AddError(result.Error);
 2758:                         */
 2759:                     }
 2760:                 }
 2761:                 else result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
 2762:             }
 2763:             else result.AddError("Input is null or empty (لم يتم إدخال أي شيء). ");
 2764:         }
 2765:  
 2766:         ////////////////////////////////////////////////////////////////////////////
 2767:  
 2768:         /// <summary>
 2769:         ///
 2770:         /// </summary>
 2771:         public static void BulkSearch(string rawInput, out List<Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName> serviceAccessNameList, out Ia.Cl.Models.Result result)
 2772:         {
 2773:             bool inputIsValid;
 2774:             string input;
 2775:  
 2776:             //inputIsValid = false;
 2777:             //result = null;
 2778:  
 2779:             serviceAccessNameList = null;
 2780:  
 2781:             result = new Ia.Cl.Models.Result();
 2782:  
 2783:             if (!string.IsNullOrEmpty(rawInput))
 2784:             {
 2785:                 rawInput = rawInput.Trim();
 2786:                 input = rawInput;
 2787:  
 2788:                 if (input.Length > 0)
 2789:                 {
 2790:                     inputIsValid = true;
 2791:  
 2792:                     Ia.Ftn.Cl.Models.Business.Maintenance.Find.NumberStringListToAccessNameList(rawInput, out serviceAccessNameList, out result);
 2793:  
 2794:  
 2795:                     //var v = Ia.Ftn.Cl.Model.Data.Access.IdToAccessDictionary;
 2796:  
 2797:                     if (inputIsValid)
 2798:                     {
 2799:                         if (serviceAccessNameList == null || serviceAccessNameList != null && serviceAccessNameList.Count == 0)
 2800:                         {
 2801:                             if (result.IsSuccessful)
 2802:                             {
 2803:                                 result.AddWarning("No data records were found for \"" + rawInput + "\" (لا توجد معلومات عن القيمة أو القيم المعطاة)");
 2804:                             }
 2805:                             else { };// result.AddError(result.Error);
 2806:                         }
 2807:                         else
 2808:                         {
 2809:                             if (result.IsSuccessful)
 2810:                             {
 2811:                                 if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
 2812:                             }
 2813:                             //else result.AddError(result.Error);
 2814:                         }
 2815:                     }
 2816:                     else result.AddError("Input format is unknown (قيمة غير مفهومة)");
 2817:                 }
 2818:                 else result.AddError("No input was entered (لم يتم إدخال أي شيء)");
 2819:             }
 2820:             else result.AddError("Input is null or empty (لم يتم إدخال أي شيء)");
 2821:         }
 2822:  
 2823:         ////////////////////////////////////////////////////////////////////////////
 2824:  
 2825:         /// <summary>
 2826:         ///
 2827:         /// </summary>
 2828:         public static void BulkSearch(string rawInput, out List<Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress> serviceAccessNameAddressList, out Ia.Cl.Models.Result result)
 2829:         {
 2830:             bool inputIsValid;
 2831:             string input;
 2832:  
 2833:             //inputIsValid = false;
 2834:             //result = null;
 2835:  
 2836:             serviceAccessNameAddressList = null;
 2837:  
 2838:             result = new Ia.Cl.Models.Result();
 2839:  
 2840:             if (!string.IsNullOrEmpty(rawInput))
 2841:             {
 2842:                 rawInput = rawInput.Trim();
 2843:                 input = rawInput.ToLower();
 2844:  
 2845:                 if (input.Length > 0)
 2846:                 {
 2847:                     inputIsValid = true;
 2848:  
 2849:                     Ia.Ftn.Cl.Models.Business.Maintenance.Find.NumberStringListToAccessNameAddressList(rawInput, out serviceAccessNameAddressList, out result);
 2850:  
 2851:                     if (inputIsValid)
 2852:                     {
 2853:                         if (serviceAccessNameAddressList == null || serviceAccessNameAddressList != null && serviceAccessNameAddressList.Count == 0)
 2854:                         {
 2855:                             if (result.IsSuccessful)
 2856:                             {
 2857:                                 result.AddWarning("No data records were found for \"" + rawInput + "\" (لا توجد معلومات عن القيمة أو القيم المعطاة). ");
 2858:                             }
 2859:                             else { };// result.AddError(result.Error);
 2860:                         }
 2861:                         else
 2862:                         {
 2863:                             if (result.IsSuccessful)
 2864:                             {
 2865:                                 if (!string.IsNullOrEmpty(result.Message)) result.AddSuccess(result.Message);
 2866:                             }
 2867:                             //else result.AddError(result.Error);
 2868:                         }
 2869:                     }
 2870:                     else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
 2871:                 }
 2872:                 else result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
 2873:             }
 2874:             else result.AddError("Input is null or empty (لم يتم إدخال أي شيء). ");
 2875:         }
 2876:  
 2877:         ////////////////////////////////////////////////////////////////////////////
 2878:  
 2879:         /// <summary>
 2880:         ///
 2881:         /// </summary>
 2882:         public static void NumberStringListToAccessNameList(string rawInput, out List<Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName> serviceAccessNameList, out Ia.Cl.Models.Result result)
 2883:         {
 2884:             string input, serviceId;
 2885:             int number;
 2886:             string numberString;
 2887:             Dictionary<string, string> serviceToAccessNameDictionary;
 2888:             MatchCollection matchCollection;
 2889:             Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName serviceAccessName;
 2890:  
 2891:             result = new Ia.Cl.Models.Result();
 2892:  
 2893:             serviceAccessNameList = new List<Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName>();
 2894:  
 2895:             input = rawInput.ToLower();
 2896:  
 2897:             serviceToAccessNameDictionary = Ia.Ftn.Cl.Models.Data.Service2.ServiceIdToAccessNameDictionary;
 2898:  
 2899:             matchCollection = Regex.Matches(input, @"\d{8}");
 2900:  
 2901:             if (matchCollection.Count > 0)
 2902:             {
 2903:                 foreach (Match match in matchCollection)
 2904:                 {
 2905:                     numberString = match.Value;
 2906:  
 2907:                     number = int.Parse(numberString);
 2908:  
 2909:                     if (Ia.Ftn.Cl.Models.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
 2910:                     {
 2911:                         serviceAccessName = new Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName();
 2912:  
 2913:                         serviceId = numberString + ":1:965";
 2914:  
 2915:                         serviceAccessName.Service = number.ToString();
 2916:  
 2917:                         if (serviceToAccessNameDictionary.ContainsKey(serviceId))
 2918:                         {
 2919:                             serviceAccessName.AccessName = serviceToAccessNameDictionary[serviceId];
 2920:                         }
 2921:  
 2922:                         serviceAccessNameList.Add(serviceAccessName);
 2923:                     }
 2924:                     else
 2925:                     {
 2926:                         result.AddWarning("The number \"" + numberString + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
 2927:                     }
 2928:                 }
 2929:             }
 2930:             else
 2931:             {
 2932:                 result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
 2933:             }
 2934:         }
 2935:  
 2936:         ////////////////////////////////////////////////////////////////////////////
 2937:  
 2938:         /// <summary>
 2939:         ///
 2940:         /// </summary>
 2941:         public static void NumberStringListToAccessNameAddressList(string rawInput, out List<Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress> serviceAccessNameAddressList, out Ia.Cl.Models.Result result)
 2942:         {
 2943:             string input, serviceId;
 2944:             int number;
 2945:             string numberString;
 2946:             MatchCollection matchCollection;
 2947:             Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress serviceAccessNameAddress;
 2948:  
 2949:             result = new Ia.Cl.Models.Result();
 2950:  
 2951:             serviceAccessNameAddressList = new List<Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress>();
 2952:  
 2953:             input = rawInput.ToLower();
 2954:  
 2955:             var serviceToAccessNameDictionary = Ia.Ftn.Cl.Models.Data.Service2.ServiceIdToAccessNameDictionary;
 2956:             var serviceIdToAccessIdDictionary = Ia.Ftn.Cl.Models.Data.Service2.ServiceIdToAccessIdDictionary;
 2957:             var accessIdToAccessDictionary = Ia.Ftn.Cl.Models.Data.Access.IdToAccessDictionary;
 2958:  
 2959:             matchCollection = Regex.Matches(input, @"\d{8}");
 2960:  
 2961:             if (matchCollection.Count > 0)
 2962:             {
 2963:                 foreach (Match match in matchCollection)
 2964:                 {
 2965:                     numberString = match.Value;
 2966:  
 2967:                     number = int.Parse(numberString);
 2968:  
 2969:                     if (Ia.Ftn.Cl.Models.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
 2970:                     {
 2971:                         serviceAccessNameAddress = new Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress();
 2972:  
 2973:                         serviceId = numberString + ":1:965";
 2974:  
 2975:                         serviceAccessNameAddress.Service = number.ToString();
 2976:  
 2977:                         if (serviceToAccessNameDictionary.ContainsKey(serviceId))
 2978:                         {
 2979:                             serviceAccessNameAddress.AccessName = serviceToAccessNameDictionary[serviceId];
 2980:                         }
 2981:  
 2982:                         if (serviceIdToAccessIdDictionary.ContainsKey(serviceId))
 2983:                         {
 2984:                             var accessId = serviceIdToAccessIdDictionary[serviceId];
 2985:  
 2986:                             if (accessIdToAccessDictionary.ContainsKey(accessId))
 2987:                             {
 2988:                                 serviceAccessNameAddress.Address = accessIdToAccessDictionary[accessId].Address;
 2989:                             }
 2990:                         }
 2991:  
 2992:                         serviceAccessNameAddressList.Add(serviceAccessNameAddress);
 2993:                     }
 2994:                     else
 2995:                     {
 2996:                         result.AddWarning("The number \"" + numberString + "\" does not belong to the network (الرقم لا ينتمي للشبكة).");
 2997:                     }
 2998:                 }
 2999:             }
 3000:             else
 3001:             {
 3002:                 result.AddError("No input was entered (لم يتم إدخال أي شيء). ");
 3003:             }
 3004:         }
 3005:  
 3006:         ////////////////////////////////////////////////////////////////////////////
 3007:         ////////////////////////////////////////////////////////////////////////////
 3008:  
 3009:         /// <summary>
 3010:         ///
 3011:         /// </summary>
 3012:         public static void AreaBlock(string rawInput, out List<Ia.Ftn.Cl.Models.Access> accessList, out Ia.Cl.Models.Result result)
 3013:         {
 3014:             string input;
 3015:  
 3016:             result = new Ia.Cl.Models.Result();
 3017:             accessList = null;
 3018:  
 3019:             input = rawInput.ToLower();
 3020:  
 3021:             try
 3022:             {
 3023:                 // note that this returns 0 int values for missing fields
 3024:                 ExtractAreaBlockFromSearchAreaBlockTerm(input, out Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea, out string block);
 3025:  
 3026:                 if (kuwaitFtnArea != null)
 3027:                 {
 3028:                     //using (var db = new Ia.Ftn.Cl.Model.Ftn())
 3029:                     //{
 3030:                     accessList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessListFromAreaAndBlock(kuwaitFtnArea.Id, block);
 3031:                     //}
 3032:                 }
 3033:                 else
 3034:                 {
 3035:                     result.AddError("The area of \"" + rawInput + "\" is unrecognized. ");
 3036:                 }
 3037:             }
 3038:             catch (Exception ex)
 3039:             {
 3040:                 result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 3041:             }
 3042:         }
 3043:  
 3044:         ////////////////////////////////////////////////////////////////////////////
 3045:  
 3046:         /// <summary>
 3047:         ///
 3048:         /// </summary>
 3049:         public static void Address(string rawInput, out List<Ia.Ftn.Cl.Models.Access> accessList, out Ia.Cl.Models.Result result)
 3050:         {
 3051:             string input;
 3052:  
 3053:             result = new Ia.Cl.Models.Result();
 3054:             accessList = null;
 3055:  
 3056:             input = rawInput.ToLower();
 3057:  
 3058:             try
 3059:             {
 3060:                 // note that this returns 0 int values for missing fields
 3061:                 ExtractAddressFromSearchAddressTerm(input, out Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea, out string block, out int street, out int premisesOld, out int premisesNew);
 3062:  
 3063:                 if (kuwaitFtnArea != null)
 3064:                 {
 3065:                     accessList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.AccessListFromAddress(kuwaitFtnArea.Id, block, street, premisesOld, premisesNew);
 3066:                 }
 3067:                 else
 3068:                 {
 3069:                     result.AddError("The area of \"" + rawInput + "\" is unrecognized. ");
 3070:                 }
 3071:             }
 3072:             catch (Exception ex)
 3073:             {
 3074:                 result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 3075:             }
 3076:         }
 3077:  
 3078:         ////////////////////////////////////////////////////////////////////////////
 3079:  
 3080:         /// <summary>
 3081:         ///
 3082:         /// </summary>
 3083:         public static void CustomerName(string rawInput, out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList, out Ia.Cl.Models.Result result)
 3084:         {
 3085:             string input;
 3086:             int maxNumberOfResults = 1000;
 3087:             string customerName;
 3088:  
 3089:             result = new Ia.Cl.Models.Result();
 3090:             serviceRequestList = null;
 3091:  
 3092:             input = rawInput.ToLower();
 3093:  
 3094:             try
 3095:             {
 3096:                 //using (var db = new Ia.Ftn.Cl.Model.Ftn())
 3097:                 //{
 3098:                 customerName = Ia.Ftn.Cl.Models.Business.Default.CorrectCustomerName(input);
 3099:  
 3100:                 //if (!string.IsNullOrEmpty(customerName))
 3101:                 //{
 3102:                 serviceRequestList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestListForCustomerName(customerName, maxNumberOfResults);
 3103:  
 3104:                 if (serviceRequestList.Count >= maxNumberOfResults) result.AddSuccess("The search returned " + maxNumberOfResults + " or more results. The output is limited to " + maxNumberOfResults + ". ");
 3105:                 //}
 3106:                 //else
 3107:                 //{
 3108:                 //    serviceRequestList = null;
 3109:                 //}
 3110:                 //}
 3111:             }
 3112:             catch (Exception ex)
 3113:             {
 3114:                 result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 3115:             }
 3116:         }
 3117:  
 3118:         ////////////////////////////////////////////////////////////////////////////
 3119:  
 3120:         /// <summary>
 3121:         ///
 3122:         /// </summary>
 3123:         public static void CustomerId(string rawInput, out List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList, out Ia.Cl.Models.Result result)
 3124:         {
 3125:             string input;
 3126:             int customerId, maxNumberOfResults = 10000;
 3127:  
 3128:             result = new Ia.Cl.Models.Result();
 3129:             serviceRequestList = null;
 3130:  
 3131:             input = rawInput.ToLower();
 3132:  
 3133:             try
 3134:             {
 3135:                 using (var db = new Ia.Ftn.Cl.Db())
 3136:                 {
 3137:                     customerId = int.Parse(input);
 3138:  
 3139:                     serviceRequestList = Ia.Ftn.Cl.Models.Data.Maintenance.Find.ServiceRequestListForCustomerId(customerId, maxNumberOfResults);
 3140:  
 3141:                     if (serviceRequestList.Count >= maxNumberOfResults) result.AddSuccess("The search returned " + maxNumberOfResults + " or more results. The output is limited to " + maxNumberOfResults + ". ");
 3142:                 }
 3143:             }
 3144:             catch (Exception ex)
 3145:             {
 3146:                 result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
 3147:             }
 3148:         }
 3149:  
 3150:         ////////////////////////////////////////////////////////////////////////////
 3151:  
 3152:         /// <summary>
 3153:         /// Extract area,block from search term like "SLA,2" {kuwaitAreaSymbol,block}
 3154:         /// </summary>
 3155:         private static void ExtractAreaBlockFromSearchAreaBlockTerm(string addressTerm, out Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea, out string block)
 3156:         {
 3157:             //int i;
 3158:             string kuwaitFtnAreaSymbol;
 3159:             Match match;
 3160:  
 3161:             // "SLA,2"
 3162:             match = Regex.Match(addressTerm, @"^([a-zA-Z]{3}),(\d{1,3})$");
 3163:  
 3164:             kuwaitFtnAreaSymbol = match.Groups[1].Value.ToUpper();
 3165:             block = match.Groups[2].Value;
 3166:  
 3167:             kuwaitFtnArea = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaBySymbol(kuwaitFtnAreaSymbol);
 3168:         }
 3169:  
 3170:         ////////////////////////////////////////////////////////////////////////////
 3171:  
 3172:         /// <summary>
 3173:         /// Extract address from search term like "SLA,2,202,339,36" {kuwaitAreaSymbol,block,street,old premises,new premises}
 3174:         /// </summary>
 3175:         private static void ExtractAddressFromSearchAddressTerm(string addressTerm, out Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea, out string block, out int street, out int premisesOld, out int premisesNew)
 3176:         {
 3177:             string kuwaitFtnAreaSymbol;
 3178:             Match match;
 3179:  
 3180:             // "SLA,2,202,339,36"
 3181:             match = Regex.Match(addressTerm, @"^([a-zA-Z]{3}),(\d{0,3}),(\d{0,3}),(\d{0,3}),(\d{0,3})$");
 3182:  
 3183:             kuwaitFtnAreaSymbol = match.Groups[1].Value.ToUpper();
 3184:             block = match.Groups[2].Value;
 3185:             street = int.TryParse(match.Groups[3].Value, out int i) ? i : 0;
 3186:             premisesOld = int.TryParse(match.Groups[4].Value, out i) ? i : 0;
 3187:             premisesNew = int.TryParse(match.Groups[5].Value, out i) ? i : 0;
 3188:  
 3189:             kuwaitFtnArea = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaBySymbol(kuwaitFtnAreaSymbol);
 3190:         }
 3191:  
 3192:         ////////////////////////////////////////////////////////////////////////////
 3193:         ////////////////////////////////////////////////////////////////////////////   
 3194:     }
 3195:  
 3196:     ////////////////////////////////////////////////////////////////////////////
 3197:     ////////////////////////////////////////////////////////////////////////////   
 3198: }