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

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