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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Find

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

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

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