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

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