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