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

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 System;
   2:  using System.Collections.Generic;
   3:  using System.Data;
   4:  using System.Data.Entity;
   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 (Regex.IsMatch(input, @"^\d{8}$") || 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._Number(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._Number(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 _Number(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).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:                                          join grid in agcfGatewayRecordIdList on e.AgcfGatewayRecord.Id equals grid
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.Service2s
1888:                                      join ns in serviceList on s.Service equals ns
1889:                                      where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService
1890:                                      select new Ia.Ngn.Cl.Model.Ui.Service2()
1891:                                      {
1892:                                          AbbriviatedCalling = s.AbbriviatedCalling,
1893:                                          AlarmCall = s.AlarmCall,
1894:                                          CallBarring = s.CallBarring,
1895:                                          CallerId = s.CallerId,
1896:                                          CallForwarding = s.CallForwarding,
1897:                                          CallWaiting = s.CallWaiting,
1898:                                          ConferenceCall = s.ConferenceCall,
1899:                                          Created = s.Created,
1900:                                          InternationalCalling = s.InternationalCalling,
1901:                                          InternationalCallingUserControlled = s.InternationalCallingUserControlled,
1902:                                          Port = s.Port,
1903:                                          Pin = s.Pin,
1904:                                          Service = s.Service,
1905:                                          ServiceType = s.ServiceType,
1906:                                          ServiceSuspension = s.ServiceSuspension,
1907:                                          ServiceTypeName = s.ServiceType.ToString(),
1908:                                          Updated = s.Updated,
1909:                                          AccessId = s.Access.Id
1910:                                      }).ToList();
1911:   
1912:                      serviceRequestServiceList = (from srs in db.ServiceRequestServices
1913:                                                   join aid in accessIdList on srs.Access.Id equals aid
1914:                                                   select new Ia.Ngn.Cl.Model.Ui.ServiceRequestService()
1915:                                                   {
1916:                                                       Id = srs.Id,
1917:                                                       AbbriviatedCalling = srs.AbbriviatedCalling,
1918:                                                       Access = srs.Access,
1919:                                                       AlarmCall = srs.AlarmCall,
1920:                                                       CallBarring = srs.CallBarring,
1921:                                                       CallerId = srs.CallerId,
1922:                                                       CallForwarding = srs.CallForwarding,
1923:                                                       CallWaiting = srs.CallWaiting,
1924:                                                       ConferenceCall = srs.ConferenceCall,
1925:                                                       Created = srs.Created,
1926:                                                       InternationalCalling = srs.InternationalCalling,
1927:                                                       InternationalCallingUserControlled = srs.InternationalCallingUserControlled,
1928:                                                       LastRequestDateTime = srs.LastRequestDateTime,
1929:                                                       Provisioned = srs.Provisioned,
1930:                                                       Service = srs.Service,
1931:                                                       Serial = srs.Serial,
1932:                                                       ServiceType = srs.ServiceType,
1933:                                                       ServiceSuspension = srs.ServiceSuspension,
1934:                                                       Type = srs.Type,
1935:                                                       Updated = srs.Updated
1936:                                                   }).ToList();
1937:   
1938:                      subscriberList = (from s in db.Subscribers
1939:                                        join p in partyIdList on s.PartyId equals p
1940:                                        select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
1941:                                        {
1942:                                            Id = s.Id,
1943:                                            AlternateOtasRealm = s.AlternateOtasRealm,
1944:                                            PartyId = s.PartyId,
1945:                                            AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
1946:                                            AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
1947:                                            CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
1948:                                            CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
1949:                                            CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
1950:                                            ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
1951:                                            InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
1952:                                            InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
1953:                                            //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
1954:                                            Created = s.Created,
1955:                                            Updated = s.Updated,
1956:                                        }).ToList();
1957:   
1958:                      subPartyList = (from sp in db.SubParties
1959:                                      join p in partyIdList on sp.PartyId equals p
1960:                                      select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
1961:                                      {
1962:                                          Id = sp.Id,
1963:                                          PartyId = sp.PartyId,
1964:                                          PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
1965:                                          DisplayName = sp.DisplayName,
1966:                                          Category = sp.Category,
1967:                                          AssocOtasRealm = sp.AssocOtasRealm,
1968:                                          ServiceSuspension = sp.ServiceSuspension,
1969:                                          Created = sp.Created,
1970:                                          Updated = sp.Updated
1971:                                      }).ToList();
1972:   
1973:   
1974:                      huSbrList = (from h in db.HuSbrs
1975:                                   join i in impuSipDomainList on h.IMPU equals i
1976:                                   select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
1977:                                   {
1978:                                       COP = h.COP,
1979:                                       CSC = h.CSC,
1980:                                       Id = h.Id,
1981:                                       IMPU = h.IMPU,
1982:                                       ITT = h.ITT,
1983:                                       LP = h.LP,
1984:                                       NS3PTY = h.NS3PTY,
1985:                                       NSABRC = h.NSABRC,
1986:                                       NSCBA = h.NSCBA,
1987:                                       NSCFU = h.NSCFU,
1988:                                       NSCLIP = h.NSCLIP,
1989:                                       NSCW = h.NSCW,
1990:                                       NSFAX = h.NSFAX,
1991:                                       NSHOLD = h.NSHOLD,
1992:                                       NSNPTY = h.NSNPTY,
1993:                                       NSWAKE_UP = h.NSWAKE_UP,
1994:                                       Created = h.Created,
1995:                                       Updated = h.Updated
1996:                                   }).ToList();
1997:   
1998:                      owsbrList = (from o in db.Owsbrs join i in impuSipDomainList on o.IMPU equals i select o).ToList();
1999:   
2000:                      serviceRequestList = (from sr in db.ServiceRequests join n in numberList on sr.Number equals n select sr).ToList();
2001:                      serviceRequestAdministrativeIssueList = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList on srai.Service equals sid select srai).ToList();
2002:   
2003:                      //serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestList(serviceRequestHistoryIdList);
2004:                      serviceRequestTypeList = (from srt in db.ServiceRequestTypes join sr in db.ServiceRequests on srt.ServiceRequest equals sr join n in numberList on sr.Number equals n select srt).ToList();
2005:   
2006:                      reportList = (from r in db.Reports join sl in service2IdList on r.Service equals sl select r).Include(x => x.ReportHistories).ToList();
2007:   
2008:   
2009:                      nddOntList = (from nddo in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where nddo.Ip == input select nddo).ToList();
2010:                      foreach (var v in nddOntList) ontIdList.Add(v.Id);
2011:                      ontIdList = ontIdList.Distinct().ToList();
2012:   
2013:                      ontList = (from o in db.Onts join oid in ontIdList on o.Id equals oid select o).ToList();
2014:                      foreach (var v in ontList) ontIdList.Add(v.Id);
2015:                      ontIdList = ontIdList.Distinct().ToList();
2016:   
2017:                      foreach (var v in ontList) if (v.Access != null) accessIdList.Add(v.Access.Id);
2018:                      accessIdList = accessIdList.Distinct().ToList();
2019:   
2020:                      ontOntPotsList = (from op in db.OntOntPotses join oid in ontIdList on op.Ont.Id equals oid select op).ToList();
2021:                      ontServiceVoipList = (from ov in db.OntServiceVoips join oid in ontIdList on ov.Ont.Id equals oid select ov).ToList();
2022:   
2023:                      foreach (var v in nddOntList)
2024:                      {
2025:                          //eventSystemList.Add(v.Pon.PonGroup.Olt.AmsName);
2026:                          //eventAidOntList.Add("ONT-1-1-" + v.Card + "-" + v.Port + "-" + v.Number);
2027:                          //eventAidOntVoipList.Add("ONTVOIP-1-1-" + v.Card + "-" + v.Port + "-1");
2028:   
2029:                          //foreach (var w in ontOntPotsList) eventAidOntPotsList.Add("ONTPOTS-1-1-" + v.Card + "-" + v.Port + "-" + w.Card + "-" + w.Port);
2030:                      }
2031:   
2032:                      //eventSystemList = eventSystemList.Distinct().ToList();
2033:                      //eventAidOntList = eventAidOntList.Distinct().ToList();
2034:                      //eventAidOntVoipList = eventAidOntVoipList.Distinct().ToList();
2035:   
2036:                      /*
2037:                      eventList = (from e in db.Events join es in eventSystemList on e.System equals es join eao in eventAidOntList on e.Aid equals eao select e)
2038:                                  .Union(from e in db.Events join es in eventSystemList on e.System equals es join eao in eventAidOntList on e.Aid equals eao join eaov in eventAidOntVoipList on e.Aid equals eaov select e)
2039:                                  .Union(from e in db.Events join es in eventSystemList on e.System equals es join eao in eventAidOntList on e.Aid equals eao join eaop in eventAidOntPotsList on e.Aid equals eaop select e)
2040:                                  .ToList();
2041:                                  */
2042:   
2043:                      accessList = (from a in db.Accesses join aid in accessIdList on a.Id equals aid select a).ToList();
2044:                  }
2045:              }
2046:              catch (Exception ex)
2047:              {
2048:                  result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
2049:              }
2050:          }
2051:   
2052:          ////////////////////////////////////////////////////////////////////////////
2053:   
2054:          /// <summary>
2055:          ///
2056:          /// </summary>
2057:          public static void GatewayId(string rawInput,
2058:              out List<Ia.Ngn.Cl.Model.Ui.Service2> service2List,
2059:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList,
2060:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList,
2061:              out List<Ia.Ngn.Cl.Model.Huawei.Mgw> mgwList,
2062:              out List<Ia.Ngn.Cl.Model.Huawei.Asbr> asbrList,
2063:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList,
2064:              out List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList,
2065:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList,
2066:              out List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList,
2067:              out List<Ia.Ngn.Cl.Model.Huawei.Seruattr> seruattrList,
2068:              out List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> axeSubscriberList,
2069:              out List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> ewsdSubscriberList,
2070:              out List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList,
2071:              out List<Ia.Ngn.Cl.Model.Ont> ontList,
2072:              out List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList,
2073:              out List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList,
2074:              out List<Ia.Ngn.Cl.Model.Huawei.EmsDev> emsDevList,
2075:              out List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> emsBoardList,
2076:              out List<Ia.Ngn.Cl.Model.Huawei.EmsPort> emsPortList,
2077:              out List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList,
2078:              out List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList,
2079:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList,
2080:              out List<Ia.Ngn.Cl.Model.Huawei.EmsVag> emsVagList,
2081:              out List<Ia.Ngn.Cl.Model.Event> eventList,
2082:              out List<Ia.Ngn.Cl.Model.Access> accessList,
2083:              out List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList,
2084:              out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList,
2085:              out List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList,
2086:              out List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList,
2087:              out List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList,
2088:              out List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList,
2089:              out List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList,
2090:              out List<Ia.Ngn.Cl.Model.Report> reportList,
2091:              out List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList,
2092:              out Ia.Cl.Model.Result result)
2093:          {
2094:              string input;
2095:              int gatewayId;
2096:              List<int> serviceRequestIdList, agcfGatewayRecordIdList, reportIdList, numberList;
2097:              List<long> serviceLongList;
2098:              List<string> serviceList, serviceIdList, serviceRequestHistoryIdList, serviceRequestServiceIdList, impuSipDomainList, sipUserNameList, serviceWithCountryCodeList, accessIdList, ontIdList, agcfEndpointIdList, mgwIdList, asbrIdList, subPartyIdList, subscriberIdList, partyIdList, prividUserList, ipList;
2099:   
2100:              serviceRequestIdList = new List<int>();
2101:              serviceRequestServiceIdList = new List<string>();
2102:              accessIdList = new List<string>();
2103:              ontIdList = new List<string>();
2104:              agcfEndpointIdList = new List<string>();
2105:              mgwIdList = new List<string>();
2106:              asbrIdList = new List<string>();
2107:              subscriberIdList = new List<string>();
2108:              agcfGatewayRecordIdList = new List<int>();
2109:              reportIdList = new List<int>();
2110:              ipList = new List<string>();
2111:              numberList = new List<int>();
2112:              impuSipDomainList = new List<string>();
2113:              sipUserNameList = new List<string>();
2114:              serviceWithCountryCodeList = new List<string>();
2115:              serviceList = new List<string>();
2116:              serviceIdList = new List<string>();
2117:              serviceRequestHistoryIdList = new List<string>();
2118:              partyIdList = new List<string>();
2119:              prividUserList = new List<string>();
2120:              subPartyIdList = new List<string>();
2121:   
2122:              serviceLongList = new List<long>();
2123:   
2124:              result = new Ia.Cl.Model.Result();
2125:   
2126:              service2List = null;
2127:   
2128:              agcfGatewayRecordList = null;
2129:              agcfEndpointList = null;
2130:              mgwList = null;
2131:              asbrList = null;
2132:              subPartyList = null;
2133:              subscriberList = null;
2134:   
2135:              huSbrList = null;
2136:              owsbrList = null;
2137:              seruattrList = null;
2138:              axeSubscriberList = null;
2139:              ewsdSubscriberList = null;
2140:   
2141:              nddOntList = null;
2142:              ontList = null;
2143:              ontServiceVoipList = null;
2144:              ontOntPotsList = null;
2145:              emsDevList = null;
2146:              emsBoardList = null;
2147:              emsPortList = null;
2148:              emsOntList = null;
2149:              emsOntSipInfoList = null;
2150:              emsVoipPstnUserList = null;
2151:              emsVagList = null;
2152:              eventList = null;
2153:              accessList = null;
2154:              serviceRequestServiceList = null;
2155:              serviceRequestList = null;
2156:              serviceRequestAdministrativeIssueList = null;
2157:              serviceRequestHistoryList = null;
2158:              serviceRequestTypeList = null;
2159:              serviceRequestOntList = null;
2160:              serviceRequestOntDetailList = null;
2161:              reportList = null;
2162:              reportHistoryList = null;
2163:   
2164:              input = rawInput.ToLower();
2165:   
2166:              gatewayId = int.Parse(input);
2167:   
2168:              if (gatewayId >= Ia.Ngn.Cl.Model.Business.Nokia.Ims.FirstGatewayId && gatewayId <= Ia.Ngn.Cl.Model.Business.Nokia.Ims.LastGatewayId)
2169:              {
2170:                  Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Enqueue(gatewayId);
2171:   
2172:                  try
2173:                  {
2174:                      using (var db = new Ia.Ngn.Cl.Model.Ngn())
2175:                      {
2176:                          agcfEndpointList = (from e in db.AgcfEndpoints
2177:                                              where e.GwId == gatewayId
2178:                                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint()
2179:                                              {
2180:                                                  Id = e.Id,
2181:                                                  PrividUser = e.PrividUser,
2182:                                                  GwId = e.GwId,
2183:                                                  Dn = e.Dn,
2184:                                                  FlatTermID = e.FlatTermID,
2185:                                                  CallHoldLc = e.CallHoldLc,
2186:                                                  CallWaitingLc = e.CallWaitingLc,
2187:                                                  CallToggleLc = e.CallToggleLc,
2188:                                                  ThreeWayCallLc = e.ThreeWayCallLc,
2189:                                                  McidLc = e.McidLc,
2190:                                                  Password = e.Password,
2191:                                                  CallTransferLc = e.CallTransferLc,
2192:                                                  Created = e.Created,
2193:                                                  Updated = e.Updated
2194:                                              }).ToList();
2195:   
2196:                          foreach (var v in agcfEndpointList) agcfEndpointIdList.Add(v.Id);
2197:                          agcfEndpointIdList = agcfEndpointIdList.Distinct().ToList();
2198:   
2199:                          // mgwList =
2200:                          // asbrList =
2201:   
2202:                          agcfGatewayRecordList = (from gr in db.AgcfGatewayRecords
2203:                                                   where gr.GwId == gatewayId
2204:                                                   select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
2205:                                                   {
2206:                                                       Id = gr.Id,
2207:                                                       GwId = gr.GwId,
2208:                                                       GwUserId = gr.GwUserId,
2209:                                                       GwDomain = gr.GwDomain,
2210:                                                       GwName = gr.GwName,
2211:                                                       IP1 = gr.IP1,
2212:                                                       IP2 = gr.IP2,
2213:                                                       MateExternalIPAddr = gr.MateExternalIPAddr,
2214:                                                       IsPrimary = gr.IsPrimary,
2215:                                                       Created = gr.Created,
2216:                                                       Updated = gr.Updated
2217:                                                   }).ToList();
2218:   
2219:                          foreach (var v in agcfGatewayRecordList)
2220:                          {
2221:                              agcfGatewayRecordIdList.Add(v.Id);
2222:                              ipList.Add(v.IP1);
2223:                          }
2224:                          agcfGatewayRecordIdList = agcfGatewayRecordIdList.Distinct().ToList();
2225:                          ipList = ipList.Distinct().ToList();
2226:   
2227:                          subPartyList = (from sp in db.SubParties
2228:                                          join eid in agcfEndpointIdList on sp.AgcfEndpoint.Id equals eid
2229:                                          select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
2230:                                          {
2231:                                              Id = sp.Id,
2232:                                              PartyId = sp.PartyId,
2233:                                              PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
2234:                                              DisplayName = sp.DisplayName,
2235:                                              Category = sp.Category,
2236:                                              AssocOtasRealm = sp.AssocOtasRealm,
2237:                                              ServiceSuspension = sp.ServiceSuspension,
2238:                                              Created = sp.Created,
2239:                                              Updated = sp.Updated
2240:                                          }).ToList();
2241:   
2242:                          foreach (var v in subPartyList) subPartyIdList.Add(v.Id);
2243:                          subPartyIdList = subPartyIdList.Distinct().ToList();
2244:   
2245:                          subscriberList = (from s in db.Subscribers
2246:                                            join sid in subPartyIdList on s.SubParty.Id equals sid
2247:                                            select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
2248:                                            {
2249:                                                Id = s.Id,
2250:                                                AlternateOtasRealm = s.AlternateOtasRealm,
2251:                                                PartyId = s.PartyId,
2252:                                                AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
2253:                                                AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
2254:                                                CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
2255:                                                CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
2256:                                                CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
2257:                                                ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
2258:                                                InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
2259:                                                InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
2260:                                                //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
2261:                                                Created = s.Created,
2262:                                                Updated = s.Updated,
2263:                                            }).ToList();
2264:   
2265:                          Ia.Ngn.Cl.Model.Data.Maintenance.Find.CollectServiceListFromSubscriberList(subscriberList, ref serviceList);
2266:                          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);
2267:   
2268:                          subPartyList = (from sp in db.SubParties
2269:                                          join e in agcfEndpointIdList on sp.AgcfEndpoint.Id equals e
2270:                                          join p in partyIdList on sp.PartyId equals p
2271:                                          where 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:                                            join pid in partyIdList on s.PartyId equals pid
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:                                            join spid in subPartyIdList on s.SubParty.Id equals spid
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:                                            join sid in subscriberIdList on s.Id equals sid
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:                                                       join ns in serviceList on srs.Service equals ns
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.Service2s
2385:                                          join ns in serviceList on s.Service equals ns
2386:                                          where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService
2387:                                          select new Ia.Ngn.Cl.Model.Ui.Service2()
2388:                                          {
2389:                                              AbbriviatedCalling = s.AbbriviatedCalling,
2390:                                              AlarmCall = s.AlarmCall,
2391:                                              CallBarring = s.CallBarring,
2392:                                              CallerId = s.CallerId,
2393:                                              CallForwarding = s.CallForwarding,
2394:                                              CallWaiting = s.CallWaiting,
2395:                                              ConferenceCall = s.ConferenceCall,
2396:                                              Created = s.Created,
2397:                                              InternationalCalling = s.InternationalCalling,
2398:                                              InternationalCallingUserControlled = s.InternationalCallingUserControlled,
2399:                                              Port = s.Port,
2400:                                              Pin = s.Pin,
2401:                                              Service = s.Service,
2402:                                              ServiceType = s.ServiceType,
2403:                                              ServiceSuspension = s.ServiceSuspension,
2404:                                              ServiceTypeName = s.ServiceType.ToString(),
2405:                                              Updated = s.Updated,
2406:                                              AccessId = s.Access.Id
2407:                                          }).ToList();
2408:   
2409:                          huSbrList = (from h in db.HuSbrs
2410:                                       join i in impuSipDomainList on h.IMPU equals i
2411:                                       select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
2412:                                       {
2413:                                           COP = h.COP,
2414:                                           CSC = h.CSC,
2415:                                           Id = h.Id,
2416:                                           IMPU = h.IMPU,
2417:                                           ITT = h.ITT,
2418:                                           LP = h.LP,
2419:                                           NS3PTY = h.NS3PTY,
2420:                                           NSABRC = h.NSABRC,
2421:                                           NSCBA = h.NSCBA,
2422:                                           NSCFU = h.NSCFU,
2423:                                           NSCLIP = h.NSCLIP,
2424:                                           NSCW = h.NSCW,
2425:                                           NSFAX = h.NSFAX,
2426:                                           NSHOLD = h.NSHOLD,
2427:                                           NSNPTY = h.NSNPTY,
2428:                                           NSWAKE_UP = h.NSWAKE_UP,
2429:                                           Created = h.Created,
2430:                                           Updated = h.Updated
2431:                                       }).ToList();
2432:   
2433:                          owsbrList = (from o in db.Owsbrs join i in impuSipDomainList on o.IMPU equals i select o).ToList();
2434:   
2435:                          serviceRequestList = (from sr in db.ServiceRequests join n in numberList on sr.Number equals n select sr).ToList();
2436:                          serviceRequestList = serviceRequestList.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList on sr.ServiceRequestService.Id equals srsid where sr.ServiceRequestService != null select sr).ToList();
2437:                          foreach (var v in serviceRequestList) serviceRequestIdList.Add(v.Id);
2438:                          serviceRequestIdList = serviceRequestIdList.Distinct().ToList();
2439:   
2440:                          serviceRequestAdministrativeIssueList = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList on srai.Service equals sid select srai).ToList();
2441:   
2442:                          //serviceRequestHistoryIdList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryIdListFromServiceList(serviceList);
2443:                          //serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestHistoryList(serviceRequestHistoryIdList);
2444:   
2445:                          serviceRequestTypeList = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList on srt.ServiceRequest.Id equals srid where srt.ServiceRequest != null select srt).ToList();
2446:   
2447:                          reportList = ((from r in db.Reports join n in serviceList on r.Service equals n select r).Include(x => x.ReportHistories)).ToList();
2448:                          foreach (var v in reportList) reportIdList.Add(v.Id);
2449:                          reportIdList = reportIdList.Distinct().ToList();
2450:   
2451:                          nddOntList = (from nddo in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join ip in ipList on nddo.Ip equals ip select nddo).ToList();
2452:                          foreach (var v in nddOntList)
2453:                          {
2454:                              ontIdList.Add(v.Id);
2455:   
2456:                              //eventSystemList.Add(v.Pon.PonGroup.Olt.AmsName);
2457:                              //eventAidOntList.Add("ONT-1-1-" + v.Card + "-" + v.Port + "-" + v.Number);
2458:                              //eventAidOntVoipList.Add("ONTVOIP-1-1-" + v.Card + "-" + v.Port + "-1");
2459:                          }
2460:                          ontIdList = ontIdList.Distinct().ToList();
2461:                          //eventSystemList = eventSystemList.Distinct().ToList();
2462:                          //eventAidOntList = eventAidOntList.Distinct().ToList();
2463:                          //eventAidOntVoipList = eventAidOntVoipList.Distinct().ToList();
2464:   
2465:                          ontList = (from o in db.Onts join oid in ontIdList on o.Id equals oid select o).ToList();
2466:                          foreach (var v in ontList) ontIdList.Add(v.Id);
2467:                          ontIdList = ontIdList.Distinct().ToList();
2468:   
2469:                          foreach (var v in ontList) if (v.Access != null) accessIdList.Add(v.Access.Id);
2470:                          accessIdList = accessIdList.Distinct().ToList();
2471:   
2472:                          ontOntPotsList = (from op in db.OntOntPotses join oid in ontIdList on op.Ont.Id equals oid select op).ToList();
2473:                          ontServiceVoipList = (from ov in db.OntServiceVoips join oid in ontIdList on ov.Ont.Id equals oid select ov).ToList();
2474:   
2475:                          accessList = (from a in db.Accesses join aid in accessIdList on a.Id equals aid select a).ToList();
2476:                          foreach (var v in nddOntList)
2477:                          {
2478:                              ontIdList.Add(v.Id);
2479:   
2480:                              //eventSystemList.Add(v.Pon.PonGroup.Olt.AmsName);
2481:                              //eventAidOntList.Add("ONT-1-1-" + v.Card + "-" + v.Port + "-" + v.Number);
2482:                              //eventAidOntVoipList.Add("ONTVOIP-1-1-" + v.Card + "-" + v.Port + "-1");
2483:   
2484:                              //foreach (var w in ontOntPotsList) eventAidOntPotsList.Add("ONTPOTS-1-1-" + v.Card + "-" + v.Port + "-" + w.Card + "-" + w.Port);
2485:                          }
2486:                          ontIdList = ontIdList.Distinct().ToList();
2487:                          //eventSystemList = eventSystemList.Distinct().ToList();
2488:                          //eventAidOntList = eventAidOntList.Distinct().ToList();
2489:                          //eventAidOntVoipList = eventAidOntVoipList.Distinct().ToList();
2490:   
2491:                          /*
2492:                          eventList = (from e in db.Events join es in eventSystemList on e.System equals es join eao in eventAidOntList on e.Aid equals eao select e)
2493:                                      .Union(from e in db.Events join es in eventSystemList on e.System equals es join eao in eventAidOntList on e.Aid equals eao join eaov in eventAidOntVoipList on e.Aid equals eaov select e)
2494:                                      .Union(from e in db.Events join es in eventSystemList on e.System equals es join eao in eventAidOntList on e.Aid equals eao join eaop in eventAidOntPotsList on e.Aid equals eaop select e)
2495:                                      .ToList();
2496:                                      */
2497:                      }
2498:                  }
2499:                  catch (Exception ex)
2500:                  {
2501:                      result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
2502:                  }
2503:              }
2504:              else
2505:              {
2506:                  result.AddError("The gatewayId \"" + rawInput + "\" is not within the allowed gatewayId range (الرقم لا ينتمي للمجال). ");
2507:              }
2508:          }
2509:   
2510:          ////////////////////////////////////////////////////////////////////////////
2511:   
2512:          /// <summary>
2513:          ///
2514:          /// </summary>
2515:          public static void AreaBlock(string rawInput, out List<Ia.Ngn.Cl.Model.Access> accessList, out Ia.Cl.Model.Result result)
2516:          {
2517:              string input;
2518:   
2519:              result = new Ia.Cl.Model.Result();
2520:              accessList = null;
2521:   
2522:              input = rawInput.ToLower();
2523:   
2524:              try
2525:              {
2526:                  // note that this returns 0 int values for missing fields
2527:                  ExtractAreaBlockFromSearchAreaBlockTerm(input, out Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea kuwaitNgnArea, out string block);
2528:   
2529:                  if (kuwaitNgnArea != null)
2530:                  {
2531:                      using (var db = new Ia.Ngn.Cl.Model.Ngn())
2532:                      {
2533:                          accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessListFromAreaAndBlock(kuwaitNgnArea.Id, block);
2534:                      }
2535:                  }
2536:                  else
2537:                  {
2538:                      result.AddError("The area of \"" + rawInput + "\" is unrecognized. ");
2539:                  }
2540:              }
2541:              catch (Exception ex)
2542:              {
2543:                  result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
2544:              }
2545:          }
2546:   
2547:          ////////////////////////////////////////////////////////////////////////////
2548:   
2549:          /// <summary>
2550:          ///
2551:          /// </summary>
2552:          public static void Address(string rawInput, out List<Ia.Ngn.Cl.Model.Access> accessList, out Ia.Cl.Model.Result result)
2553:          {
2554:              string input;
2555:   
2556:              result = new Ia.Cl.Model.Result();
2557:              accessList = null;
2558:   
2559:              input = rawInput.ToLower();
2560:   
2561:              try
2562:              {
2563:                  // note that this returns 0 int values for missing fields
2564:                  ExtractAddressFromSearchAddressTerm(input, out Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea kuwaitNgnArea, out string block, out int street, out int premisesOld, out int premisesNew);
2565:   
2566:                  if (kuwaitNgnArea != null)
2567:                  {
2568:                      accessList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.AccessListFromAddress(kuwaitNgnArea.Id, block, street, premisesOld, premisesNew);
2569:                  }
2570:                  else
2571:                  {
2572:                      result.AddError("The area of \"" + rawInput + "\" is unrecognized. ");
2573:                  }
2574:              }
2575:              catch (Exception ex)
2576:              {
2577:                  result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
2578:              }
2579:          }
2580:   
2581:          ////////////////////////////////////////////////////////////////////////////
2582:   
2583:          /// <summary>
2584:          ///
2585:          /// </summary>
2586:          public static void CustomerName(string rawInput, out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList, out Ia.Cl.Model.Result result)
2587:          {
2588:              string input;
2589:              int maxNumberOfResults = 1000;
2590:              string customerName;
2591:   
2592:              result = new Ia.Cl.Model.Result();
2593:              serviceRequestList = null;
2594:   
2595:              input = rawInput.ToLower();
2596:   
2597:              try
2598:              {
2599:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2600:                  {
2601:                      customerName = Ia.Ngn.Cl.Model.Business.Default.CorrectCustomerName(input);
2602:   
2603:                      if (!string.IsNullOrEmpty(customerName))
2604:                      {
2605:                          serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestListForCustomerName(customerName, maxNumberOfResults);
2606:   
2607:                          if (serviceRequestList.Count >= maxNumberOfResults) result.AddSuccess("The search returned " + maxNumberOfResults + " or more results. The output is limited to " + maxNumberOfResults + ". ");
2608:                      }
2609:                      else
2610:                      {
2611:                          serviceRequestList = null;
2612:                      }
2613:                  }
2614:              }
2615:              catch (Exception ex)
2616:              {
2617:                  result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
2618:              }
2619:          }
2620:   
2621:          ////////////////////////////////////////////////////////////////////////////
2622:   
2623:          /// <summary>
2624:          ///
2625:          /// </summary>
2626:          public static void CustomerId(string rawInput, out List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList, out Ia.Cl.Model.Result result)
2627:          {
2628:              string input;
2629:              int customerId, maxNumberOfResults = 1000;
2630:   
2631:              result = new Ia.Cl.Model.Result();
2632:              serviceRequestList = null;
2633:   
2634:              input = rawInput.ToLower();
2635:   
2636:              try
2637:              {
2638:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2639:                  {
2640:                      customerId = int.Parse(input);
2641:   
2642:                      serviceRequestList = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestListForCustomerId(customerId, maxNumberOfResults);
2643:   
2644:                      if (serviceRequestList.Count >= maxNumberOfResults) result.AddSuccess("The search returned " + maxNumberOfResults + " or more results. The output is limited to " + maxNumberOfResults + ". ");
2645:                  }
2646:              }
2647:              catch (Exception ex)
2648:              {
2649:                  result.AddError("Exception: Retrieval error of data for \"" + rawInput + "\": " + ex.ToString());
2650:              }
2651:          }
2652:   
2653:          ////////////////////////////////////////////////////////////////////////////
2654:   
2655:          /// <summary>
2656:          /// Extract area,block from search term like "SLA,2" {kuwaitAreaSymbol,block}
2657:          /// </summary>
2658:          private static void ExtractAreaBlockFromSearchAreaBlockTerm(string addressTerm, out Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea kuwaitNgnArea, out string block)
2659:          {
2660:              int i;
2661:              string kuwaitNgnAreaSymbol;
2662:              Match match;
2663:   
2664:              // "SLA,2"
2665:              match = Regex.Match(addressTerm, @"^([a-zA-Z]{3}),(\d{1,3})$");
2666:   
2667:              kuwaitNgnAreaSymbol = match.Groups[1].Value;
2668:              block = match.Groups[2].Value;
2669:   
2670:              kuwaitNgnArea = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Symbol == kuwaitNgnAreaSymbol.ToUpper() select kna).FirstOrDefault();
2671:          }
2672:   
2673:          ////////////////////////////////////////////////////////////////////////////
2674:   
2675:          /// <summary>
2676:          /// Extract address from search term like "SLA,2,202,339,36" {kuwaitAreaSymbol,block,street,old premises,new premises}
2677:          /// </summary>
2678:          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)
2679:          {
2680:              int i;
2681:              string kuwaitNgnAreaSymbol;
2682:              Match match;
2683:   
2684:              // "SLA,2,202,339,36"
2685:              match = Regex.Match(addressTerm, @"^([a-zA-Z]{3}),(\d{1,3}),(\d{0,3}),(\d{0,3}),(\d{0,3})$");
2686:   
2687:              kuwaitNgnAreaSymbol = match.Groups[1].Value;
2688:              block = match.Groups[2].Value;
2689:              street = int.TryParse(match.Groups[3].Value, out i) ? i : 0;
2690:              premisesOld = int.TryParse(match.Groups[4].Value, out i) ? i : 0;
2691:              premisesNew = int.TryParse(match.Groups[5].Value, out i) ? i : 0;
2692:   
2693:              kuwaitNgnArea = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Symbol == kuwaitNgnAreaSymbol.ToUpper() select kna).FirstOrDefault();
2694:          }
2695:   
2696:          ////////////////////////////////////////////////////////////////////////////
2697:          ////////////////////////////////////////////////////////////////////////////   
2698:      }
2699:   
2700:      ////////////////////////////////////////////////////////////////////////////
2701:      ////////////////////////////////////////////////////////////////////////////   
2702:  }