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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Find

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

Find subscriber and network information support class for the Next Generation Network business model

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