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

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 data model

   1:  using System.Data;
   2:  using System.Linq;
   3:  using System.Collections.Generic;
   4:  using Microsoft.EntityFrameworkCore;
   5:   
   6:  namespace Ia.Ngn.Cl.Model.Data.Maintenance
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// Find subscriber and network information support class for the Next Generation Network data model
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2006-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// 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
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      public class Find
  28:      {
  29:          ////////////////////////////////////////////////////////////////////////////
  30:   
  31:          /// <summary>
  32:          ///
  33:          /// </summary>
  34:          public Find() { }
  35:   
  36:          ////////////////////////////////////////////////////////////////////////////
  37:   
  38:          /// <summary>
  39:          /// 
  40:          /// </summary>
  41:          public static List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> ServiceRequestServiceList(List<string> serviceRequestServiceIdList)
  42:          {
  43:              List<Ia.Ngn.Cl.Model.ServiceRequestService> inList;
  44:              List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> list;
  45:   
  46:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  47:              {
  48:                  if (serviceRequestServiceIdList.Count == 1)
  49:                  {
  50:                      var serviceRequestServiceId = serviceRequestServiceIdList[0];
  51:                      inList = (from srs in db.ServiceRequestServices where srs.Id == serviceRequestServiceId select srs).ToList();
  52:                  }
  53:                  else if (serviceRequestServiceIdList.Count <= 32)
  54:                  {
  55:                      inList = (from srs in db.ServiceRequestServices where serviceRequestServiceIdList.Contains(srs.Id) select srs).ToList();
  56:                  }
  57:                  else if (serviceRequestServiceIdList.Count <= 64)
  58:                  {
  59:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  60:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, serviceRequestServiceIdList.Count - 32 - 1) on srs.Id equals srsid select srs).ToList();
  61:                  }
  62:                  else if (serviceRequestServiceIdList.Count <= 96)
  63:                  {
  64:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  65:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  66:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, serviceRequestServiceIdList.Count - 64 - 1) on srs.Id equals srsid select srs).ToList();
  67:                  }
  68:                  else if (serviceRequestServiceIdList.Count <= 128)
  69:                  {
  70:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  71:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  72:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  73:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, serviceRequestServiceIdList.Count - 96 - 1) on srs.Id equals srsid select srs).ToList();
  74:                  }
  75:                  else if (serviceRequestServiceIdList.Count <= 160)
  76:                  {
  77:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  78:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  79:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  80:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  81:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, serviceRequestServiceIdList.Count - 128 - 1) on srs.Id equals srsid select srs).ToList();
  82:                  }
  83:                  else if (serviceRequestServiceIdList.Count <= 192)
  84:                  {
  85:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  86:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  87:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  88:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  89:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
  90:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, serviceRequestServiceIdList.Count - 160 - 1) on srs.Id equals srsid select srs).ToList();
  91:                  }
  92:                  else if (serviceRequestServiceIdList.Count <= 224)
  93:                  {
  94:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  95:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  96:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  97:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  98:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
  99:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, 32) on srs.Id equals srsid select srs).ToList();
 100:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(192, serviceRequestServiceIdList.Count - 192 - 1) on srs.Id equals srsid select srs).ToList();
 101:                  }
 102:                  else //if (serviceRequestServiceIdList.Count <= 256)
 103:                  {
 104:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
 105:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
 106:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
 107:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
 108:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
 109:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, 32) on srs.Id equals srsid select srs).ToList();
 110:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(192, 32) on srs.Id equals srsid select srs).ToList();
 111:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(224, serviceRequestServiceIdList.Count - 224 - 1) on srs.Id equals srsid select srs).ToList();
 112:                  }
 113:   
 114:                  list = (from srs in inList
 115:                          select new Ia.Ngn.Cl.Model.Ui.ServiceRequestService()
 116:                          {
 117:                              Id = srs.Id,
 118:                              AbbriviatedCalling = srs.AbbriviatedCalling,
 119:                              Access = srs.Access,
 120:                              AlarmCall = srs.AlarmCall,
 121:                              CallBarring = srs.CallBarring,
 122:                              CallerId = srs.CallerId,
 123:                              CallForwarding = srs.CallForwarding,
 124:                              CallWaiting = srs.CallWaiting,
 125:                              ConferenceCall = srs.ConferenceCall,
 126:                              Created = srs.Created,
 127:                              InternationalCalling = srs.InternationalCalling,
 128:                              InternationalCallingUserControlled = srs.InternationalCallingUserControlled,
 129:                              LastRequestDateTime = srs.LastRequestDateTime,
 130:                              Provisioned = srs.Provisioned,
 131:                              Service = srs.Service,
 132:                              Serial = srs.Serial,
 133:                              ServiceType = srs.ServiceType,
 134:                              ServiceSuspension = srs.ServiceSuspension,
 135:                              Type = srs.Type,
 136:                              Updated = srs.Updated
 137:                          }).ToList();
 138:   
 139:                  return list.Distinct().ToList();
 140:              }
 141:          }
 142:   
 143:          ////////////////////////////////////////////////////////////////////////////
 144:   
 145:          /// <summary>
 146:          /// 
 147:          /// </summary>
 148:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestList(List<int> serviceRequestIdList)
 149:          {
 150:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 151:   
 152:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 153:              {
 154:                  if (serviceRequestIdList.Count == 1)
 155:                  {
 156:                      var serviceRequestId = serviceRequestIdList[0];
 157:                      list = (from sr in db.ServiceRequests where sr.Id == serviceRequestId select sr).ToList();
 158:                  }
 159:                  else if (serviceRequestIdList.Count <= 32)
 160:                  {
 161:                      list = (from sr in db.ServiceRequests where serviceRequestIdList.Contains(sr.Id) select sr).ToList();
 162:                  }
 163:                  else if (serviceRequestIdList.Count <= 64)
 164:                  {
 165:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 166:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, serviceRequestIdList.Count - 32 - 1) on sr.Id equals srid select sr).ToList();
 167:                  }
 168:                  else if (serviceRequestIdList.Count <= 96)
 169:                  {
 170:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 171:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 172:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, serviceRequestIdList.Count - 64 - 1) on sr.Id equals srid select sr).ToList();
 173:                  }
 174:                  else if (serviceRequestIdList.Count <= 128)
 175:                  {
 176:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 177:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 178:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 179:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, serviceRequestIdList.Count - 96 - 1) on sr.Id equals srid select sr).ToList();
 180:                  }
 181:                  else if (serviceRequestIdList.Count <= 160)
 182:                  {
 183:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 184:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 185:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 186:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 187:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, serviceRequestIdList.Count - 128 - 1) on sr.Id equals srid select sr).ToList();
 188:                  }
 189:                  else if (serviceRequestIdList.Count <= 192)
 190:                  {
 191:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 192:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 193:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 194:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 195:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 196:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, serviceRequestIdList.Count - 160 - 1) on sr.Id equals srid select sr).ToList();
 197:                  }
 198:                  else if (serviceRequestIdList.Count <= 224)
 199:                  {
 200:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 201:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 202:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 203:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 204:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 205:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 206:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, serviceRequestIdList.Count - 192 - 1) on sr.Id equals srid select sr).ToList();
 207:                  }
 208:                  else if (serviceRequestIdList.Count <= 256)
 209:                  {
 210:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 211:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 212:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 213:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 214:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 215:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 216:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 217:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, serviceRequestIdList.Count - 224 - 1) on sr.Id equals srid select sr).ToList();
 218:                  }
 219:                  else if (serviceRequestIdList.Count <= 288)
 220:                  {
 221:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 222:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 223:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 224:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 225:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 226:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 227:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 228:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 229:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, serviceRequestIdList.Count - 256 - 1) on sr.Id equals srid select sr).ToList();
 230:                  }
 231:                  else if (serviceRequestIdList.Count <= 320)
 232:                  {
 233:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 234:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 235:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 236:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 237:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 238:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 239:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 240:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 241:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 242:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, serviceRequestIdList.Count - 288 - 1) on sr.Id equals srid select sr).ToList();
 243:                  }
 244:                  else if (serviceRequestIdList.Count <= 352)
 245:                  {
 246:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 247:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 248:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 249:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 250:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 251:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 252:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 253:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 254:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 255:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 256:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, serviceRequestIdList.Count - 320 - 1) on sr.Id equals srid select sr).ToList();
 257:                  }
 258:                  else if (serviceRequestIdList.Count <= 384)
 259:                  {
 260:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 261:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 262:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 263:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 264:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 265:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 266:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 267:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 268:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 269:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 270:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 271:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, serviceRequestIdList.Count - 352 - 1) on sr.Id equals srid select sr).ToList();
 272:                  }
 273:                  else if (serviceRequestIdList.Count <= 416)
 274:                  {
 275:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 276:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 277:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 278:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 279:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 280:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 281:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 282:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 283:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 284:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 285:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 286:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 287:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, serviceRequestIdList.Count - 384 - 1) on sr.Id equals srid select sr).ToList();
 288:                  }
 289:                  else if (serviceRequestIdList.Count <= 448)
 290:                  {
 291:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 292:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 293:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 294:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 295:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 296:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 297:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 298:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 299:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 300:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 301:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 302:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 303:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 304:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, serviceRequestIdList.Count - 416 - 1) on sr.Id equals srid select sr).ToList();
 305:                  }
 306:                  else if (serviceRequestIdList.Count <= 480)
 307:                  {
 308:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 309:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 310:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 311:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 312:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 313:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 314:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 315:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 316:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 317:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 318:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 319:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 320:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 321:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 322:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, serviceRequestIdList.Count - 448 - 1) on sr.Id equals srid select sr).ToList();
 323:                  }
 324:                  else if (serviceRequestIdList.Count <= 512)
 325:                  {
 326:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 327:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 328:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 329:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 330:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 331:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 332:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 333:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 334:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 335:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 336:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 337:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 338:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 339:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 340:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 341:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, serviceRequestIdList.Count - 480 - 1) on sr.Id equals srid select sr).ToList();
 342:                  }
 343:                  else if (serviceRequestIdList.Count <= 544)
 344:                  {
 345:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 346:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 347:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 348:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 349:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 350:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 351:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 352:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 353:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 354:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 355:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 356:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 357:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 358:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 359:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 360:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 361:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(512, serviceRequestIdList.Count - 512 - 1) on sr.Id equals srid select sr).ToList();
 362:                  }
 363:                  else //if (serviceIdList.Count <= ??)
 364:                  {
 365:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 366:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 367:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 368:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 369:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 370:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 371:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 372:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 373:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 374:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 375:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 376:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 377:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 378:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 379:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 380:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 381:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(512, 32) on sr.Id equals srid select sr).ToList();
 382:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(544, serviceRequestIdList.Count - 544 - 1) on sr.Id equals srid select sr).ToList();
 383:                  }
 384:              }
 385:   
 386:              return list.Distinct().ToList();
 387:          }
 388:   
 389:          ////////////////////////////////////////////////////////////////////////////
 390:   
 391:          /// <summary>
 392:          /// 
 393:          /// </summary>
 394:          public static List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> ServiceRequestAdministrativeIssueList(List<string> serviceRequestAdministrativeIssueIdList)
 395:          {
 396:              List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> list;
 397:   
 398:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 399:              {
 400:                  if (serviceRequestAdministrativeIssueIdList.Count == 1)
 401:                  {
 402:                      var serviceRequestAdministrativeIssueId = serviceRequestAdministrativeIssueIdList[0];
 403:                      list = (from srai in db.ServiceRequestAdministrativeIssues where srai.Id == serviceRequestAdministrativeIssueId select srai).ToList();
 404:                  }
 405:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 32)
 406:                  {
 407:                      list = (from srai in db.ServiceRequestAdministrativeIssues where serviceRequestAdministrativeIssueIdList.Contains(srai.Id) select srai).ToList();
 408:                  }
 409:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 64)
 410:                  {
 411:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 412:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, serviceRequestAdministrativeIssueIdList.Count - 32 - 1) on srai.Id equals sraiid select srai).ToList();
 413:                  }
 414:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 96)
 415:                  {
 416:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 417:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 418:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, serviceRequestAdministrativeIssueIdList.Count - 64 - 1) on srai.Id equals sraiid select srai).ToList();
 419:                  }
 420:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 128)
 421:                  {
 422:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 423:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 424:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 425:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, serviceRequestAdministrativeIssueIdList.Count - 96 - 1) on srai.Id equals sraiid select srai).ToList();
 426:                  }
 427:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 160)
 428:                  {
 429:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 430:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 431:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 432:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 433:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, serviceRequestAdministrativeIssueIdList.Count - 128 - 1) on srai.Id equals sraiid select srai).ToList();
 434:                  }
 435:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 192)
 436:                  {
 437:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 438:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 439:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 440:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 441:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 442:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, serviceRequestAdministrativeIssueIdList.Count - 160 - 1) on srai.Id equals sraiid select srai).ToList();
 443:                  }
 444:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 224)
 445:                  {
 446:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 447:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 448:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 449:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 450:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 451:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 452:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, serviceRequestAdministrativeIssueIdList.Count - 192 - 1) on srai.Id equals sraiid select srai).ToList();
 453:                  }
 454:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 256)
 455:                  {
 456:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 457:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 458:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 459:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 460:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 461:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 462:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 463:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, serviceRequestAdministrativeIssueIdList.Count - 224 - 1) on srai.Id equals sraiid select srai).ToList();
 464:                  }
 465:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 288)
 466:                  {
 467:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 468:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 469:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 470:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 471:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 472:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 473:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 474:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 475:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, serviceRequestAdministrativeIssueIdList.Count - 256 - 1) on srai.Id equals sraiid select srai).ToList();
 476:                  }
 477:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 320)
 478:                  {
 479:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 480:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 481:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 482:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 483:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 484:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 485:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 486:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 487:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 488:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, serviceRequestAdministrativeIssueIdList.Count - 288 - 1) on srai.Id equals sraiid select srai).ToList();
 489:                  }
 490:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 352)
 491:                  {
 492:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 493:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 494:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 495:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 496:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 497:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 498:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 499:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 500:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 501:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 502:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, serviceRequestAdministrativeIssueIdList.Count - 320 - 1) on srai.Id equals sraiid select srai).ToList();
 503:                  }
 504:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 384)
 505:                  {
 506:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 507:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 508:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 509:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 510:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 511:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 512:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 513:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 514:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 515:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 516:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 517:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, serviceRequestAdministrativeIssueIdList.Count - 352 - 1) on srai.Id equals sraiid select srai).ToList();
 518:                  }
 519:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 416)
 520:                  {
 521:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 522:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 523:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 524:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 525:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 526:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 527:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 528:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 529:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 530:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 531:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 532:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 533:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, serviceRequestAdministrativeIssueIdList.Count - 384 - 1) on srai.Id equals sraiid select srai).ToList();
 534:                  }
 535:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 448)
 536:                  {
 537:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 538:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 539:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 540:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 541:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 542:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 543:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 544:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 545:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 546:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 547:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 548:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 549:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 550:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, serviceRequestAdministrativeIssueIdList.Count - 416 - 1) on srai.Id equals sraiid select srai).ToList();
 551:                  }
 552:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 480)
 553:                  {
 554:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 555:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 556:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 557:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 558:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 559:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 560:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 561:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 562:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 563:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 564:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 565:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 566:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 567:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 568:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, serviceRequestAdministrativeIssueIdList.Count - 448 - 1) on srai.Id equals sraiid select srai).ToList();
 569:                  }
 570:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 512)
 571:                  {
 572:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 573:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 574:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 575:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 576:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 577:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 578:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 579:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 580:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 581:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 582:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 583:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 584:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 585:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 586:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, 32) on srai.Id equals sraiid select srai).ToList();
 587:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(480, serviceRequestAdministrativeIssueIdList.Count - 480 - 1) on srai.Id equals sraiid select srai).ToList();
 588:                  }
 589:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 544)
 590:                  {
 591:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 592:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 593:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 594:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 595:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 596:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 597:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 598:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 599:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 600:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 601:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 602:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 603:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 604:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 605:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, 32) on srai.Id equals sraiid select srai).ToList();
 606:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(480, 32) on srai.Id equals sraiid select srai).ToList();
 607:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(512, serviceRequestAdministrativeIssueIdList.Count - 512 - 1) on srai.Id equals sraiid select srai).ToList();
 608:                  }
 609:                  else //if (serviceIdList.Count <= ??)
 610:                  {
 611:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 612:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 613:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 614:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 615:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 616:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 617:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 618:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 619:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 620:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 621:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 622:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 623:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 624:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 625:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, 32) on srai.Id equals sraiid select srai).ToList();
 626:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(480, 32) on srai.Id equals sraiid select srai).ToList();
 627:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(512, 32) on srai.Id equals sraiid select srai).ToList();
 628:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(544, serviceRequestAdministrativeIssueIdList.Count - 544 - 1) on srai.Id equals sraiid select srai).ToList();
 629:                  }
 630:              }
 631:   
 632:              return list.Distinct().ToList();
 633:          }
 634:   
 635:          ////////////////////////////////////////////////////////////////////////////
 636:   
 637:          /// <summary>
 638:          /// 
 639:          /// </summary>
 640:          public static List<Ia.Ngn.Cl.Model.ServiceRequestHistory> ServiceRequestHistoryList(List<string> serviceRequestHistoryIdList)
 641:          {
 642:              List<Ia.Ngn.Cl.Model.ServiceRequestHistory> list;
 643:   
 644:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 645:              {
 646:                  if (serviceRequestHistoryIdList.Count == 1)
 647:                  {
 648:                      var serviceRequestHistoryId = serviceRequestHistoryIdList[0];
 649:                      list = (from srh in db.ServiceRequestHistories where srh.Id == serviceRequestHistoryId select srh).ToList();
 650:                  }
 651:                  else if (serviceRequestHistoryIdList.Count <= 32)
 652:                  {
 653:                      list = (from srh in db.ServiceRequestHistories where serviceRequestHistoryIdList.Contains(srh.Id) select srh).ToList();
 654:                  }
 655:                  else if (serviceRequestHistoryIdList.Count <= 64)
 656:                  {
 657:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 658:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, serviceRequestHistoryIdList.Count - 32 - 1) on srh.Id equals srhid select srh).ToList();
 659:                  }
 660:                  else if (serviceRequestHistoryIdList.Count <= 96)
 661:                  {
 662:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 663:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 664:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, serviceRequestHistoryIdList.Count - 64 - 1) on srh.Id equals srhid select srh).ToList();
 665:                  }
 666:                  else if (serviceRequestHistoryIdList.Count <= 128)
 667:                  {
 668:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 669:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 670:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 671:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, serviceRequestHistoryIdList.Count - 96 - 1) on srh.Id equals srhid select srh).ToList();
 672:                  }
 673:                  else if (serviceRequestHistoryIdList.Count <= 160)
 674:                  {
 675:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 676:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 677:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 678:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 679:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, serviceRequestHistoryIdList.Count - 128 - 1) on srh.Id equals srhid select srh).ToList();
 680:                  }
 681:                  else if (serviceRequestHistoryIdList.Count <= 192)
 682:                  {
 683:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 684:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 685:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 686:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 687:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 688:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, serviceRequestHistoryIdList.Count - 160 - 1) on srh.Id equals srhid select srh).ToList();
 689:                  }
 690:                  else if (serviceRequestHistoryIdList.Count <= 224)
 691:                  {
 692:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 693:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 694:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 695:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 696:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 697:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 698:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, serviceRequestHistoryIdList.Count - 192 - 1) on srh.Id equals srhid select srh).ToList();
 699:                  }
 700:                  else if (serviceRequestHistoryIdList.Count <= 256)
 701:                  {
 702:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 703:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 704:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 705:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 706:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 707:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 708:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 709:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, serviceRequestHistoryIdList.Count - 224 - 1) on srh.Id equals srhid select srh).ToList();
 710:                  }
 711:                  else if (serviceRequestHistoryIdList.Count <= 288)
 712:                  {
 713:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 714:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 715:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 716:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 717:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 718:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 719:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 720:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 721:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, serviceRequestHistoryIdList.Count - 256 - 1) on srh.Id equals srhid select srh).ToList();
 722:                  }
 723:                  else if (serviceRequestHistoryIdList.Count <= 320)
 724:                  {
 725:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 726:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 727:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 728:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 729:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 730:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 731:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 732:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 733:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 734:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, serviceRequestHistoryIdList.Count - 288 - 1) on srh.Id equals srhid select srh).ToList();
 735:                  }
 736:                  else if (serviceRequestHistoryIdList.Count <= 352)
 737:                  {
 738:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 739:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 740:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 741:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 742:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 743:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 744:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 745:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 746:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 747:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 748:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, serviceRequestHistoryIdList.Count - 320 - 1) on srh.Id equals srhid select srh).ToList();
 749:                  }
 750:                  else if (serviceRequestHistoryIdList.Count <= 384)
 751:                  {
 752:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 753:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 754:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 755:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 756:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 757:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 758:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 759:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 760:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 761:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 762:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 763:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, serviceRequestHistoryIdList.Count - 352 - 1) on srh.Id equals srhid select srh).ToList();
 764:                  }
 765:                  else if (serviceRequestHistoryIdList.Count <= 416)
 766:                  {
 767:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 768:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 769:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 770:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 771:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 772:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 773:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 774:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 775:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 776:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 777:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 778:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 779:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, serviceRequestHistoryIdList.Count - 384 - 1) on srh.Id equals srhid select srh).ToList();
 780:                  }
 781:                  else if (serviceRequestHistoryIdList.Count <= 448)
 782:                  {
 783:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 784:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 785:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 786:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 787:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 788:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 789:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 790:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 791:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 792:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 793:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 794:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 795:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 796:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, serviceRequestHistoryIdList.Count - 416 - 1) on srh.Id equals srhid select srh).ToList();
 797:                  }
 798:                  else if (serviceRequestHistoryIdList.Count <= 480)
 799:                  {
 800:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 801:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 802:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 803:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 804:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 805:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 806:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 807:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 808:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 809:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 810:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 811:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 812:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 813:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 814:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, serviceRequestHistoryIdList.Count - 448 - 1) on srh.Id equals srhid select srh).ToList();
 815:                  }
 816:                  else if (serviceRequestHistoryIdList.Count <= 512)
 817:                  {
 818:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 819:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 820:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 821:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 822:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 823:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 824:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 825:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 826:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 827:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 828:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 829:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 830:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 831:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 832:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 833:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, serviceRequestHistoryIdList.Count - 480 - 1) on srh.Id equals srhid select srh).ToList();
 834:                  }
 835:                  else if (serviceRequestHistoryIdList.Count <= 544)
 836:                  {
 837:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 838:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 839:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 840:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 841:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 842:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 843:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 844:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 845:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 846:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 847:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 848:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 849:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 850:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 851:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 852:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, 32) on srh.Id equals srhid select srh).ToList();
 853:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(512, serviceRequestHistoryIdList.Count - 512 - 1) on srh.Id equals srhid select srh).ToList();
 854:                  }
 855:                  else //if (serviceIdList.Count <= ??)
 856:                  {
 857:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 858:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 859:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 860:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 861:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 862:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 863:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 864:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 865:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 866:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 867:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 868:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 869:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 870:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 871:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 872:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, 32) on srh.Id equals srhid select srh).ToList();
 873:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(512, 32) on srh.Id equals srhid select srh).ToList();
 874:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(544, serviceRequestHistoryIdList.Count - 544 - 1) on srh.Id equals srhid select srh).ToList();
 875:                  }
 876:              }
 877:   
 878:              return list.Distinct().ToList();
 879:          }
 880:   
 881:          ////////////////////////////////////////////////////////////////////////////
 882:   
 883:          /// <summary>
 884:          /// 
 885:          /// </summary>
 886:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerId(int customerId, int maxNumberOfResults)
 887:          {
 888:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 889:   
 890:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 891:              {
 892:                  list = (from sr in db.ServiceRequests where sr.CustomerId == customerId select sr).Take(maxNumberOfResults).ToList();
 893:              }
 894:   
 895:              return list.Distinct().ToList();
 896:          }
 897:   
 898:          ////////////////////////////////////////////////////////////////////////////
 899:   
 900:          /// <summary>
 901:          /// 
 902:          /// </summary>
 903:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerName(string customerName, int maxNumberOfResults)
 904:          {
 905:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 906:   
 907:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 908:              {
 909:                  list = (from sr in db.ServiceRequests 
 910:                          where sr.CustomerName == customerName || sr.CustomerName.Contains(customerName) 
 911:                          select sr).Take(maxNumberOfResults).ToList();
 912:              }
 913:   
 914:              return list.Distinct().ToList();
 915:          }
 916:   
 917:          ////////////////////////////////////////////////////////////////////////////
 918:   
 919:          /// <summary>
 920:          /// 
 921:          /// </summary>
 922:          public static List<Ia.Ngn.Cl.Model.ServiceRequestType> ServiceRequestTypeList(List<int> serviceRequestTypeIdList)
 923:          {
 924:              List<Ia.Ngn.Cl.Model.ServiceRequestType> list;
 925:   
 926:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 927:              {
 928:                  if (serviceRequestTypeIdList.Count == 1)
 929:                  {
 930:                      var serviceRequestTypeId = serviceRequestTypeIdList[0];
 931:                      list = (from srt in db.ServiceRequestTypes where srt.Id == serviceRequestTypeId select srt).ToList();
 932:                  }
 933:                  else if (serviceRequestTypeIdList.Count <= 32)
 934:                  {
 935:                      list = (from srt in db.ServiceRequestTypes where serviceRequestTypeIdList.Contains(srt.Id) select srt).ToList();
 936:                  }
 937:                  else if (serviceRequestTypeIdList.Count <= 64)
 938:                  {
 939:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 940:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, serviceRequestTypeIdList.Count - 32 - 1) on srt.Id equals srtid select srt).ToList();
 941:                  }
 942:                  else if (serviceRequestTypeIdList.Count <= 96)
 943:                  {
 944:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 945:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 946:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, serviceRequestTypeIdList.Count - 64 - 1) on srt.Id equals srtid select srt).ToList();
 947:                  }
 948:                  else if (serviceRequestTypeIdList.Count <= 128)
 949:                  {
 950:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 951:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 952:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 953:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, serviceRequestTypeIdList.Count - 96 - 1) on srt.Id equals srtid select srt).ToList();
 954:                  }
 955:                  else if (serviceRequestTypeIdList.Count <= 160)
 956:                  {
 957:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 958:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 959:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 960:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 961:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, serviceRequestTypeIdList.Count - 128 - 1) on srt.Id equals srtid select srt).ToList();
 962:                  }
 963:                  else if (serviceRequestTypeIdList.Count <= 192)
 964:                  {
 965:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 966:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 967:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 968:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 969:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 970:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, serviceRequestTypeIdList.Count - 160 - 1) on srt.Id equals srtid select srt).ToList();
 971:                  }
 972:                  else if (serviceRequestTypeIdList.Count <= 224)
 973:                  {
 974:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 975:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 976:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 977:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 978:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 979:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 980:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, serviceRequestTypeIdList.Count - 192 - 1) on srt.Id equals srtid select srt).ToList();
 981:                  }
 982:                  else if (serviceRequestTypeIdList.Count <= 256)
 983:                  {
 984:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 985:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 986:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 987:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 988:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 989:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 990:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 991:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, serviceRequestTypeIdList.Count - 224 - 1) on srt.Id equals srtid select srt).ToList();
 992:                  }
 993:                  else if (serviceRequestTypeIdList.Count <= 288)
 994:                  {
 995:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 996:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 997:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 998:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 999:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1000:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1001:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1002:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1003:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, serviceRequestTypeIdList.Count - 256 - 1) on srt.Id equals srtid select srt).ToList();
1004:                  }
1005:                  else if (serviceRequestTypeIdList.Count <= 320)
1006:                  {
1007:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1008:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1009:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1010:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1011:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1012:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1013:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1014:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1015:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1016:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, serviceRequestTypeIdList.Count - 288 - 1) on srt.Id equals srtid select srt).ToList();
1017:                  }
1018:                  else if (serviceRequestTypeIdList.Count <= 352)
1019:                  {
1020:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1021:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1022:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1023:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1024:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1025:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1026:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1027:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1028:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1029:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1030:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, serviceRequestTypeIdList.Count - 320 - 1) on srt.Id equals srtid select srt).ToList();
1031:                  }
1032:                  else if (serviceRequestTypeIdList.Count <= 384)
1033:                  {
1034:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1035:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1036:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1037:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1038:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1039:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1040:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1041:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1042:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1043:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1044:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1045:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, serviceRequestTypeIdList.Count - 352 - 1) on srt.Id equals srtid select srt).ToList();
1046:                  }
1047:                  else if (serviceRequestTypeIdList.Count <= 416)
1048:                  {
1049:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1050:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1051:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1052:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1053:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1054:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1055:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1056:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1057:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1058:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1059:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1060:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1061:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, serviceRequestTypeIdList.Count - 384 - 1) on srt.Id equals srtid select srt).ToList();
1062:                  }
1063:                  else if (serviceRequestTypeIdList.Count <= 448)
1064:                  {
1065:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1066:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1067:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1068:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1069:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1070:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1071:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1072:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1073:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1074:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1075:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1076:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1077:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1078:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, serviceRequestTypeIdList.Count - 416 - 1) on srt.Id equals srtid select srt).ToList();
1079:                  }
1080:                  else if (serviceRequestTypeIdList.Count <= 480)
1081:                  {
1082:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1083:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1084:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1085:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1086:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1087:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1088:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1089:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1090:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1091:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1092:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1093:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1094:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1095:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1096:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, serviceRequestTypeIdList.Count - 448 - 1) on srt.Id equals srtid select srt).ToList();
1097:                  }
1098:                  else if (serviceRequestTypeIdList.Count <= 512)
1099:                  {
1100:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1101:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1102:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1103:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1104:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1105:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1106:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1107:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1108:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1109:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1110:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1111:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1112:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1113:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1114:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1115:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, serviceRequestTypeIdList.Count - 480 - 1) on srt.Id equals srtid select srt).ToList();
1116:                  }
1117:                  else if (serviceRequestTypeIdList.Count <= 544)
1118:                  {
1119:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1120:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1121:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1122:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1123:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1124:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1125:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1126:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1127:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1128:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1129:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1130:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1131:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1132:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1133:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1134:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1135:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, serviceRequestTypeIdList.Count - 512 - 1) on srt.Id equals srtid select srt).ToList();
1136:                  }
1137:                  else if (serviceRequestTypeIdList.Count <= 576)
1138:                  {
1139:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1140:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1141:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1142:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1143:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1144:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1145:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1146:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1147:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1148:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1149:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1150:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1151:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1152:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1153:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1154:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1155:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1156:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, serviceRequestTypeIdList.Count - 544 - 1) on srt.Id equals srtid select srt).ToList();
1157:                  }
1158:                  else if (serviceRequestTypeIdList.Count <= 608)
1159:                  {
1160:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1161:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1162:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1163:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1164:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1165:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1166:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1167:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1168:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1169:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1170:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1171:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1172:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1173:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1174:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1175:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1176:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1177:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1178:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, serviceRequestTypeIdList.Count - 576 - 1) on srt.Id equals srtid select srt).ToList();
1179:                  }
1180:                  else if (serviceRequestTypeIdList.Count <= 640)
1181:                  {
1182:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1183:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1184:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1185:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1186:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1187:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1188:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1189:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1190:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1191:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1192:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1193:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1194:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1195:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1196:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1197:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1198:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1199:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1200:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1201:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, serviceRequestTypeIdList.Count - 608 - 1) on srt.Id equals srtid select srt).ToList();
1202:                  }
1203:                  else if (serviceRequestTypeIdList.Count <= 672)
1204:                  {
1205:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1206:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1207:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1208:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1209:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1210:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1211:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1212:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1213:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1214:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1215:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1216:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1217:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1218:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1219:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1220:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1221:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1222:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1223:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1224:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1225:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, serviceRequestTypeIdList.Count - 640 - 1) on srt.Id equals srtid select srt).ToList();
1226:                  }
1227:                  else if (serviceRequestTypeIdList.Count <= 704)
1228:                  {
1229:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1230:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1231:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1232:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1233:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1234:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1235:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1236:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1237:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1238:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1239:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1240:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1241:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1242:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1243:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1244:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1245:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1246:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1247:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1248:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1249:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1250:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, serviceRequestTypeIdList.Count - 672 - 1) on srt.Id equals srtid select srt).ToList();
1251:                  }
1252:                  else if (serviceRequestTypeIdList.Count <= 736)
1253:                  {
1254:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1255:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1256:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1257:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1258:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1259:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1260:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1261:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1262:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1263:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1264:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1265:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1266:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1267:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1268:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1269:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1270:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1271:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1272:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1273:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1274:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1275:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1276:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, serviceRequestTypeIdList.Count - 704 - 1) on srt.Id equals srtid select srt).ToList();
1277:                  }
1278:                  else if (serviceRequestTypeIdList.Count <= 768)
1279:                  {
1280:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1281:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1282:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1283:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1284:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1285:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1286:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1287:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1288:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1289:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1290:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1291:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1292:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1293:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1294:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1295:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1296:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1297:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1298:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1299:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1300:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1301:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1302:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1303:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, serviceRequestTypeIdList.Count - 736 - 1) on srt.Id equals srtid select srt).ToList();
1304:                  }
1305:                  else if (serviceRequestTypeIdList.Count <= 800)
1306:                  {
1307:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1308:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1309:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1310:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1311:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1312:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1313:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1314:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1315:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1316:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1317:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1318:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1319:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1320:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1321:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1322:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1323:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1324:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1325:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1326:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1327:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1328:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1329:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1330:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
1331:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(768, serviceRequestTypeIdList.Count - 768 - 1) on srt.Id equals srtid select srt).ToList();
1332:                  }
1333:                  else //if (serviceRequestTypeIdList.Count <= 832)
1334:                  {
1335:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1336:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1337:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1338:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1339:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1340:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1341:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1342:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1343:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1344:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1345:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1346:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1347:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1348:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1349:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1350:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1351:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1352:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1353:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1354:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1355:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1356:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1357:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1358:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
1359:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(768, 32) on srt.Id equals srtid select srt).ToList();
1360:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(800, serviceRequestTypeIdList.Count - 800 - 1) on srt.Id equals srtid select srt).ToList();
1361:                  }
1362:              }
1363:   
1364:              return list.Distinct().ToList();
1365:          }
1366:   
1367:          ////////////////////////////////////////////////////////////////////////////
1368:   
1369:          /// <summary>
1370:          /// 
1371:          /// </summary>
1372:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> AgcfGatewayRecordList(List<int> agcfGatewayRecordIdList)
1373:          {
1374:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> list;
1375:   
1376:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1377:              {
1378:                  if (agcfGatewayRecordIdList.Count <= 32)
1379:                  {
1380:                      list = (from gr in db.AgcfGatewayRecords
1381:                              where agcfGatewayRecordIdList.Contains(gr.Id)
1382:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1383:                              {
1384:                                  Id = gr.Id,
1385:                                  GwId = gr.GwId,
1386:                                  GwUserId = gr.GwUserId,
1387:                                  GwDomain = gr.GwDomain,
1388:                                  GwName = gr.GwName,
1389:                                  IP1 = gr.IP1,
1390:                                  IP2 = gr.IP2,
1391:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
1392:                                  IsPrimary = gr.IsPrimary,
1393:                                  Created = gr.Created,
1394:                                  Updated = gr.Updated
1395:                              }).ToList();
1396:                  }
1397:                  else
1398:                  {
1399:                      list = (from gr in db.AgcfGatewayRecords
1400:                              join grid in agcfGatewayRecordIdList.GetRange(0, 32) on gr.Id equals grid
1401:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1402:                              {
1403:                                  Id = gr.Id,
1404:                                  GwId = gr.GwId,
1405:                                  GwUserId = gr.GwUserId,
1406:                                  GwDomain = gr.GwDomain,
1407:                                  GwName = gr.GwName,
1408:                                  IP1 = gr.IP1,
1409:                                  IP2 = gr.IP2,
1410:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
1411:                                  IsPrimary = gr.IsPrimary,
1412:                                  Created = gr.Created,
1413:                                  Updated = gr.Updated
1414:                              }).ToList();
1415:   
1416:                      list = list.Union(from gr in db.AgcfGatewayRecords
1417:                                        join grid in agcfGatewayRecordIdList.GetRange(32, agcfGatewayRecordIdList.Count - 32 - 1) on gr.Id equals grid
1418:                                        select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1419:                                        {
1420:                                            Id = gr.Id,
1421:                                            GwId = gr.GwId,
1422:                                            GwUserId = gr.GwUserId,
1423:                                            GwDomain = gr.GwDomain,
1424:                                            GwName = gr.GwName,
1425:                                            IP1 = gr.IP1,
1426:                                            IP2 = gr.IP2,
1427:                                            MateExternalIPAddr = gr.MateExternalIPAddr,
1428:                                            IsPrimary = gr.IsPrimary,
1429:                                            Created = gr.Created,
1430:                                            Updated = gr.Updated
1431:                                        }).ToList();
1432:                  }
1433:              }
1434:   
1435:              return list.Distinct().ToList();
1436:          }
1437:   
1438:          ////////////////////////////////////////////////////////////////////////////
1439:   
1440:          /// <summary>
1441:          /// 
1442:          /// </summary>
1443:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> AgcfEndpointList(List<string> agcfEndpointIdList)
1444:          {
1445:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> list;
1446:   
1447:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1448:              {
1449:                  list = (from e in db.AgcfEndpoints
1450:                          where agcfEndpointIdList.Contains(e.Id)
1451:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint()
1452:                          {
1453:                              Id = e.Id,
1454:                              PrividUser = e.PrividUser,
1455:                              GwId = e.GwId,
1456:                              Dn = e.Dn,
1457:                              FlatTermID = e.FlatTermID,
1458:                              CallHoldLc = e.CallHoldLc,
1459:                              CallWaitingLc = e.CallWaitingLc,
1460:                              CallToggleLc = e.CallToggleLc,
1461:                              ThreeWayCallLc = e.ThreeWayCallLc,
1462:                              McidLc = e.McidLc,
1463:                              Password = e.Password,
1464:                              CallTransferLc = e.CallTransferLc,
1465:                              Created = e.Created,
1466:                              Updated = e.Updated
1467:                          }).ToList();
1468:              }
1469:   
1470:              return list.Distinct().ToList();
1471:          }
1472:   
1473:          ////////////////////////////////////////////////////////////////////////////
1474:   
1475:          /// <summary>
1476:          /// 
1477:          /// </summary>
1478:          public static List<Ia.Ngn.Cl.Model.Huawei.Mgw> MgwList(List<string> mgwIdList)
1479:          {
1480:              List<Ia.Ngn.Cl.Model.Huawei.Mgw> list;
1481:   
1482:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1483:              {
1484:                  if (mgwIdList.Count <= 32)
1485:                  {
1486:                      list = (from m in db.Mgws
1487:                              where mgwIdList.Contains(m.Id)
1488:                              select m).ToList();
1489:                  }
1490:                  else
1491:                  {
1492:                      list = (from m in db.Mgws
1493:                              join mid in mgwIdList.GetRange(0, 32) on m.Id equals mid
1494:                              select m).ToList();
1495:   
1496:                      list = list.Union(from m in db.Mgws
1497:                                        join mid in mgwIdList.GetRange(32, mgwIdList.Count - 32 - 1) on m.Id equals mid
1498:                                        select m).ToList();
1499:                  }
1500:              }
1501:   
1502:              return list.Distinct().ToList();
1503:          }
1504:   
1505:          ////////////////////////////////////////////////////////////////////////////
1506:   
1507:          /// <summary>
1508:          /// 
1509:          /// </summary>
1510:          public static List<Ia.Ngn.Cl.Model.Huawei.Asbr> AsbrList(List<string> asbrIdList)
1511:          {
1512:              List<Ia.Ngn.Cl.Model.Huawei.Asbr> list;
1513:   
1514:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1515:              {
1516:                  list = (from a in db.Asbrs
1517:                          where asbrIdList.Contains(a.Id)
1518:                          select a).ToList();
1519:              }
1520:   
1521:              return list.Distinct().ToList();
1522:          }
1523:   
1524:          ////////////////////////////////////////////////////////////////////////////
1525:   
1526:          /// <summary>
1527:          /// 
1528:          /// </summary>
1529:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevList(List<int> emsDevIdList)
1530:          {
1531:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
1532:   
1533:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1534:              {
1535:                  list = (from ed in db.EmsDevs
1536:                          where emsDevIdList.Contains(ed.Id)
1537:                          select ed).ToList();
1538:              }
1539:   
1540:              return list.Distinct().ToList();
1541:          }
1542:   
1543:          ////////////////////////////////////////////////////////////////////////////
1544:   
1545:          /// <summary>
1546:          /// 
1547:          /// </summary>
1548:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevListFromEmsOntIdList(List<string> emsOntIdList)
1549:          {
1550:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
1551:   
1552:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1553:              {
1554:                  list = (from ed in db.EmsDevs
1555:                          join eb in db.EmsBoards on ed.Id equals eb.EmsDev.Id
1556:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
1557:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1558:                          where emsOntIdList.Contains(eo.Id)
1559:                          select ed).ToList();
1560:              }
1561:   
1562:              return list.Distinct().ToList();
1563:          }
1564:   
1565:          ////////////////////////////////////////////////////////////////////////////
1566:   
1567:          /// <summary>
1568:          /// 
1569:          /// </summary>
1570:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> EmsBoardList(List<string> emsBoardIdList)
1571:          {
1572:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
1573:   
1574:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1575:              {
1576:                  list = (from eb in db.EmsBoards
1577:                          where emsBoardIdList.Contains(eb.Id)
1578:                          select eb).ToList();
1579:              }
1580:   
1581:              return list.Distinct().ToList();
1582:          }
1583:   
1584:          ////////////////////////////////////////////////////////////////////////////
1585:   
1586:          /// <summary>
1587:          /// 
1588:          /// </summary>
1589:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> EmsBoardListFromEmsOntIdList(List<string> emsOntIdList)
1590:          {
1591:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
1592:   
1593:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1594:              {
1595:                  list = (from eb in db.EmsBoards
1596:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
1597:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1598:                          where emsOntIdList.Contains(eo.Id)
1599:                          select eb).ToList();
1600:              }
1601:   
1602:              return list.Distinct().ToList();
1603:          }
1604:   
1605:          ////////////////////////////////////////////////////////////////////////////
1606:   
1607:          /// <summary>
1608:          /// 
1609:          /// </summary>
1610:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsPort> EmsPortList(List<string> emsPortIdList)
1611:          {
1612:              List<Ia.Ngn.Cl.Model.Huawei.EmsPort> list;
1613:   
1614:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1615:              {
1616:                  list = (from ep in db.EmsPorts
1617:                          where emsPortIdList.Contains(ep.Id)
1618:                          select ep).ToList();
1619:              }
1620:   
1621:              return list.Distinct().ToList();
1622:          }
1623:   
1624:          ////////////////////////////////////////////////////////////////////////////
1625:   
1626:          /// <summary>
1627:          /// 
1628:          /// </summary>
1629:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsPort> EmsPortListFromEmsOntIdList(List<string> emsOntIdList)
1630:          {
1631:              List<Ia.Ngn.Cl.Model.Huawei.EmsPort> list;
1632:   
1633:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1634:              {
1635:                  list = (from ep in db.EmsPorts
1636:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1637:                          where emsOntIdList.Contains(eo.Id)
1638:                          select ep).ToList();
1639:              }
1640:   
1641:              return list.Distinct().ToList();
1642:          }
1643:   
1644:          ////////////////////////////////////////////////////////////////////////////
1645:   
1646:          /// <summary>
1647:          /// 
1648:          /// </summary>
1649:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> EmsOntList(List<string> emsOntIdList)
1650:          {
1651:              List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> list;
1652:   
1653:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1654:              {
1655:                  list = (from eo in db.EmsOnts
1656:                          where emsOntIdList.Contains(eo.Id)
1657:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt()
1658:                          {
1659:                              Id = eo.Id,
1660:                              ResultCode = eo.ResultCode,
1661:                              StateId = eo.StateId,
1662:                              Access = eo.Access,
1663:                              ALIAS = eo.ALIAS,
1664:                              AUTH = eo.AUTH,
1665:                              CAPABPROF = eo.CAPABPROF,
1666:                              Created = eo.Created,
1667:                              DEV = eo.DEV,
1668:                              DID = eo.DID,
1669:                              EQUIPMENTID = eo.EQUIPMENTID,
1670:                              FN = eo.FN,
1671:                              GATE = eo.GATE,
1672:                              IP = eo.IP,
1673:                              MAINSOFTVERSION = eo.MAINSOFTVERSION,
1674:                              NAME = eo.NAME,
1675:                              ONTID = eo.ONTID,
1676:                              PN = eo.PN,
1677:                              ROUTEIP = eo.ROUTEIP,
1678:                              SERIALNUM = eo.SERIALNUM,
1679:                              SN = eo.SN,
1680:                              VAPROF = eo.VAPROF,
1681:                              Updated = eo.Updated,
1682:                              VENDORID = eo.VENDORID,
1683:                              VLAN = eo.VLAN
1684:                          }).ToList();
1685:              }
1686:   
1687:              return list.Distinct().ToList();
1688:          }
1689:   
1690:          ////////////////////////////////////////////////////////////////////////////
1691:   
1692:          /// <summary>
1693:          /// 
1694:          /// </summary>
1695:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdList(List<string> emsOntIdList)
1696:          {
1697:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1698:   
1699:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1700:              {
1701:                  list = (from eosi in db.EmsOntSipInfoes 
1702:                          where emsOntIdList.Contains(eosi.EmsOnt.Id) 
1703:                          select eosi).Include(o => o.EmsOnt).ToList();
1704:              }
1705:   
1706:              return list.Distinct().ToList();
1707:          }
1708:   
1709:          ////////////////////////////////////////////////////////////////////////////
1710:   
1711:          /// <summary>
1712:          /// 
1713:          /// </summary>
1714:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdListAndService(List<string> emsOntIdList, List<string> emsVoipPstnUserDnList)
1715:          {
1716:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1717:   
1718:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1719:              {
1720:                  list = (from evpu in db.EmsVoipPstnUsers
1721:                          where emsOntIdList.Contains(evpu.EmsOnt.Id) && emsVoipPstnUserDnList.Contains(evpu.DN)
1722:                          select evpu).Include(o => o.EmsOnt).ToList();
1723:              }
1724:   
1725:              return list.Distinct().ToList();
1726:          }
1727:   
1728:          ////////////////////////////////////////////////////////////////////////////
1729:   
1730:          /// <summary>
1731:          /// 
1732:          /// </summary>
1733:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdList(List<string> emsOntIdList)
1734:          {
1735:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1736:   
1737:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1738:              {
1739:                  list = (from evpu in db.EmsVoipPstnUsers
1740:                          where emsOntIdList.Contains(evpu.EmsOnt.Id)
1741:                          select evpu).Include(o => o.EmsOnt).ToList();
1742:              }
1743:   
1744:              return list.Distinct().ToList();
1745:          }
1746:   
1747:          ////////////////////////////////////////////////////////////////////////////
1748:   
1749:          /// <summary>
1750:          /// 
1751:          /// </summary>
1752:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVag> VagListFromEmsOntIdList(List<string> emsOntIdList)
1753:          {
1754:              List<Ia.Ngn.Cl.Model.Huawei.EmsVag> list;
1755:   
1756:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1757:              {
1758:                  list = (from v in db.EmsVags where emsOntIdList.Contains(v.EmsOnt.Id) select v).Include(o => o.EmsOnt).ToList();
1759:              }
1760:   
1761:              return list.Distinct().ToList();
1762:          }
1763:   
1764:          ////////////////////////////////////////////////////////////////////////////
1765:   
1766:          /// <summary>
1767:          /// 
1768:          /// </summary>
1769:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdListAndServiceList(List<string> emsOntIdList, List<string> serviceList)
1770:          {
1771:              string serviceWithCountryCode;
1772:              List<string> emsVoipPstnUserDnList;
1773:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1774:   
1775:              emsVoipPstnUserDnList = new List<string>();
1776:   
1777:              foreach (var service in serviceList)
1778:              {
1779:                  serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
1780:                  emsVoipPstnUserDnList.Add(serviceWithCountryCode);
1781:              }
1782:   
1783:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1784:              {
1785:                  list = (from evpu in db.EmsVoipPstnUsers
1786:                          where emsOntIdList.Contains(evpu.EmsOnt.Id) && emsVoipPstnUserDnList.Contains(evpu.DN)
1787:                          select evpu).Include(o => o.EmsOnt).ToList();
1788:              }
1789:   
1790:              return list.Distinct().ToList();
1791:          }
1792:   
1793:          ////////////////////////////////////////////////////////////////////////////
1794:   
1795:          /// <summary>
1796:          /// 
1797:          /// </summary>
1798:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdListAndService(List<string> emsOntIdList, List<string> sipUserNameList)
1799:          {
1800:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1801:   
1802:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1803:              {
1804:                  list = (from eosi in db.EmsOntSipInfoes
1805:                          where emsOntIdList.Contains(eosi.EmsOnt.Id) && sipUserNameList.Contains(eosi.SIPUSERNAME)
1806:                          select eosi).Include(o => o.EmsOnt).ToList();
1807:              }
1808:   
1809:              return list.Distinct().ToList();
1810:          }
1811:   
1812:          ////////////////////////////////////////////////////////////////////////////
1813:   
1814:          /// <summary>
1815:          /// 
1816:          /// </summary>
1817:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOnt> ServiceRequestOntList(List<string> serviceRequestOntIdList)
1818:          {
1819:              List<Ia.Ngn.Cl.Model.ServiceRequestOnt> list;
1820:   
1821:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1822:              {
1823:                  list = (from sro in db.ServiceRequestOnts 
1824:                          where serviceRequestOntIdList.Contains(sro.Id) 
1825:                          select sro).ToList();
1826:              }
1827:   
1828:              return list.Distinct().ToList();
1829:          }
1830:   
1831:          ////////////////////////////////////////////////////////////////////////////
1832:   
1833:          /// <summary>
1834:          /// 
1835:          /// </summary>
1836:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> ServiceRequestOntDetailList(List<string> serviceRequestOntIdList)
1837:          {
1838:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1839:   
1840:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1841:              {
1842:                  list = (from srod in db.ServiceRequestOntDetails
1843:                          where serviceRequestOntIdList.Contains(srod.ServiceRequestOnt.Id)
1844:                          select srod).ToList();
1845:              }
1846:   
1847:              return list.Distinct().ToList();
1848:          }
1849:   
1850:          ////////////////////////////////////////////////////////////////////////////
1851:   
1852:          /// <summary>
1853:          /// 
1854:          /// </summary>
1855:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> ServiceRequestOntDetailFromServieListList(List<string> serviceList)
1856:          {
1857:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1858:   
1859:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1860:              {
1861:                  list = (from srod in db.ServiceRequestOntDetails 
1862:                          where serviceList.Contains(srod.Service) 
1863:                          select srod).ToList();
1864:              }
1865:   
1866:              return list.Distinct().ToList();
1867:          }
1868:   
1869:          ////////////////////////////////////////////////////////////////////////////
1870:   
1871:          /// <summary>
1872:          /// 
1873:          /// </summary>
1874:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntList(List<string> nddOntIdList)
1875:          {
1876:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
1877:   
1878:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList 
1879:                      where nddOntIdList.Contains(srsid.Id) 
1880:                      select srsid).ToList();
1881:   
1882:              return list.Distinct().ToList();
1883:          }
1884:   
1885:          ////////////////////////////////////////////////////////////////////////////
1886:   
1887:          /// <summary>
1888:          /// 
1889:          /// </summary>
1890:          public static List<Ia.Ngn.Cl.Model.Access> AccessList(List<string> accessIdList)
1891:          {
1892:              List<Ia.Ngn.Cl.Model.Access> list;
1893:   
1894:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1895:              {
1896:                  list = (from a in db.Accesses 
1897:                          where accessIdList.Contains(a.Id) 
1898:                          select a).ToList();
1899:              }
1900:   
1901:              return list.Distinct().ToList();
1902:          }
1903:   
1904:          ////////////////////////////////////////////////////////////////////////////
1905:   
1906:          /// <summary>
1907:          /// 
1908:          /// </summary>
1909:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAddress(int kuwaitNgnAreaId, string block, int street, int premisesOld, int premisesNew)
1910:          {
1911:              string streetString, premisesOldString, premisesNewString;
1912:              List<Ia.Ngn.Cl.Model.Access> list;
1913:   
1914:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1915:              {
1916:                  //oltIdList = kuwaitNgnArea.Site.Routers.SelectMany(v => v.Odfs.SelectMany(u => u.Olts.Select(w => w.Id))).ToList();
1917:   
1918:                  streetString = street.ToString();
1919:                  premisesOldString = premisesOld.ToString();
1920:                  premisesNewString = premisesNew.ToString();
1921:   
1922:                  list = (from a in db.Accesses
1923:                              //where oltIdList.Contains(a.Olt)
1924:                          where
1925:                          a.AreaId == kuwaitNgnAreaId
1926:                          &&
1927:                          (
1928:                          a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString
1929:                          || a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && premisesNew == 0
1930:                          || a.Block == block && a.Street == streetString && a.PremisesNew == premisesNewString && premisesOld == 0
1931:                          || a.Block == block && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString && street == 0
1932:                          || a.Block == block && a.PremisesOld == premisesOldString && street == 0 && premisesNew == 0
1933:                          || a.Block == block && a.PremisesNew == premisesNewString && street == 0 && premisesOld == 0
1934:                          || a.Block == block && a.Street == streetString && premisesOld == 0 && premisesNew == 0
1935:                          || a.Block == block && street == 0 && premisesOld == 0 && premisesNew == 0
1936:                          )
1937:                          select a).ToList();
1938:              }
1939:   
1940:              return list.Distinct().ToList();
1941:          }
1942:   
1943:          ////////////////////////////////////////////////////////////////////////////
1944:   
1945:          /// <summary>
1946:          /// 
1947:          /// </summary>
1948:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAreaAndBlock(int kuwaitNgnAreaId, string block)
1949:          {
1950:              List<Ia.Ngn.Cl.Model.Access> list;
1951:   
1952:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1953:              {
1954:                  list = (from a in db.Accesses where a.AreaId == kuwaitNgnAreaId && a.Block == block select a).ToList();
1955:              }
1956:   
1957:              return list.Distinct().ToList();
1958:          }
1959:   
1960:          ////////////////////////////////////////////////////////////////////////////
1961:   
1962:          /// <summary>
1963:          /// 
1964:          /// </summary>
1965:          public static List<Ia.Ngn.Cl.Model.Ont> OntList(List<string> ontIdList)
1966:          {
1967:              List<Ia.Ngn.Cl.Model.Ont> list;
1968:   
1969:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1970:              {
1971:                  list = (from o in db.Onts where ontIdList.Contains(o.Id) select o).ToList();
1972:              }
1973:   
1974:              return list.Distinct().ToList();
1975:          }
1976:   
1977:          ////////////////////////////////////////////////////////////////////////////
1978:   
1979:          /// <summary>
1980:          /// 
1981:          /// </summary>
1982:          public static List<Ia.Ngn.Cl.Model.OntOntPots> OntOntPotsListFromOntOntPotsIdList(List<string> ontOntPotsIdList)
1983:          {
1984:              List<Ia.Ngn.Cl.Model.OntOntPots> list;
1985:   
1986:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1987:              {
1988:                  list = (from oop in db.OntOntPots 
1989:                          where ontOntPotsIdList.Contains(oop.Id) 
1990:                          select oop).ToList();
1991:              }
1992:   
1993:              return list.Distinct().ToList();
1994:          }
1995:   
1996:          ////////////////////////////////////////////////////////////////////////////
1997:   
1998:          /// <summary>
1999:          /// 
2000:          /// </summary>
2001:          public static List<Ia.Ngn.Cl.Model.Event> EventList(List<long> eventIdList)
2002:          {
2003:              List<Ia.Ngn.Cl.Model.Event> list;
2004:   
2005:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2006:              {
2007:                  list = (from e in db.Events 
2008:                          where eventIdList.Contains(e.Id) 
2009:                          select e).ToList();
2010:              }
2011:   
2012:              return list.Distinct().ToList();
2013:          }
2014:   
2015:          ////////////////////////////////////////////////////////////////////////////
2016:   
2017:          /// <summary>
2018:          /// 
2019:          /// </summary>
2020:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> SubPartyList(List<string> subPartyIdList)
2021:          {
2022:              List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> list;
2023:   
2024:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2025:              {
2026:                  list = (from sp in db.SubParties
2027:                          where subPartyIdList.Contains(sp.Id)
2028:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
2029:                          {
2030:                              Id = sp.Id,
2031:                              PartyId = sp.PartyId,
2032:                              PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
2033:                              DisplayName = sp.DisplayName,
2034:                              Category = sp.Category,
2035:                              AssocOtasRealm = sp.AssocOtasRealm,
2036:                              ServiceSuspension = sp.ServiceSuspension,
2037:                              Created = sp.Created,
2038:                              Updated = sp.Updated
2039:                          }).ToList();
2040:              }
2041:   
2042:              return list.Distinct().ToList();
2043:          }
2044:   
2045:          ////////////////////////////////////////////////////////////////////////////
2046:   
2047:          /// <summary>
2048:          /// 
2049:          /// </summary>
2050:          public static List<Ia.Ngn.Cl.Model.Report> ReportList(List<int> reportIdList)
2051:          {
2052:              List<Ia.Ngn.Cl.Model.Report> list;
2053:   
2054:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2055:              {
2056:                  if (reportIdList.Count == 1)
2057:                  {
2058:                      var reportId = reportIdList[0];
2059:                      list = (from r in db.Reports where r.Id == reportId select r).Include(u => u.ReportHistories).ToList();
2060:                  }
2061:                  else if (reportIdList.Count <= 32)
2062:                  {
2063:                      list = (from r in db.Reports where reportIdList.Contains(r.Id) select r).Include(u => u.ReportHistories).ToList();
2064:                  }
2065:                  else if (reportIdList.Count <= 64)
2066:                  {
2067:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2068:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, reportIdList.Count - 32 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2069:                  }
2070:                  else if (reportIdList.Count <= 96)
2071:                  {
2072:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2073:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2074:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, reportIdList.Count - 64 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2075:                  }
2076:                  else if (reportIdList.Count <= 128)
2077:                  {
2078:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2079:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2080:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2081:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, reportIdList.Count - 96 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2082:                  }
2083:                  else if (reportIdList.Count <= 160)
2084:                  {
2085:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2086:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2087:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2088:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2089:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, reportIdList.Count - 128 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2090:                  }
2091:                  else if (reportIdList.Count <= 192)
2092:                  {
2093:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2094:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2095:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2096:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2097:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2098:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(160, reportIdList.Count - 160 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2099:                  }
2100:                  else if (reportIdList.Count <= 224)
2101:                  {
2102:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2103:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2104:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2105:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2106:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2107:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2108:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(192, reportIdList.Count - 192 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2109:                  }
2110:                  else //if (reportIdList.Count <= 256)
2111:                  {
2112:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2113:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2114:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2115:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2116:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2117:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2118:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(192, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2119:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(224, reportIdList.Count - 224 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2120:                  }
2121:              }
2122:   
2123:              return list.Distinct().ToList();
2124:          }
2125:   
2126:          ////////////////////////////////////////////////////////////////////////////
2127:   
2128:          /// <summary>
2129:          /// 
2130:          /// </summary>
2131:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> HuSbrList(List<string> huSbrImpuList)
2132:          {
2133:              List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> list;
2134:   
2135:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2136:              {
2137:                  list = (from h in db.HuSbrs
2138:                          where huSbrImpuList.Contains(h.IMPU)
2139:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
2140:                          {
2141:                              COP = h.COP,
2142:                              CSC = h.CSC,
2143:                              Id = h.Id,
2144:                              IMPU = h.IMPU,
2145:                              ITT = h.ITT,
2146:                              LP = h.LP,
2147:                              NS3PTY = h.NS3PTY,
2148:                              NSABRC = h.NSABRC,
2149:                              NSCBA = h.NSCBA,
2150:                              NSCFU = h.NSCFU,
2151:                              NSCLIP = h.NSCLIP,
2152:                              NSCW = h.NSCW,
2153:                              NSFAX = h.NSFAX,
2154:                              NSHOLD = h.NSHOLD,
2155:                              NSNPTY = h.NSNPTY,
2156:                              NSWAKE_UP = h.NSWAKE_UP,
2157:                              Created = h.Created,
2158:                              Updated = h.Updated
2159:                          }).ToList();
2160:              }
2161:   
2162:              return list.Distinct().ToList();
2163:          }
2164:   
2165:          ////////////////////////////////////////////////////////////////////////////
2166:   
2167:          /// <summary>
2168:          /// 
2169:          /// </summary>
2170:          public static List<Ia.Ngn.Cl.Model.Huawei.Owsbr> OwsbrList(List<string> owsbrImpuList)
2171:          {
2172:              List<Ia.Ngn.Cl.Model.Huawei.Owsbr> list;
2173:   
2174:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2175:              {
2176:                  list = (from o in db.Owsbrs where owsbrImpuList.Contains(o.IMPU) select o).ToList();
2177:              }
2178:   
2179:              return list.Distinct().ToList();
2180:          }
2181:   
2182:          ////////////////////////////////////////////////////////////////////////////
2183:   
2184:          /// <summary>
2185:          /// 
2186:          /// </summary>
2187:          public static List<Ia.Ngn.Cl.Model.Huawei.Seruattr> SeruattrListFromServiceIdList(List<string> serviceIdList)
2188:          {
2189:              List<Ia.Ngn.Cl.Model.Huawei.Seruattr> list;
2190:   
2191:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2192:              {
2193:                  list = (from s in db.Seruattrs where serviceIdList.Contains(s.Id) select s).ToList();
2194:              }
2195:   
2196:              return list.Distinct().ToList();
2197:          }
2198:   
2199:          ////////////////////////////////////////////////////////////////////////////
2200:   
2201:          /// <summary>
2202:          /// 
2203:          /// </summary>
2204:          public static List<Ia.Ngn.Cl.Model.Huawei.Seruattr> SeruattrList(List<string> serviceList)
2205:          {
2206:              List<Ia.Ngn.Cl.Model.Huawei.Seruattr> list;
2207:   
2208:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2209:              {
2210:                  list = (from s in db.Seruattrs where serviceList.Contains(s.USRNUM) select s).ToList();
2211:              }
2212:   
2213:              return list.Distinct().ToList();
2214:          }
2215:   
2216:          ////////////////////////////////////////////////////////////////////////////
2217:   
2218:          /// <summary>
2219:          /// 
2220:          /// </summary>
2221:          public static List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> AxeSubscriberListFromServiceIdList(List<string> serviceIdList)
2222:          {
2223:              List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> list;
2224:   
2225:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2226:              {
2227:                  list = (from s in db.AxeSubscribers where serviceIdList.Contains(s.Id) select s).ToList();
2228:              }
2229:   
2230:              return list.Distinct().ToList();
2231:          }
2232:   
2233:          ////////////////////////////////////////////////////////////////////////////
2234:   
2235:          /// <summary>
2236:          /// 
2237:          /// </summary>
2238:          public static List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> AxeSubscriberList(List<int> numberList)
2239:          {
2240:              List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> list;
2241:   
2242:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2243:              {
2244:                  list = (from s in db.AxeSubscribers
2245:                          where numberList.Contains(s.SNB)
2246:                          select s).ToList();
2247:              }
2248:   
2249:              return list.Distinct().ToList();
2250:          }
2251:   
2252:          ////////////////////////////////////////////////////////////////////////////
2253:   
2254:          /// <summary>
2255:          /// 
2256:          /// </summary>
2257:          public static List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> EwsdSubscriberListFromServiceIdList(List<string> serviceIdList)
2258:          {
2259:              List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> list;
2260:   
2261:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2262:              {
2263:                  list = (from s in db.EwsdSubscribers
2264:                          where serviceIdList.Contains(s.Id)
2265:                          select s).ToList();
2266:              }
2267:   
2268:              return list.Distinct().ToList();
2269:          }
2270:   
2271:          ////////////////////////////////////////////////////////////////////////////
2272:   
2273:          /// <summary>
2274:          /// 
2275:          /// </summary>
2276:          public static List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> EwsdSubscriberList(List<int> numberList)
2277:          {
2278:              List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> list;
2279:   
2280:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2281:              {
2282:                  list = (from s in db.EwsdSubscribers
2283:                          where numberList.Contains(s.DN)
2284:                          select s).ToList();
2285:              }
2286:   
2287:              return list.Distinct().ToList();
2288:          }
2289:   
2290:          ////////////////////////////////////////////////////////////////////////////
2291:   
2292:          /// <summary>
2293:          /// 
2294:          /// </summary>
2295:          public static List<Ia.Ngn.Cl.Model.OntServiceVoip> OntServiceVoipList(List<string> ontServiceVoipIdList)
2296:          {
2297:              List<Ia.Ngn.Cl.Model.OntServiceVoip> list;
2298:   
2299:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2300:              {
2301:                  if (ontServiceVoipIdList.Count == 1)
2302:                  {
2303:                      var ontServiceVoipId = ontServiceVoipIdList[0];
2304:                      list = (from ov in db.OntServiceVoips where ov.Id == ontServiceVoipId select ov).ToList();
2305:                  }
2306:                  else if (ontServiceVoipIdList.Count <= 32)
2307:                  {
2308:                      list = (from ov in db.OntServiceVoips where ontServiceVoipIdList.Contains(ov.Id) select ov).ToList();
2309:                  }
2310:                  else
2311:                  {
2312:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList.GetRange(0, 32) on ov.Id equals ovid select ov).ToList();
2313:                      list = list.Union(from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList.GetRange(32, ontServiceVoipIdList.Count - 32 - 1) on ov.Id equals ovid select ov).ToList();
2314:                  }
2315:              }
2316:   
2317:              return list.Distinct().ToList();
2318:          }
2319:   
2320:          ////////////////////////////////////////////////////////////////////////////
2321:   
2322:          /// <summary>
2323:          /// 
2324:          /// </summary>
2325:          public static List<Ia.Ngn.Cl.Model.Ui.Service2> ServiceList(List<string> serviceIdList)
2326:          {
2327:              List<Ia.Ngn.Cl.Model.Service2> list;
2328:              List<Ia.Ngn.Cl.Model.Ui.Service2> uiList;
2329:   
2330:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2331:              {
2332:                  if (serviceIdList.Count == 1)
2333:                  {
2334:                      var serviceId = serviceIdList[0];
2335:                      list = (from s in db.Service2 where s.Id == serviceId select s).Include(u => u.Access).ToList();
2336:                  }
2337:                  else if (serviceIdList.Count <= 32)
2338:                  {
2339:                      list = (from s in db.Service2 where serviceIdList.Contains(s.Id) select s).Include(u => u.Access).ToList();
2340:                  }
2341:                  else if (serviceIdList.Count <= 64)
2342:                  {
2343:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2344:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2345:                  }
2346:                  else if (serviceIdList.Count <= 96)
2347:                  {
2348:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2349:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2350:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2351:                  }
2352:                  else if (serviceIdList.Count <= 128)
2353:                  {
2354:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2355:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2356:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2357:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2358:                  }
2359:                  else if (serviceIdList.Count <= 160)
2360:                  {
2361:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2362:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2363:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2364:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2365:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2366:                  }
2367:                  else if (serviceIdList.Count <= 192)
2368:                  {
2369:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2370:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2371:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2372:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2373:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2374:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2375:                  }
2376:                  else if (serviceIdList.Count <= 224)
2377:                  {
2378:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2379:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2380:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2381:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2382:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2383:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2384:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2385:                  }
2386:                  else if (serviceIdList.Count <= 256)
2387:                  {
2388:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2389:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2390:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2391:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2392:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2393:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2394:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2395:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2396:                  }
2397:                  else if (serviceIdList.Count <= 288)
2398:                  {
2399:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2400:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2401:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2402:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2403:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2404:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2405:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2406:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2407:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, serviceIdList.Count - 256 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2408:                  }
2409:                  else if (serviceIdList.Count <= 320)
2410:                  {
2411:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2412:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2413:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2414:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2415:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2416:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2417:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2418:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2419:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2420:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, serviceIdList.Count - 288 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2421:                  }
2422:                  else if (serviceIdList.Count <= 352)
2423:                  {
2424:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2425:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2426:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2427:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2428:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2429:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2430:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2431:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2432:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2433:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2434:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, serviceIdList.Count - 320 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2435:                  }
2436:                  else if (serviceIdList.Count <= 384)
2437:                  {
2438:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2439:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2440:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2441:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2442:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2443:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2444:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2445:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2446:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2447:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2448:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2449:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, serviceIdList.Count - 352 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2450:                  }
2451:                  else if (serviceIdList.Count <= 416)
2452:                  {
2453:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2454:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2455:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2456:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2457:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2458:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2459:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2460:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2461:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2462:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2463:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2464:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2465:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(384, serviceIdList.Count - 384 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2466:                  }
2467:                  else if (serviceIdList.Count <= 448)
2468:                  {
2469:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2470:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2471:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2472:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2473:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2474:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2475:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2476:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2477:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2478:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2479:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2480:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2481:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2482:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(416, serviceIdList.Count - 416 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2483:                  }
2484:                  else if (serviceIdList.Count <= 480)
2485:                  {
2486:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2487:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2488:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2489:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2490:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2491:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2492:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2493:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2494:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2495:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2496:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2497:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2498:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2499:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2500:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(448, serviceIdList.Count - 448 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2501:                  }
2502:                  else if (serviceIdList.Count <= 512)
2503:                  {
2504:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2505:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2506:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2507:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2508:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2509:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2510:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2511:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2512:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2513:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2514:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2515:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2516:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2517:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2518:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2519:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(480, serviceIdList.Count - 480 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2520:                  }
2521:                  else if (serviceIdList.Count <= 544)
2522:                  {
2523:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2524:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2525:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2526:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2527:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2528:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2529:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2530:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2531:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2532:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2533:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2534:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2535:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2536:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2537:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2538:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2539:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(512, serviceIdList.Count - 512 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2540:                  }
2541:                  else //if (serviceIdList.Count <= ??)
2542:                  {
2543:                      list = (from s in db.Service2 join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).Include(u => u.Access).ToList();
2544:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2545:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2546:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2547:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2548:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2549:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2550:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2551:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2552:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2553:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2554:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2555:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2556:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2557:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2558:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2559:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(512, 32) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2560:                      list = list.Union((from s in db.Service2 join sid in serviceIdList.GetRange(544, serviceIdList.Count - 544 - 1) on s.Id equals sid select s).Include(u => u.Access)).ToList();
2561:                  }
2562:   
2563:                  uiList = (from s in list
2564:                            select new Ia.Ngn.Cl.Model.Ui.Service2()
2565:                            {
2566:                                Id = s.Id,
2567:                                AbbriviatedCalling = s.AbbriviatedCalling,
2568:                                AlarmCall = s.AlarmCall,
2569:                                CallBarring = s.CallBarring,
2570:                                CallerId = s.CallerId,
2571:                                CallForwarding = s.CallForwarding,
2572:                                CallWaiting = s.CallWaiting,
2573:                                ConferenceCall = s.ConferenceCall,
2574:                                Created = s.Created,
2575:                                InternationalCalling = s.InternationalCalling,
2576:                                InternationalCallingUserControlled = s.InternationalCallingUserControlled,
2577:                                Port = s.Port,
2578:                                Pin = s.Pin,
2579:                                Service = s.Service,
2580:                                ServiceType = s.ServiceType,
2581:                                ServiceSuspension = s.ServiceSuspension,
2582:                                ServiceTypeName = s.ServiceType.ToString(),
2583:                                Updated = s.Updated,
2584:                                AccessId = (s.Access != null) ? s.Access.Id : string.Empty
2585:                            }).ToList();
2586:              }
2587:   
2588:              return uiList.Distinct().ToList();
2589:          }
2590:   
2591:          ////////////////////////////////////////////////////////////////////////////
2592:   
2593:          /// <summary>
2594:          /// 
2595:          /// </summary>
2596:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> SubscriberList(List<string> subscriberIdList)
2597:          {
2598:              List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> list;
2599:   
2600:              // below: db.Subscribers contains XML fields which can not be evaluated in a Union() function.
2601:   
2602:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2603:              {
2604:                  list = (from s in db.Subscribers
2605:                          where subscriberIdList.Contains(s.Id)
2606:                          select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
2607:                          {
2608:                              Id = s.Id,
2609:                              AlternateOtasRealm = s.AlternateOtasRealm,
2610:                              PartyId = s.PartyId,
2611:                              AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
2612:                              AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
2613:                              CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
2614:                              CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
2615:                              CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
2616:                              ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
2617:                              InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
2618:                              InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
2619:                              //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
2620:                              Created = s.Created,
2621:                              Updated = s.Updated,
2622:                          }).ToList();
2623:              }
2624:   
2625:              return list.Distinct().ToList();
2626:          }
2627:   
2628:          ////////////////////////////////////////////////////////////////////////////
2629:   
2630:          /// <summary>
2631:          /// 
2632:          /// </summary>
2633:          public static List<string> AccessIdList(int oltId, int ponNumber, int ontInternalNumber)
2634:          {
2635:              List<string> list;
2636:   
2637:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2638:              {
2639:                  list = (from a in db.Accesses
2640:                          where a.Olt == oltId && a.Pon == ponNumber && a.Ont == ontInternalNumber
2641:                          select a.Id).ToList();
2642:              }
2643:   
2644:              return list.Distinct().ToList();
2645:          }
2646:   
2647:          ////////////////////////////////////////////////////////////////////////////
2648:   
2649:          /// <summary>
2650:          /// 
2651:          /// </summary>
2652:          public static List<string> AccessIdList(int oltId, int ponNumber)
2653:          {
2654:              List<string> list;
2655:   
2656:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2657:              {
2658:                  list = (from a in db.Accesses
2659:                          where a.Olt == oltId && a.Pon == ponNumber
2660:                          select a.Id).ToList();
2661:              }
2662:   
2663:              return list.Distinct().ToList();
2664:          }
2665:   
2666:          ////////////////////////////////////////////////////////////////////////////
2667:   
2668:          /// <summary>
2669:          /// 
2670:          /// </summary>
2671:          public static List<int> EmsDevIdListFromEmsBoardIdList(List<string> emsBoardIdList)
2672:          {
2673:              List<int> list;
2674:   
2675:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2676:              {
2677:                  list = (from ed in db.EmsDevs
2678:                          join eb in db.EmsBoards on ed.Id equals eb.EmsDev.Id
2679:                          where emsBoardIdList.Contains(eb.Id)
2680:                          select ed.Id).ToList();
2681:              }
2682:   
2683:              return list.Distinct().ToList();
2684:          }
2685:   
2686:          ////////////////////////////////////////////////////////////////////////////
2687:   
2688:          /// <summary>
2689:          /// 
2690:          /// </summary>
2691:          public static List<int> EmsDevIdListFromAccessIdList(List<string> accessIdList)
2692:          {
2693:              List<int> list;
2694:   
2695:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2696:              {
2697:                  list = (from ed in db.EmsDevs
2698:                          where accessIdList.Contains(ed.Access.Id)
2699:                          select ed.Id).ToList();
2700:              }
2701:   
2702:              return list.Distinct().ToList();
2703:          }
2704:   
2705:          ////////////////////////////////////////////////////////////////////////////
2706:   
2707:          /// <summary>
2708:          /// 
2709:          /// </summary>
2710:          public static List<string> EmsBoardIdListFromEmsPortIdList(List<string> emsPortIdList)
2711:          {
2712:              List<string> list;
2713:   
2714:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2715:              {
2716:                  list = (from eb in db.EmsBoards
2717:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
2718:                          where emsPortIdList.Contains(ep.Id)
2719:                          select eb.Id).ToList();
2720:              }
2721:   
2722:              return list.Distinct().ToList();
2723:          }
2724:   
2725:          ////////////////////////////////////////////////////////////////////////////
2726:   
2727:          /// <summary>
2728:          /// 
2729:          /// </summary>
2730:          public static List<string> EmsBoardIdListFromAccessIdList(List<string> accessIdList)
2731:          {
2732:              List<string> list;
2733:   
2734:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2735:              {
2736:                  list = (from eb in db.EmsBoards
2737:                          join ed in db.EmsDevs on eb.EmsDev.Id equals ed.Id
2738:                          where accessIdList.Contains(ed.Access.Id)
2739:                          select eb.Id).ToList();
2740:              }
2741:   
2742:              return list.Distinct().ToList();
2743:          }
2744:   
2745:          ////////////////////////////////////////////////////////////////////////////
2746:   
2747:          /// <summary>
2748:          /// 
2749:          /// </summary>
2750:          public static List<string> EmsPortIdListFromEmsOntIdList(List<string> emsOntIdList)
2751:          {
2752:              List<string> list;
2753:   
2754:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2755:              {
2756:                  list = (from ep in db.EmsPorts
2757:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
2758:                          where emsOntIdList.Contains(eo.Id)
2759:                          select ep.Id).ToList();
2760:              }
2761:   
2762:              return list.Distinct().ToList();
2763:          }
2764:   
2765:          ////////////////////////////////////////////////////////////////////////////
2766:   
2767:          /// <summary>
2768:          /// 
2769:          /// </summary>
2770:          public static List<string> EmsOntIdListFromNddOntIdList(List<string> nddOntIdList)
2771:          {
2772:              List<string> list;
2773:   
2774:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2775:              {
2776:                  list = (from eo in db.EmsOnts
2777:                          where nddOntIdList.Contains(eo.Id)
2778:                          select eo.Id).ToList();
2779:              }
2780:   
2781:              return list.Distinct().ToList();
2782:          }
2783:   
2784:          ////////////////////////////////////////////////////////////////////////////
2785:   
2786:          /// <summary>
2787:          /// 
2788:          /// </summary>
2789:          public static List<string> EmsOntIpListFromNddOntIdList(List<string> nddOntIdList)
2790:          {
2791:              List<string> list;
2792:   
2793:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2794:              {
2795:                  list = (from eo in db.EmsOnts
2796:                          where nddOntIdList.Contains(eo.Id)
2797:                          select eo.IP).ToList();
2798:              }
2799:   
2800:              return list.Distinct().ToList();
2801:          }
2802:   
2803:          ////////////////////////////////////////////////////////////////////////////
2804:   
2805:          /// <summary>
2806:          /// 
2807:          /// </summary>
2808:          public static List<string> SbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
2809:          {
2810:              List<string> list;
2811:   
2812:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2813:              {
2814:                  list = (from s in db.HuSbrs
2815:                          where impuSipDomainList.Contains(s.IMPU)
2816:                          select s.IMPU).ToList();
2817:              }
2818:   
2819:              return list.Distinct().ToList();
2820:          }
2821:   
2822:          ////////////////////////////////////////////////////////////////////////////
2823:   
2824:          /// <summary>
2825:          /// 
2826:          /// </summary>
2827:          public static List<string> OwSbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
2828:          {
2829:              List<string> list;
2830:   
2831:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2832:              {
2833:                  list = (from o in db.Owsbrs
2834:                          where impuSipDomainList.Contains(o.IMPU)
2835:                          select o.IMPU).ToList();
2836:              }
2837:   
2838:              return list.Distinct().ToList();
2839:          }
2840:   
2841:          ////////////////////////////////////////////////////////////////////////////
2842:   
2843:          /// <summary>
2844:          /// 
2845:          /// </summary>
2846:          public static List<string> ServiceRequestServiceIdListFromAccessIdList(List<string> accessIdList)
2847:          {
2848:              List<string> list;
2849:   
2850:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2851:              {
2852:                  list = (from srs in db.ServiceRequestServices
2853:                          where accessIdList.Contains(srs.Access.Id)
2854:                          select srs.Id).ToList();
2855:              }
2856:   
2857:              return list.Distinct().ToList();
2858:          }
2859:   
2860:          ////////////////////////////////////////////////////////////////////////////
2861:   
2862:          /// <summary>
2863:          /// 
2864:          /// </summary>
2865:          public static List<string> ServiceRequestServiceIdListFromServiceIdList(List<string> serviceIdList)
2866:          {
2867:              List<string> list;
2868:   
2869:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2870:              {
2871:                  list = (from srs in db.ServiceRequestServices
2872:                          where serviceIdList.Contains(srs.Id)
2873:                          select srs.Id).ToList();
2874:              }
2875:   
2876:              return list.Distinct().ToList();
2877:          }
2878:   
2879:          ////////////////////////////////////////////////////////////////////////////
2880:   
2881:          /// <summary>
2882:          /// 
2883:          /// </summary>
2884:          public static List<string> ServiceRequestServiceIdListFromServiceList(List<string> serviceList)
2885:          {
2886:              List<string> list;
2887:   
2888:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2889:              {
2890:                  list = (from srs in db.ServiceRequestServices
2891:                          where serviceList.Contains(srs.Service)
2892:                          select srs.Id).ToList();
2893:              }
2894:   
2895:              return list.Distinct().ToList();
2896:          }
2897:   
2898:          ////////////////////////////////////////////////////////////////////////////
2899:   
2900:          /// <summary>
2901:          /// 
2902:          /// </summary>
2903:          public static List<string> ServiceIdListFromServiceIdList(List<string> serviceIdList)
2904:          {
2905:              List<string> list;
2906:   
2907:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2908:              {
2909:                  if (serviceIdList.Count == 1)
2910:                  {
2911:                      var serviceId = serviceIdList[0];
2912:                      list = (from s in db.Service2 where s.Id == serviceId select s.Id).ToList();
2913:                  }
2914:                  else if (serviceIdList.Count <= 32)
2915:                  {
2916:                      list = (from s in db.Service2 where serviceIdList.Contains(s.Id) select s.Id).ToList();
2917:                  }
2918:                  else if (serviceIdList.Count <= 64)
2919:                  {
2920:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2921:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on s.Id equals si select s.Id).ToList();
2922:                  }
2923:                  else if (serviceIdList.Count <= 96)
2924:                  {
2925:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2926:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2927:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on s.Id equals si select s.Id).ToList();
2928:                  }
2929:                  else if (serviceIdList.Count <= 128)
2930:                  {
2931:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2932:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2933:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2934:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on s.Id equals si select s.Id).ToList();
2935:                  }
2936:                  else if (serviceIdList.Count <= 160)
2937:                  {
2938:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2939:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2940:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2941:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2942:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on s.Id equals si select s.Id).ToList();
2943:                  }
2944:                  else if (serviceIdList.Count <= 192)
2945:                  {
2946:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2947:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2948:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2949:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2950:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(128, 32) on s.Id equals si select s.Id).ToList();
2951:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on s.Id equals si select s.Id).ToList();
2952:                  }
2953:                  else if (serviceIdList.Count <= 224)
2954:                  {
2955:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2956:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2957:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2958:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2959:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(128, 32) on s.Id equals si select s.Id).ToList();
2960:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(160, 32) on s.Id equals si select s.Id).ToList();
2961:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on s.Id equals si select s.Id).ToList();
2962:                  }
2963:                  else //if (serviceList.Count <= 256)
2964:                  {
2965:                      list = (from s in db.Service2 join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2966:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2967:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2968:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2969:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(128, 32) on s.Id equals si select s.Id).ToList();
2970:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(160, 32) on s.Id equals si select s.Id).ToList();
2971:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(192, 32) on s.Id equals si select s.Id).ToList();
2972:                      list = list.Union(from s in db.Service2 join si in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on s.Id equals si select s.Id).ToList();
2973:                  }
2974:              }
2975:   
2976:              return list.Distinct().ToList();
2977:          }
2978:   
2979:          ////////////////////////////////////////////////////////////////////////////
2980:   
2981:          /// <summary>
2982:          /// 
2983:          /// </summary>
2984:          public static List<string> ServiceIdListFromServiceList(List<string> serviceList)
2985:          {
2986:              List<string> list;
2987:   
2988:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2989:              {
2990:                  if (serviceList.Count == 1)
2991:                  {
2992:                      var service = serviceList[0];
2993:                      list = (from s in db.Service2 where s.Service == service select s.Id).ToList();
2994:                  }
2995:                  else if (serviceList.Count <= 32)
2996:                  {
2997:                      list = (from s in db.Service2 where serviceList.Contains(s.Service) select s.Id).ToList();
2998:                  }
2999:                  else if (serviceList.Count <= 64)
3000:                  {
3001:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3002:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, serviceList.Count - 32 - 1) on s.Service equals si select s.Id).ToList();
3003:                  }
3004:                  else if (serviceList.Count <= 96)
3005:                  {
3006:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3007:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3008:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(64, serviceList.Count - 64 - 1) on s.Service equals si select s.Id).ToList();
3009:                  }
3010:                  else if (serviceList.Count <= 128)
3011:                  {
3012:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3013:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3014:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
3015:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(96, serviceList.Count - 96 - 1) on s.Service equals si select s.Id).ToList();
3016:                  }
3017:                  else if (serviceList.Count <= 160)
3018:                  {
3019:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3020:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3021:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
3022:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
3023:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(128, serviceList.Count - 128 - 1) on s.Service equals si select s.Id).ToList();
3024:                  }
3025:                  else if (serviceList.Count <= 192)
3026:                  {
3027:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3028:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3029:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
3030:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
3031:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
3032:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(160, serviceList.Count - 160 - 1) on s.Service equals si select s.Id).ToList();
3033:                  }
3034:                  else if (serviceList.Count <= 224)
3035:                  {
3036:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3037:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3038:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
3039:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
3040:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
3041:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
3042:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(192, serviceList.Count - 192 - 1) on s.Service equals si select s.Id).ToList();
3043:                  }
3044:                  else //if (serviceList.Count <= 256)
3045:                  {
3046:                      list = (from s in db.Service2 join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3047:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3048:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
3049:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
3050:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
3051:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
3052:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(192, 32) on s.Service equals si select s.Id).ToList();
3053:                      list = list.Union(from s in db.Service2 join si in serviceList.GetRange(224, serviceList.Count - 224 - 1) on s.Service equals si select s.Id).ToList();
3054:                  }
3055:              }
3056:   
3057:              return list.Distinct().ToList();
3058:          }
3059:   
3060:          ////////////////////////////////////////////////////////////////////////////
3061:   
3062:          /// <summary>
3063:          /// 
3064:          /// </summary>
3065:          public static List<int> ReportIdListFromServiceList(List<string> serviceList)
3066:          {
3067:              List<int> list;
3068:   
3069:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
3070:              // <type id="2" name="Ont Name" arabicName=""/>
3071:   
3072:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3073:              {
3074:                  if (serviceList.Count == 1)
3075:                  {
3076:                      var service = serviceList[0];
3077:                      list = (from r in db.Reports where r.Service == service select r.Id).ToList();
3078:                  }
3079:                  else if (serviceList.Count <= 32)
3080:                  {
3081:                      list = (from r in db.Reports where serviceList.Contains(r.Service) select r.Id).ToList();
3082:                  }
3083:                  else if (serviceList.Count <= 64)
3084:                  {
3085:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3086:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, serviceList.Count - 32 - 1) on r.Service equals s select r.Id).ToList();
3087:                  }
3088:                  else if (serviceList.Count <= 96)
3089:                  {
3090:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3091:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3092:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, serviceList.Count - 64 - 1) on r.Service equals s select r.Id).ToList();
3093:                  }
3094:                  else if (serviceList.Count <= 128)
3095:                  {
3096:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3097:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3098:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3099:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, serviceList.Count - 96 - 1) on r.Service equals s select r.Id).ToList();
3100:                  }
3101:                  else if (serviceList.Count <= 160)
3102:                  {
3103:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3104:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3105:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3106:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3107:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, serviceList.Count - 128 - 1) on r.Service equals s select r.Id).ToList();
3108:                  }
3109:                  else if (serviceList.Count <= 192)
3110:                  {
3111:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3112:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3113:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3114:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3115:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3116:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, serviceList.Count - 160 - 1) on r.Service equals s select r.Id).ToList();
3117:                  }
3118:                  else if (serviceList.Count <= 224)
3119:                  {
3120:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3121:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3122:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3123:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3124:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3125:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3126:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(192, serviceList.Count - 192 - 1) on r.Service equals s select r.Id).ToList();
3127:                  }
3128:                  else //if (serviceList.Count <= 256)
3129:                  {
3130:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3131:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3132:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3133:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3134:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3135:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3136:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
3137:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(224, serviceList.Count - 224 - 1) on r.Service equals s select r.Id).ToList();
3138:                  }
3139:              }
3140:   
3141:              return list.Distinct().ToList();
3142:          }
3143:   
3144:          ////////////////////////////////////////////////////////////////////////////
3145:   
3146:          /// <summary>
3147:          /// 
3148:          /// </summary>
3149:          public static List<int> ReportIdListFromAccessIdList(List<string> accessIdList)
3150:          {
3151:              string accessName;
3152:              List<string> accessNameList;
3153:              List<int> list;
3154:   
3155:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
3156:              // <type id="2" name="Ont Name" arabicName=""/>
3157:   
3158:              var ontAccessIdToOntAccessNameDictionary = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary;
3159:   
3160:              accessNameList = new List<string>();
3161:   
3162:              foreach (var id in accessIdList)
3163:              {
3164:                  if (ontAccessIdToOntAccessNameDictionary.ContainsKey(id))
3165:                  {
3166:                      accessName = ontAccessIdToOntAccessNameDictionary[id];
3167:   
3168:                      accessNameList.Add(accessName);
3169:                  }
3170:              }
3171:   
3172:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3173:              {
3174:                  if (accessNameList.Count == 1)
3175:                  {
3176:                      var accessName2 = accessNameList[0];
3177:                      list = (from r in db.Reports where r.Service == accessName2 select r.Id).ToList();
3178:                  }
3179:                  else if (accessNameList.Count <= 32)
3180:                  {
3181:                      list = (from r in db.Reports where accessNameList.Contains(r.Service) select r.Id).ToList();
3182:                  }
3183:                  else if (accessNameList.Count <= 64)
3184:                  {
3185:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3186:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, accessNameList.Count - 32 - 1) on r.Service equals s select r.Id).ToList();
3187:                  }
3188:                  else if (accessNameList.Count <= 96)
3189:                  {
3190:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3191:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3192:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, accessNameList.Count - 64 - 1) on r.Service equals s select r.Id).ToList();
3193:                  }
3194:                  else if (accessNameList.Count <= 128)
3195:                  {
3196:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3197:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3198:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3199:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, accessNameList.Count - 96 - 1) on r.Service equals s select r.Id).ToList();
3200:                  }
3201:                  else if (accessNameList.Count <= 160)
3202:                  {
3203:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3204:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3205:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3206:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3207:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, accessNameList.Count - 128 - 1) on r.Service equals s select r.Id).ToList();
3208:                  }
3209:                  else if (accessNameList.Count <= 192)
3210:                  {
3211:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3212:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3213:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3214:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3215:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3216:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(160, accessNameList.Count - 160 - 1) on r.Service equals s select r.Id).ToList();
3217:                  }
3218:                  else if (accessNameList.Count <= 224)
3219:                  {
3220:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3221:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3222:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3223:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3224:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3225:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3226:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(192, accessNameList.Count - 192 - 1) on r.Service equals s select r.Id).ToList();
3227:                  }
3228:                  else //if (serviceList.Count <= 256)
3229:                  {
3230:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3231:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3232:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3233:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3234:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3235:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3236:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
3237:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(224, accessNameList.Count - 224 - 1) on r.Service equals s select r.Id).ToList();
3238:                  }
3239:              }
3240:   
3241:              return list.Distinct().ToList();
3242:          }
3243:   
3244:          ////////////////////////////////////////////////////////////////////////////
3245:   
3246:          /// <summary>
3247:          /// 
3248:          /// </summary>
3249:          public static List<string> ServiceIdListFromAccessIdList(List<string> accessIdList)
3250:          {
3251:              List<string> list;
3252:   
3253:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3254:              {
3255:                  list = (from s in db.Service2
3256:                          where s.Access != null && accessIdList.Contains(s.Access.Id)
3257:                          select s.Id).ToList();
3258:              }
3259:   
3260:              return list.Distinct().ToList();
3261:          }
3262:   
3263:          ////////////////////////////////////////////////////////////////////////////
3264:   
3265:          /// <summary>
3266:          /// 
3267:          /// </summary>
3268:          public static List<string> AccessIdListFromServiceIdList(List<string> serviceIdList)
3269:          {
3270:              List<string> list;
3271:   
3272:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3273:              {
3274:                  list = (from s in db.Service2
3275:                          where serviceIdList.Contains(s.Id) && s.Access != null /*&& s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
3276:                          select s.Access.Id).ToList();
3277:              }
3278:   
3279:              return list.Distinct().ToList();
3280:          }
3281:   
3282:          ////////////////////////////////////////////////////////////////////////////
3283:   
3284:          /// <summary>
3285:          /// 
3286:          /// </summary>
3287:          public static List<string> AccessIdListFromServiceList(List<string> serviceList)
3288:          {
3289:              List<string> list;
3290:   
3291:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3292:              {
3293:                  list = (from s in db.Service2
3294:                          where serviceList.Contains(s.Service) && s.Access != null /*&& where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
3295:                          select s.Access.Id).ToList();
3296:              }
3297:   
3298:              return list.Distinct().ToList();
3299:          }
3300:   
3301:          ////////////////////////////////////////////////////////////////////////////
3302:   
3303:          /// <summary>
3304:          /// 
3305:          /// </summary>
3306:          public static List<string> AccessIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
3307:          {
3308:              List<string> list;
3309:   
3310:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3311:              {
3312:                  list = (from srs in db.ServiceRequestServices
3313:                          where serviceRequestServiceIdList.Contains(srs.Id) && srs.Access != null
3314:                          select srs.Access.Id).ToList();
3315:              }
3316:   
3317:              return list.Distinct().ToList();
3318:          }
3319:   
3320:          ////////////////////////////////////////////////////////////////////////////
3321:   
3322:          /// <summary>
3323:          /// 
3324:          /// </summary>
3325:          public static List<string> ServiceRequestOntIdListFromAccessIdList(List<string> accessIdList)
3326:          {
3327:              List<string> list;
3328:   
3329:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3330:              {
3331:                  list = (from sro in db.ServiceRequestOnts
3332:                          where accessIdList.Contains(sro.Access.Id)
3333:                          select sro.Id).ToList();
3334:              }
3335:   
3336:              return list.Distinct().ToList();
3337:          }
3338:   
3339:          ////////////////////////////////////////////////////////////////////////////
3340:   
3341:          /// <summary>
3342:          /// 
3343:          /// </summary>
3344:          public static List<int> ServiceRequestIdListFromServiceList(List<string> serviceList)
3345:          {
3346:              List<int> list, numberList;
3347:   
3348:              if (serviceList.Count > 0)
3349:              {
3350:                  numberList = new List<int>();
3351:   
3352:                  foreach (string s in serviceList)
3353:                  {
3354:                      if (int.TryParse(s, out int i)) numberList.Add(i);
3355:                  }
3356:   
3357:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3358:                  {
3359:                      if (numberList.Count == 1)
3360:                      {
3361:                          var number = numberList[0];
3362:                          list = (from sr in db.ServiceRequests where sr.Number == number select sr.Id).ToList();
3363:                      }
3364:                      else if (numberList.Count <= 32)
3365:                      {
3366:                          list = (from sr in db.ServiceRequests where numberList.Contains(sr.Number) select sr.Id).ToList();
3367:                      }
3368:                      else if (numberList.Count <= 64)
3369:                      {
3370:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3371:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, serviceList.Count - 32 - 1) on sr.Number equals srsid select sr.Id).ToList();
3372:                      }
3373:                      else if (numberList.Count <= 96)
3374:                      {
3375:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3376:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3377:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, serviceList.Count - 64 - 1) on sr.Number equals srsid select sr.Id).ToList();
3378:                      }
3379:                      else if (numberList.Count <= 128)
3380:                      {
3381:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3382:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3383:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3384:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, serviceList.Count - 96 - 1) on sr.Number equals srsid select sr.Id).ToList();
3385:                      }
3386:                      else if (numberList.Count <= 160)
3387:                      {
3388:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3389:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3390:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3391:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3392:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, serviceList.Count - 128 - 1) on sr.Number equals srsid select sr.Id).ToList();
3393:                      }
3394:                      else if (numberList.Count <= 192)
3395:                      {
3396:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3397:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3398:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3399:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3400:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
3401:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, serviceList.Count - 160 - 1) on sr.Number equals srsid select sr.Id).ToList();
3402:                      }
3403:                      else if (numberList.Count <= 224)
3404:                      {
3405:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3406:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3407:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3408:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3409:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
3410:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, 32) on sr.Number equals srsid select sr.Id).ToList();
3411:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(192, serviceList.Count - 192 - 1) on sr.Number equals srsid select sr.Id).ToList();
3412:                      }
3413:                      else //if (numberList.Count <= 256)
3414:                      {
3415:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3416:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3417:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3418:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3419:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
3420:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, 32) on sr.Number equals srsid select sr.Id).ToList();
3421:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(192, 32) on sr.Number equals srsid select sr.Id).ToList();
3422:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(224, serviceList.Count - 224 - 1) on sr.Number equals srsid select sr.Id).ToList();
3423:                      }
3424:                  }
3425:              }
3426:              else
3427:              {
3428:                  list = new List<int>();
3429:              }
3430:   
3431:              return list.Distinct().ToList();
3432:          }
3433:   
3434:          ////////////////////////////////////////////////////////////////////////////
3435:   
3436:          /// <summary>
3437:          /// 
3438:          /// </summary>
3439:          public static List<int> ServiceRequestIdListFromServiceAndChangedAndChangedToList(List<string> serviceList)
3440:          {
3441:              List<int> list, numberList, changedList;
3442:   
3443:              if (serviceList.Count > 0)
3444:              {
3445:                  numberList = new List<int>();
3446:   
3447:                  foreach (string s in serviceList)
3448:                  {
3449:                      if (int.TryParse(s, out int i)) numberList.Add(i);
3450:                  }
3451:   
3452:                  changedList = Ia.Ngn.Cl.Model.Data.ServiceRequest.NumberAndChangedAndChangedToList(numberList);
3453:   
3454:                  if (changedList.Count != numberList.Count)
3455:                  {
3456:                      serviceList = (from n in changedList select n.ToString()).ToList();
3457:   
3458:                      list = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceList(serviceList);
3459:                  }
3460:                  else
3461:                  {
3462:                      list = new List<int>();
3463:                  }
3464:              }
3465:              else
3466:              {
3467:                  list = new List<int>();
3468:              }
3469:   
3470:              return list.Distinct().ToList();
3471:          }
3472:   
3473:          ////////////////////////////////////////////////////////////////////////////
3474:   
3475:          /// <summary>
3476:          /// 
3477:          /// </summary>
3478:          public static List<int> ServiceRequestIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
3479:          {
3480:              List<int> list;
3481:   
3482:              if (serviceRequestServiceIdList.Count > 0)
3483:              {
3484:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3485:                  {
3486:                      if (serviceRequestServiceIdList.Count == 1)
3487:                      {
3488:                          var serviceRequestServiceId = serviceRequestServiceIdList[0];
3489:                          list = (from sr in db.ServiceRequests where sr.ServiceRequestService.Id == serviceRequestServiceId select sr.Id).ToList();
3490:                      }
3491:                      else if (serviceRequestServiceIdList.Count <= 32)
3492:                      {
3493:                          list = (from sr in db.ServiceRequests where serviceRequestServiceIdList.Contains(sr.ServiceRequestService.Id) select sr.Id).ToList();
3494:                      }
3495:                      else if (serviceRequestServiceIdList.Count <= 64)
3496:                      {
3497:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3498:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, serviceRequestServiceIdList.Count - 32 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3499:                      }
3500:                      else if (serviceRequestServiceIdList.Count <= 96)
3501:                      {
3502:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3503:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3504:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, serviceRequestServiceIdList.Count - 64 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3505:                      }
3506:                      else if (serviceRequestServiceIdList.Count <= 128)
3507:                      {
3508:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3509:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3510:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3511:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, serviceRequestServiceIdList.Count - 96 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3512:                      }
3513:                      else if (serviceRequestServiceIdList.Count <= 160)
3514:                      {
3515:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3516:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3517:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3518:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3519:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, serviceRequestServiceIdList.Count - 128 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3520:                      }
3521:                      else if (serviceRequestServiceIdList.Count <= 192)
3522:                      {
3523:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3524:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3525:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3526:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3527:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3528:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(160, serviceRequestServiceIdList.Count - 160 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3529:                      }
3530:                      else if (serviceRequestServiceIdList.Count <= 224)
3531:                      {
3532:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3533:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3534:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3535:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3536:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3537:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(160, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3538:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(192, serviceRequestServiceIdList.Count - 192 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3539:                      }
3540:                      else //if (serviceList.Count <= 256)
3541:                      {
3542:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3543:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3544:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3545:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3546:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3547:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(160, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3548:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(192, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3549:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(224, serviceRequestServiceIdList.Count - 224 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3550:                      }
3551:                  }
3552:              }
3553:              else
3554:              {
3555:                  list = new List<int>();
3556:              }
3557:   
3558:              return list.Distinct().ToList();
3559:          }
3560:   
3561:          ////////////////////////////////////////////////////////////////////////////
3562:   
3563:          /// <summary>
3564:          /// 
3565:          /// </summary>
3566:          public static List<string> ServiceRequestAdministrativeIssueIdListFromServiceIdList(List<string> serviceIdList)
3567:          {
3568:              List<string> list;
3569:   
3570:              if (serviceIdList.Count > 0)
3571:              {
3572:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3573:                  {
3574:                      if (serviceIdList.Count == 1)
3575:                      {
3576:                          var serviceId = serviceIdList[0];
3577:                          list = (from srai in db.ServiceRequestAdministrativeIssues where srai.Id == serviceId select srai.Id).ToList();
3578:                      }
3579:                      else if (serviceIdList.Count <= 32)
3580:                      {
3581:                          list = (from srai in db.ServiceRequestAdministrativeIssues where serviceIdList.Contains(srai.Id) select srai.Id).ToList();
3582:                      }
3583:                      else if (serviceIdList.Count <= 64)
3584:                      {
3585:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3586:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on srai.Id equals sid select srai.Id).ToList();
3587:                      }
3588:                      else if (serviceIdList.Count <= 96)
3589:                      {
3590:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3591:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3592:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on srai.Id equals sid select srai.Id).ToList();
3593:                      }
3594:                      else if (serviceIdList.Count <= 128)
3595:                      {
3596:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3597:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3598:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3599:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on srai.Id equals sid select srai.Id).ToList();
3600:                      }
3601:                      else if (serviceIdList.Count <= 160)
3602:                      {
3603:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3604:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3605:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3606:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3607:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on srai.Id equals sid select srai.Id).ToList();
3608:                      }
3609:                      else if (serviceIdList.Count <= 192)
3610:                      {
3611:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3612:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3613:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3614:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3615:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, 32) on srai.Id equals sid select srai.Id).ToList();
3616:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on srai.Id equals sid select srai.Id).ToList();
3617:                      }
3618:                      else if (serviceIdList.Count <= 224)
3619:                      {
3620:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3621:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3622:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3623:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3624:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, 32) on srai.Id equals sid select srai.Id).ToList();
3625:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(160, 32) on srai.Id equals sid select srai.Id).ToList();
3626:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on srai.Id equals sid select srai.Id).ToList();
3627:                      }
3628:                      else //if (serviceList.Count <= 256)
3629:                      {
3630:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3631:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3632:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3633:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3634:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, 32) on srai.Id equals sid select srai.Id).ToList();
3635:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(160, 32) on srai.Id equals sid select srai.Id).ToList();
3636:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(192, 32) on srai.Id equals sid select srai.Id).ToList();
3637:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on srai.Id equals sid select srai.Id).ToList();
3638:                      }
3639:                  }
3640:              }
3641:              else
3642:              {
3643:                  list = new List<string>();
3644:              }
3645:   
3646:              return list.Distinct().ToList();
3647:          }
3648:   
3649:          ////////////////////////////////////////////////////////////////////////////
3650:   
3651:          /// <summary>
3652:          /// 
3653:          /// </summary>
3654:          public static List<string> ServiceRequestHistoryIdListFromServiceList(List<string> serviceList)
3655:          {
3656:              List<int> numberList;
3657:              List<string> list;
3658:   
3659:              if (serviceList.Count > 0)
3660:              {
3661:                  numberList = new List<int>();
3662:   
3663:                  foreach (string s in serviceList)
3664:                  {
3665:                      if (int.TryParse(s, out int i)) numberList.Add(i);
3666:                  }
3667:   
3668:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3669:                  {
3670:                      if (serviceList.Count == 1)
3671:                      {
3672:                          var number = numberList[0];
3673:                          list = (from srh in db.ServiceRequestHistories where srh.Number == number select srh.Id).ToList();
3674:                      }
3675:                      else if (serviceList.Count <= 32)
3676:                      {
3677:                          list = (from srh in db.ServiceRequestHistories where numberList.Contains(srh.Number) select srh.Id).ToList();
3678:                      }
3679:                      else if (serviceList.Count <= 64)
3680:                      {
3681:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3682:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, serviceList.Count - 32 - 1) on srh.Number equals srsid select srh.Id).ToList();
3683:                      }
3684:                      else if (serviceList.Count <= 96)
3685:                      {
3686:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3687:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3688:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, serviceList.Count - 64 - 1) on srh.Number equals srsid select srh.Id).ToList();
3689:                      }
3690:                      else if (serviceList.Count <= 128)
3691:                      {
3692:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3693:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3694:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3695:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, serviceList.Count - 96 - 1) on srh.Number equals srsid select srh.Id).ToList();
3696:                      }
3697:                      else if (serviceList.Count <= 160)
3698:                      {
3699:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3700:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3701:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3702:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3703:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, serviceList.Count - 128 - 1) on srh.Number equals srsid select srh.Id).ToList();
3704:                      }
3705:                      else if (serviceList.Count <= 192)
3706:                      {
3707:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3708:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3709:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3710:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3711:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
3712:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, serviceList.Count - 160 - 1) on srh.Number equals srsid select srh.Id).ToList();
3713:                      }
3714:                      else if (serviceList.Count <= 224)
3715:                      {
3716:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3717:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3718:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3719:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3720:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
3721:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, 32) on srh.Number equals srsid select srh.Id).ToList();
3722:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(192, serviceList.Count - 192 - 1) on srh.Number equals srsid select srh.Id).ToList();
3723:                      }
3724:                      else //if (serviceList.Count <= 256)
3725:                      {
3726:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3727:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3728:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3729:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3730:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
3731:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, 32) on srh.Number equals srsid select srh.Id).ToList();
3732:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(192, 32) on srh.Number equals srsid select srh.Id).ToList();
3733:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(224, serviceList.Count - 224 - 1) on srh.Number equals srsid select srh.Id).ToList();
3734:                      }
3735:                  }
3736:              }
3737:              else
3738:              {
3739:                  list = new List<string>();
3740:              }
3741:   
3742:              return list.Distinct().ToList();
3743:          }
3744:   
3745:          ////////////////////////////////////////////////////////////////////////////
3746:   
3747:          /// <summary>
3748:          /// 
3749:          /// </summary>
3750:          public static List<int> ServiceRequestTypeIdListFromServiceRequestIdList(List<int> serviceRequestIdList)
3751:          {
3752:              List<int> list;
3753:   
3754:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3755:              {
3756:                  if (serviceRequestIdList.Count == 1)
3757:                  {
3758:                      var serviceRequestId = serviceRequestIdList[0];
3759:                      list = (from srt in db.ServiceRequestTypes
3760:                              where srt.ServiceRequest.Id == serviceRequestId
3761:                              select srt.Id).ToList();
3762:                  }
3763:                  else if (serviceRequestIdList.Count <= 32)
3764:                  {
3765:                      list = (from srt in db.ServiceRequestTypes
3766:                              where serviceRequestIdList.Contains(srt.ServiceRequest.Id)
3767:                              select srt.Id).ToList();
3768:                  }
3769:                  else if (serviceRequestIdList.Count <= 64)
3770:                  {
3771:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3772:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, serviceRequestIdList.Count - 32 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3773:                  }
3774:                  else if (serviceRequestIdList.Count <= 96)
3775:                  {
3776:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3777:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3778:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, serviceRequestIdList.Count - 64 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3779:                  }
3780:                  else if (serviceRequestIdList.Count <= 128)
3781:                  {
3782:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3783:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3784:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3785:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, serviceRequestIdList.Count - 96 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3786:                  }
3787:                  else if (serviceRequestIdList.Count <= 160)
3788:                  {
3789:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3790:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3791:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3792:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3793:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, serviceRequestIdList.Count - 128 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3794:                  }
3795:                  else if (serviceRequestIdList.Count <= 192)
3796:                  {
3797:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3798:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3799:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3800:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3801:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3802:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, serviceRequestIdList.Count - 160 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3803:                  }
3804:                  else if (serviceRequestIdList.Count <= 224)
3805:                  {
3806:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3807:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3808:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3809:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3810:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3811:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3812:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, serviceRequestIdList.Count - 192 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3813:                  }
3814:                  else if (serviceRequestIdList.Count <= 256)
3815:                  {
3816:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3817:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3818:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3819:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3820:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3821:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3822:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3823:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, serviceRequestIdList.Count - 224 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3824:                  }
3825:                  else if (serviceRequestIdList.Count <= 288)
3826:                  {
3827:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3828:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3829:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3830:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3831:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3832:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3833:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3834:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3835:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, serviceRequestIdList.Count - 256 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3836:                  }
3837:                  else if (serviceRequestIdList.Count <= 320)
3838:                  {
3839:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3840:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3841:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3842:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3843:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3844:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3845:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3846:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3847:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3848:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, serviceRequestIdList.Count - 288 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3849:                  }
3850:                  else if (serviceRequestIdList.Count <= 352)
3851:                  {
3852:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3853:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3854:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3855:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3856:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3857:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3858:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3859:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3860:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3861:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3862:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, serviceRequestIdList.Count - 320 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3863:                  }
3864:                  else if (serviceRequestIdList.Count <= 384)
3865:                  {
3866:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3867:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3868:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3869:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3870:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3871:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3872:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3873:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3874:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3875:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3876:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3877:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, serviceRequestIdList.Count - 352 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3878:                  }
3879:                  else if (serviceRequestIdList.Count <= 416)
3880:                  {
3881:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3882:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3883:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3884:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3885:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3886:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3887:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3888:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3889:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3890:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3891:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3892:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3893:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(384, serviceRequestIdList.Count - 384 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3894:                  }
3895:                  else if (serviceRequestIdList.Count <= 448)
3896:                  {
3897:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3898:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3899:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3900:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3901:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3902:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3903:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3904:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3905:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3906:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3907:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3908:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3909:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(384, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3910:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(416, serviceRequestIdList.Count - 416 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3911:                  }
3912:                  else if (serviceRequestIdList.Count <= 480)
3913:                  {
3914:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3915:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3916:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3917:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3918:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3919:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3920:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3921:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3922:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3923:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3924:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3925:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3926:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(384, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3927:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(416, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3928:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(448, serviceRequestIdList.Count - 448 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3929:                  }
3930:                  else if (serviceRequestIdList.Count <= 512)
3931:                  {
3932:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3933:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3934:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3935:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3936:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3937:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3938:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3939:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3940:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3941:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3942:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3943:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3944:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(384, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3945:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(416, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3946:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(448, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3947:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(480, serviceRequestIdList.Count - 480 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3948:                  }
3949:                  else if (serviceRequestIdList.Count <= 544)
3950:                  {
3951:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3952:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3953:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3954:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3955:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3956:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3957:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3958:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3959:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3960:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3961:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3962:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3963:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(384, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3964:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(416, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3965:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(448, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3966:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(480, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3967:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(512, serviceRequestIdList.Count - 512 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3968:                  }
3969:                  else //if (serviceRequestIdList.Count <= ??)
3970:                  {
3971:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3972:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3973:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3974:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3975:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3976:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3977:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3978:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3979:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3980:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3981:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(320, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3982:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(352, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3983:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(384, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3984:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(416, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3985:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(448, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3986:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(480, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3987:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(512, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3988:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(544, serviceRequestIdList.Count - 544 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3989:                  }
3990:              }
3991:   
3992:              return list.Distinct().ToList();
3993:          }
3994:   
3995:          ////////////////////////////////////////////////////////////////////////////
3996:   
3997:          /// <summary>
3998:          /// 
3999:          /// </summary>
4000:          public static List<string> NddOntIdList(int oltId, int ponNumber, int ontInternalNumber)
4001:          {
4002:              List<string> list;
4003:   
4004:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList 
4005:                      where srsid.Pon.PonGroup.Olt.Id == oltId && srsid.Pon.Number == ponNumber && srsid.Number == ontInternalNumber 
4006:                      select srsid.Id).ToList();
4007:   
4008:              return list.Distinct().ToList();
4009:          }
4010:   
4011:          ////////////////////////////////////////////////////////////////////////////
4012:   
4013:          /// <summary>
4014:          /// 
4015:          /// </summary>
4016:          public static List<string> NddOntIdList(int oltId, int ponNumber)
4017:          {
4018:              List<string> list;
4019:   
4020:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList 
4021:                      where srsid.Pon.PonGroup.Olt.Id == oltId && srsid.Pon.Number == ponNumber 
4022:                      select srsid.Id).ToList();
4023:   
4024:              return list.Distinct().ToList();
4025:          }
4026:   
4027:          ////////////////////////////////////////////////////////////////////////////
4028:   
4029:          /// <summary>
4030:          /// 
4031:          /// </summary>
4032:          public static List<string> NddOntIdListFromAccessIdList(List<string> accessIdList)
4033:          {
4034:              List<string> list;
4035:   
4036:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList 
4037:                      where accessIdList.Contains(srsid.Access.Id) 
4038:                      select srsid.Id).ToList();
4039:   
4040:              return list.Distinct().ToList();
4041:          }
4042:   
4043:          ////////////////////////////////////////////////////////////////////////////   
4044:   
4045:          /// <summary>
4046:          /// 
4047:          /// </summary>
4048:          public static List<string> NddOntIdListFromEmsOntSipInfoListAndEmsVoipPstnUserListByServiceList(List<string> serviceList)
4049:          {
4050:              string sipUserName, serviceWithCountryCode;
4051:              List<string> list, emsOntSipInfoEmsOntIdList, emsVoipPstnUserEmsOntIdList;
4052:              List<string> emsOntSipInfoSipUserNameList, emsVoipPstnUserDnList;
4053:   
4054:              emsOntSipInfoSipUserNameList = new List<string>();
4055:              emsVoipPstnUserDnList = new List<string>();
4056:   
4057:              foreach (var service in serviceList)
4058:              {
4059:                  sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
4060:                  emsOntSipInfoSipUserNameList.Add(sipUserName);
4061:   
4062:                  serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
4063:                  emsVoipPstnUserDnList.Add(serviceWithCountryCode);
4064:              }
4065:   
4066:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4067:              {
4068:                  emsOntSipInfoEmsOntIdList = (from eosi in db.EmsOntSipInfoes
4069:                                               join eo in db.EmsOnts on eosi.EmsOnt.Id equals eo.Id
4070:                                               where emsOntSipInfoSipUserNameList.Contains(eosi.SIPUSERNAME)
4071:                                               select eo.Id).Distinct().ToList();
4072:   
4073:                  emsVoipPstnUserEmsOntIdList = (from evpu in db.EmsVoipPstnUsers
4074:                                                 join eo in db.EmsOnts on evpu.EmsOnt.Id equals eo.Id
4075:                                                 where emsVoipPstnUserDnList.Contains(evpu.DN)
4076:                                                 select eo.Id).Distinct().ToList();
4077:   
4078:                  list = emsOntSipInfoEmsOntIdList.Concat(emsVoipPstnUserEmsOntIdList).ToList();
4079:              }
4080:   
4081:              return list.Distinct().ToList();
4082:          }
4083:   
4084:          ////////////////////////////////////////////////////////////////////////////
4085:   
4086:          /// <summary>
4087:          /// 
4088:          /// </summary>
4089:          public static List<string> OntServiceVoipIpList(List<string> ontServiceVoipIdList)
4090:          {
4091:              List<string> list;
4092:   
4093:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4094:              {
4095:                  if (ontServiceVoipIdList.Count <= 32)
4096:                  {
4097:                      list = (from osv in db.OntServiceVoips where ontServiceVoipIdList.Contains(osv.Id) select osv.Ip).ToList();
4098:                  }
4099:                  else
4100:                  {
4101:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList.GetRange(0, 32) on osv.Id equals osvid select osv.Ip).ToList();
4102:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList.GetRange(32, ontServiceVoipIdList.Count - 32 - 1) on osv.Id equals osvid select osv.Ip).ToList();
4103:                  }
4104:              }
4105:   
4106:              return list.Distinct().ToList();
4107:          }
4108:   
4109:          ////////////////////////////////////////////////////////////////////////////
4110:   
4111:          /// <summary>
4112:          /// 
4113:          /// </summary>
4114:          public static List<string> NddPonIpList(int oltId, int ponNumber)
4115:          {
4116:              var list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList 
4117:                          where srsid.Pon.PonGroup.Olt.Id == oltId && srsid.Pon.Number == ponNumber 
4118:                          select srsid.Ip);//.ToList();
4119:   
4120:              return list.Distinct().ToList();
4121:          }
4122:   
4123:          ////////////////////////////////////////////////////////////////////////////
4124:   
4125:          /// <summary>
4126:          /// 
4127:          /// </summary>
4128:          public static List<string> OntIdListFromNddOntIdList(List<string> nddOntIdList)
4129:          {
4130:              List<string> list;
4131:   
4132:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4133:              {
4134:                  list = (from o in db.Onts where nddOntIdList.Contains(o.Id) select o.Id).ToList();
4135:              }
4136:   
4137:              return list.Distinct().ToList();
4138:          }
4139:   
4140:          ////////////////////////////////////////////////////////////////////////////
4141:   
4142:          /// <summary>
4143:          /// 
4144:          /// </summary>
4145:          public static List<string> OntOntPotsIdListFromOntIdList(List<string> ontIdList)
4146:          {
4147:              List<string> list;
4148:   
4149:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4150:              {
4151:                  list = (from oop in db.OntOntPots where ontIdList.Contains(oop.Ont.Id) select oop.Id).ToList();
4152:              }
4153:   
4154:              return list.Distinct().ToList();
4155:          }
4156:   
4157:          ////////////////////////////////////////////////////////////////////////////
4158:   
4159:          /// <summary>
4160:          /// 
4161:          /// </summary>
4162:          public static List<string> OntServiceVoipsIdListFromOntIdList(List<string> ontIdList)
4163:          {
4164:              List<string> list;
4165:   
4166:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4167:              {
4168:                  list = (from ov in db.OntServiceVoips
4169:                          where ontIdList.Contains(ov.Ont.Id)
4170:                          select ov.Id).ToList();
4171:              }
4172:   
4173:              return list.Distinct().ToList();
4174:          }
4175:   
4176:          ////////////////////////////////////////////////////////////////////////////
4177:   
4178:          /// <summary>
4179:          /// 
4180:          /// </summary>
4181:          public static List<string> AccessIdListFromOntSerial(string serial)
4182:          {
4183:              List<string> list;
4184:   
4185:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4186:              {
4187:                  list = (from o in db.Onts where o.Serial == serial select o.Access.Id).ToList();
4188:              }
4189:   
4190:              return list.Distinct().ToList();
4191:          }
4192:   
4193:          ////////////////////////////////////////////////////////////////////////////
4194:   
4195:          /// <summary>
4196:          /// 
4197:          /// </summary>
4198:          public static List<string> AccessIdListFromEmsOntSerial(string serial)
4199:          {
4200:              List<string> list;
4201:   
4202:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4203:              {
4204:                  list = (from eo in db.EmsOnts where eo.SERIALNUM == serial select eo.Access.Id).ToList();
4205:              }
4206:   
4207:              return list.Distinct().ToList();
4208:          }
4209:   
4210:          ////////////////////////////////////////////////////////////////////////////
4211:   
4212:          /// <summary>
4213:          /// 
4214:          /// </summary>
4215:          public static List<string> AccessIdListFromEmsOntIp(string ip)
4216:          {
4217:              List<string> list;
4218:   
4219:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4220:              {
4221:                  list = (from eo in db.EmsOnts where eo.IP == ip select eo.Access.Id).ToList();
4222:              }
4223:   
4224:              return list.Distinct().ToList();
4225:          }
4226:   
4227:          ////////////////////////////////////////////////////////////////////////////
4228:   
4229:          /// <summary>
4230:          /// 
4231:          /// </summary>
4232:          public static List<string> OntServiceVoipsIdListFromIpList(List<string> ipList)
4233:          {
4234:              List<string> list;
4235:   
4236:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4237:              {
4238:                  list = (from ov in db.OntServiceVoips where ipList.Contains(ov.Ip) select ov.Id).ToList();
4239:              }
4240:   
4241:              return list.Distinct().ToList();
4242:          }
4243:   
4244:          ////////////////////////////////////////////////////////////////////////////
4245:   
4246:          /// <summary>
4247:          /// 
4248:          /// </summary>
4249:          public static List<long> EventIdListFromOntIdList(List<string> ontIdList)
4250:          {
4251:              List<long> list;
4252:   
4253:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4254:              {
4255:                  list = (from e in db.Events 
4256:                          where ontIdList.Contains(e.Ont.Id) && e.Ont != null 
4257:                          select e.Id).ToList();
4258:              }
4259:   
4260:              return list.Distinct().ToList();
4261:          }
4262:   
4263:          ////////////////////////////////////////////////////////////////////////////
4264:   
4265:          /// <summary>
4266:          /// 
4267:          /// </summary>
4268:          public static List<int> AgcfGatewayRecordIdListFromIpList(List<string> ipList)
4269:          {
4270:              List<int> list;
4271:   
4272:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4273:              {
4274:                  if (ipList.Count <= 32)
4275:                  {
4276:                      list = (from gr in db.AgcfGatewayRecords 
4277:                              where ipList.Contains(gr.IP1) 
4278:                              select gr.Id).ToList();
4279:                  }
4280:                  else
4281:                  {
4282:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
4283:                      list = list.Union(from gr in db.AgcfGatewayRecords join ip in ipList.GetRange(32, ipList.Count - 32 - 1) on gr.IP1 equals ip select gr.Id).ToList();
4284:                  }
4285:              }
4286:   
4287:              return list.Distinct().ToList();
4288:          }
4289:   
4290:          ////////////////////////////////////////////////////////////////////////////
4291:   
4292:          /// <summary>
4293:          /// 
4294:          /// </summary>
4295:          public static List<int> AgcfGatewayRecordIdListFromNddOntIdList(List<string> nddOntIdlist)
4296:          {
4297:              List<int> list;
4298:              List<string> nddIpList;
4299:   
4300:              nddIpList = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where nddOntIdlist.Contains(srsid.Id) select srsid.Ip).ToList();
4301:   
4302:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4303:              {
4304:                  if (nddOntIdlist.Count <= 32)
4305:                  {
4306:                      list = (from gr in db.AgcfGatewayRecords where nddIpList.Contains(gr.IP1) select gr.Id).ToList();
4307:                  }
4308:                  else
4309:                  {
4310:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
4311:                      list = list.Union(from gr in db.AgcfGatewayRecords join ip in nddIpList.GetRange(32, nddIpList.Count - 32 - 1) on gr.IP1 equals ip select gr.Id).ToList();
4312:                  }
4313:              }
4314:   
4315:              return list.Distinct().ToList();
4316:          }
4317:   
4318:          ////////////////////////////////////////////////////////////////////////////
4319:   
4320:          /// <summary>
4321:          /// 
4322:          /// </summary>
4323:          public static List<int> AgcfGatewayRecordIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
4324:          {
4325:              List<int> list;
4326:   
4327:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4328:              {
4329:                  if (agcfEndpointIdList.Count <= 32)
4330:                  {
4331:                      list = (from ep in db.AgcfEndpoints where agcfEndpointIdList.Contains(ep.Id) select ep.AgcfGatewayRecord.Id).ToList();
4332:                  }
4333:                  else
4334:                  {
4335:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList.GetRange(0, 32) on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
4336:                      list = list.Union(from ep in db.AgcfEndpoints join epid in agcfEndpointIdList.GetRange(32, agcfEndpointIdList.Count - 32 - 1) on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
4337:                  }
4338:              }
4339:   
4340:              return list.Distinct().ToList();
4341:          }
4342:   
4343:          ////////////////////////////////////////////////////////////////////////////
4344:   
4345:          /// <summary>
4346:          /// 
4347:          /// </summary>
4348:          public static List<string> AgcfEndpointIdListFromAgcfGatewayRecordIdList(List<int> agcfGatewayRecordIdList)
4349:          {
4350:              List<string> list;
4351:   
4352:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4353:              {
4354:                  list = (from e in db.AgcfEndpoints 
4355:                          where agcfGatewayRecordIdList.Contains(e.AgcfGatewayRecord.Id) && e.AgcfGatewayRecord != null 
4356:                          select e.Id).ToList();
4357:              }
4358:   
4359:              return list.Distinct().ToList();
4360:          }
4361:   
4362:          ////////////////////////////////////////////////////////////////////////////
4363:          ////////////////////////////////////////////////////////////////////////////
4364:   
4365:          /// <summary>
4366:          /// 
4367:          /// </summary>
4368:          public static List<string> MgwIdListFromAsbrIdList(List<string> asbrIdList)
4369:          {
4370:              List<string> list;
4371:   
4372:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4373:              {
4374:                  if (asbrIdList.Count <= 32)
4375:                  {
4376:                      list = (from m in db.Mgws
4377:                              join a in db.Asbrs on m.Id equals a.Mgw.Id
4378:                              where asbrIdList.Contains(a.Id)
4379:                              select m.Id).ToList();
4380:                  }
4381:                  else
4382:                  {
4383:                      list = (from m in db.Mgws
4384:                              join a in db.Asbrs on m.Id equals a.Mgw.Id
4385:                              join aid in asbrIdList.GetRange(0, 32) on a.Id equals aid
4386:                              select m.Id).ToList();
4387:   
4388:                      list = list.Union(from m in db.Mgws
4389:                                        join a in db.Asbrs on m.Id equals a.Mgw.Id
4390:                                        join aid in asbrIdList.GetRange(32, asbrIdList.Count - 32 - 1) on a.Id equals aid
4391:                                        select m.Id).ToList();
4392:                  }
4393:              }
4394:   
4395:              return list.Distinct().ToList();
4396:          }
4397:   
4398:          ////////////////////////////////////////////////////////////////////////////
4399:   
4400:          /// <summary>
4401:          /// 
4402:          /// </summary>
4403:          public static List<string> MgwIpListFromIdList(List<string> mgwIdList)
4404:          {
4405:              List<string> list;
4406:   
4407:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4408:              {
4409:                  if (mgwIdList.Count <= 32)
4410:                  {
4411:                      list = (from m in db.Mgws where mgwIdList.Contains(m.Id) select m.RA1).ToList();
4412:                  }
4413:                  else
4414:                  {
4415:                      list = (from m in db.Mgws join mid in mgwIdList.GetRange(0, 32) on m.Id equals mid select m.RA1).ToList();
4416:   
4417:                      list = list.Union(from m in db.Mgws join mid in mgwIdList.GetRange(32, mgwIdList.Count - 32 - 1) on m.Id equals mid select m.Id).ToList();
4418:                  }
4419:              }
4420:   
4421:              return list.Distinct().ToList();
4422:          }
4423:   
4424:          ////////////////////////////////////////////////////////////////////////////
4425:   
4426:          /// <summary>
4427:          /// 
4428:          /// </summary>
4429:          public static List<string> AsbrIdListFromImpuSipDomainList(List<string> impuSipDomainList)
4430:          {
4431:              string id;
4432:              List<string> list, asbrIdInTecAndSkbNetworkElementList;
4433:   
4434:              asbrIdInTecAndSkbNetworkElementList = new List<string>(impuSipDomainList.Count * 2);
4435:   
4436:              foreach (var isd in impuSipDomainList)
4437:              {
4438:                  id = Ia.Ngn.Cl.Model.Business.Huawei.Asbr.AsbrId(Ia.Ngn.Cl.Model.Business.Huawei.SoftX.TecNetworkElement.Domain, isd);
4439:                  asbrIdInTecAndSkbNetworkElementList.Add(id);
4440:   
4441:                  id = Ia.Ngn.Cl.Model.Business.Huawei.Asbr.AsbrId(Ia.Ngn.Cl.Model.Business.Huawei.SoftX.SkbNetworkElement.Domain, isd);
4442:                  asbrIdInTecAndSkbNetworkElementList.Add(id);
4443:              }
4444:   
4445:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4446:              {
4447:                  list = (from a in db.Asbrs where asbrIdInTecAndSkbNetworkElementList.Contains(a.Id) select a.Id).ToList();
4448:              }
4449:   
4450:              return list.Distinct().ToList();
4451:          }
4452:   
4453:          ////////////////////////////////////////////////////////////////////////////
4454:          ////////////////////////////////////////////////////////////////////////////
4455:   
4456:          /// <summary>
4457:          /// 
4458:          /// </summary>
4459:          public static List<string> AgcfEndpointIdListFromSubPartyIdList(List<string> subPartyIdList)
4460:          {
4461:              List<string> list;
4462:   
4463:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4464:              {
4465:                  list = (from sp in db.SubParties where subPartyIdList.Contains(sp.Id) select sp.AgcfEndpoint.Id).ToList();
4466:              }
4467:   
4468:              return list.Distinct().ToList();
4469:          }
4470:   
4471:          ////////////////////////////////////////////////////////////////////////////
4472:   
4473:          /// <summary>
4474:          /// 
4475:          /// </summary>
4476:          public static List<string> AgcfEndpointIdListFromPrividUserList(List<string> prividUserList)
4477:          {
4478:              List<string> list;
4479:   
4480:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4481:              {
4482:                  list = (from ep in db.AgcfEndpoints where prividUserList.Contains(ep.PrividUser) select ep.Id).ToList();
4483:              }
4484:   
4485:              return list.Distinct().ToList();
4486:          }
4487:   
4488:          ////////////////////////////////////////////////////////////////////////////
4489:   
4490:          /// <summary>
4491:          /// 
4492:          /// </summary>
4493:          public static List<string> SubPartyIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
4494:          {
4495:              List<string> list;
4496:   
4497:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4498:              {
4499:                  if (agcfEndpointIdList.Count == 1)
4500:                  {
4501:                      var agcfEndpointId = agcfEndpointIdList[0];
4502:                      list = (from sp in db.SubParties where sp.AgcfEndpoint != null && sp.AgcfEndpoint.Id == agcfEndpointId select sp.Id).ToList();
4503:                  }
4504:                  else if (agcfEndpointIdList.Count <= 32)
4505:                  {
4506:                      list = (from sp in db.SubParties 
4507:                              where agcfEndpointIdList.Contains(sp.AgcfEndpoint.Id) && sp.AgcfEndpoint != null 
4508:                              select sp.Id).ToList();
4509:                  }
4510:                  else if (agcfEndpointIdList.Count <= 64)
4511:                  {
4512:                      list = (from sp in db.SubParties join e in agcfEndpointIdList.GetRange(0, 32) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4513:                      list = list.Union(from sp in db.SubParties join e in agcfEndpointIdList.GetRange(32, agcfEndpointIdList.Count - 32 - 1) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4514:                  }
4515:                  else if (agcfEndpointIdList.Count <= 96)
4516:                  {
4517:                      list = (from sp in db.SubParties join e in agcfEndpointIdList.GetRange(0, 32) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4518:                      list = list.Union(from sp in db.SubParties join e in agcfEndpointIdList.GetRange(32, 32) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4519:                      list = list.Union(from sp in db.SubParties join e in agcfEndpointIdList.GetRange(64, agcfEndpointIdList.Count - 64 - 1) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4520:                  }
4521:                  else //if (agcfEndpointIdList.Count <= 128)
4522:                  {
4523:                      list = (from sp in db.SubParties join e in agcfEndpointIdList.GetRange(0, 32) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4524:                      list = list.Union(from sp in db.SubParties join e in agcfEndpointIdList.GetRange(32, 32) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4525:                      list = list.Union(from sp in db.SubParties join e in agcfEndpointIdList.GetRange(64, 32) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4526:                      list = list.Union(from sp in db.SubParties join e in agcfEndpointIdList.GetRange(96, agcfEndpointIdList.Count - 96 - 1) on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4527:                  }
4528:              }
4529:   
4530:              return list.Distinct().ToList();
4531:          }
4532:   
4533:          ////////////////////////////////////////////////////////////////////////////
4534:   
4535:          /// <summary>
4536:          /// 
4537:          /// </summary>
4538:          public static List<string> SubPartyIdListFromPartyIdList(List<string> partyIdList)
4539:          {
4540:              List<string> list;
4541:   
4542:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4543:              {
4544:                  if (partyIdList.Count == 1)
4545:                  {
4546:                      var partyId = partyIdList[0];
4547:                      list = (from sp in db.SubParties where sp.PartyId == partyId select sp.Id).ToList();
4548:                  }
4549:                  else if (partyIdList.Count <= 32)
4550:                  {
4551:                      list = (from sp in db.SubParties where partyIdList.Contains(sp.PartyId) select sp.Id).ToList();
4552:                  }
4553:                  else if (partyIdList.Count <= 64)
4554:                  {
4555:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
4556:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, partyIdList.Count - 32 - 1) on sp.PartyId equals pid select sp.Id).ToList();
4557:                  }
4558:                  else if (partyIdList.Count <= 96)
4559:                  {
4560:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
4561:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
4562:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(64, partyIdList.Count - 64 - 1) on sp.PartyId equals pid select sp.Id).ToList();
4563:                  }
4564:                  else //if (agcfEndpointIdList.Count <= 128)
4565:                  {
4566:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
4567:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
4568:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(64, 32) on sp.PartyId equals pid select sp.Id).ToList();
4569:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(96, partyIdList.Count - 96 - 1) on sp.PartyId equals pid select sp.Id).ToList();
4570:                  }
4571:              }
4572:   
4573:              return list.Distinct().ToList();
4574:          }
4575:   
4576:          ////////////////////////////////////////////////////////////////////////////
4577:   
4578:          /// <summary>
4579:          /// 
4580:          /// </summary>
4581:          public static List<string> SubscriberIdListFromSubPartyIdList(List<string> subPartyIdList)
4582:          {
4583:              List<string> list;
4584:   
4585:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4586:              {
4587:                  if (subPartyIdList.Count == 1)
4588:                  {
4589:                      var subPartyId = subPartyIdList[0];
4590:                      list = (from s in db.Subscribers where s.SubParty != null && s.SubParty.Id == subPartyId select s.Id).ToList();
4591:                  }
4592:                  else if (subPartyIdList.Count <= 32)
4593:                  {
4594:                      list = (from s in db.Subscribers where subPartyIdList.Contains(s.SubParty.Id) select s.Id).ToList();
4595:                  }
4596:                  else if (subPartyIdList.Count <= 64)
4597:                  {
4598:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4599:                      list = list.Union(from s in db.Subscribers join spid in subPartyIdList.GetRange(32, subPartyIdList.Count - 32 - 1) on s.SubParty.Id equals spid select s.Id).ToList();
4600:                  }
4601:                  else if (subPartyIdList.Count <= 96)
4602:                  {
4603:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4604:                      list = list.Union(from s in db.Subscribers join spid in subPartyIdList.GetRange(32, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4605:                      list = list.Union(from s in db.Subscribers join spid in subPartyIdList.GetRange(64, subPartyIdList.Count - 64 - 1) on s.SubParty.Id equals spid select s.Id).ToList();
4606:                  }
4607:                  else //if (subPartyIdList.Count <= 128)
4608:                  {
4609:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4610:                      list = list.Union(from s in db.Subscribers join spid in subPartyIdList.GetRange(32, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4611:                      list = list.Union(from s in db.Subscribers join spid in subPartyIdList.GetRange(64, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4612:                      list = list.Union(from s in db.Subscribers join spid in subPartyIdList.GetRange(96, subPartyIdList.Count - 96 - 1) on s.SubParty.Id equals spid select s.Id).ToList();
4613:                  }
4614:              }
4615:   
4616:              return list.Distinct().ToList();
4617:          }
4618:   
4619:          ////////////////////////////////////////////////////////////////////////////
4620:   
4621:          /// <summary>
4622:          /// 
4623:          /// </summary>
4624:          public static List<string> SubscriberIdListFromPartyIdList(List<string> partyIdList)
4625:          {
4626:              List<string> list;
4627:   
4628:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4629:              {
4630:                  if (partyIdList.Count == 1)
4631:                  {
4632:                      var partyId = partyIdList[0];
4633:                      list = (from s in db.Subscribers where s.PartyId == partyId select s.Id).ToList();
4634:                  }
4635:                  else if (partyIdList.Count <= 32)
4636:                  {
4637:                      list = (from s in db.Subscribers where partyIdList.Contains(s.PartyId) select s.Id).ToList();
4638:                  }
4639:                  else if (partyIdList.Count <= 64)
4640:                  {
4641:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
4642:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, partyIdList.Count - 32 - 1) on s.PartyId equals pid select s.Id).ToList();
4643:                  }
4644:                  else if (partyIdList.Count <= 96)
4645:                  {
4646:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
4647:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
4648:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(64, partyIdList.Count - 64 - 1) on s.PartyId equals pid select s.Id).ToList();
4649:                  }
4650:                  else //if (subPartyIdList.Count <= 128)
4651:                  {
4652:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
4653:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
4654:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(64, 32) on s.PartyId equals pid select s.Id).ToList();
4655:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(96, partyIdList.Count - 96 - 1) on s.PartyId equals pid select s.Id).ToList();
4656:                  }
4657:              }
4658:   
4659:              return list.Distinct().ToList();
4660:          }
4661:   
4662:          ////////////////////////////////////////////////////////////////////////////
4663:          ////////////////////////////////////////////////////////////////////////////   
4664:   
4665:          /// <summary>
4666:          /// 
4667:          /// </summary>
4668:          public static void SynchronizeNumberFormatLists(ref List<string> partyIdList, ref List<string> prividUserList, ref List<string> serviceList, ref List<int> numberList, ref List<long> serviceLongList, ref List<string> impuSipDomainList, ref List<string> sipUserNameList, ref List<string> serviceWithCountryCodeList, ref List<string> serviceIdList)
4669:          {
4670:              int number;
4671:              long numberWithCountryCode;
4672:              string service, impuSipDomain, sipUserName, serviceWithCountryCode, partyId, prividUser;
4673:   
4674:              foreach (var pi in partyIdList)
4675:              {
4676:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(pi);
4677:   
4678:                  if (!string.IsNullOrEmpty(service))
4679:                  {
4680:                      number = int.Parse(service);
4681:                      numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
4682:                      impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
4683:                      sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
4684:                      serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
4685:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
4686:                      prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
4687:   
4688:                      serviceList.Add(service);
4689:                      numberList.Add(number);
4690:                      serviceLongList.Add(numberWithCountryCode);
4691:                      impuSipDomainList.Add(impuSipDomain);
4692:                      sipUserNameList.Add(sipUserName);
4693:                      serviceWithCountryCodeList.Add(serviceWithCountryCode);
4694:                      //partyIdList.Add(partyId);
4695:                      prividUserList.Add(prividUser);
4696:                  }
4697:              }
4698:   
4699:              foreach (var s in serviceList)
4700:              {
4701:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s);
4702:   
4703:                  if (!string.IsNullOrEmpty(service))
4704:                  {
4705:                      number = int.Parse(service);
4706:                      numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
4707:                      impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
4708:                      sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
4709:                      serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
4710:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
4711:                      prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
4712:   
4713:                      //serviceList.Add(service);
4714:                      numberList.Add(number);
4715:                      serviceLongList.Add(numberWithCountryCode);
4716:                      impuSipDomainList.Add(impuSipDomain);
4717:                      sipUserNameList.Add(sipUserName);
4718:                      serviceWithCountryCodeList.Add(serviceWithCountryCode);
4719:                      partyIdList.Add(partyId);
4720:                      prividUserList.Add(prividUser);
4721:                  }
4722:              }
4723:   
4724:              serviceList = serviceList.Distinct().ToList();
4725:              numberList = numberList.Distinct().ToList();
4726:              serviceLongList = serviceLongList.Distinct().ToList();
4727:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
4728:              sipUserNameList = sipUserNameList.Distinct().ToList();
4729:              serviceWithCountryCodeList = serviceWithCountryCodeList.Distinct().ToList();
4730:              partyIdList = partyIdList.Distinct().ToList();
4731:              prividUserList = prividUserList.Distinct().ToList();
4732:   
4733:              serviceIdList = Ia.Ngn.Cl.Model.Business.Service.ServiceListToServiceIdListForAllServiceTypes(serviceList);
4734:          }
4735:   
4736:          ////////////////////////////////////////////////////////////////////////////   
4737:   
4738:          /// <summary>
4739:          /// 
4740:          /// </summary>
4741:          public static void UpdateServiceListFromServiceRequestServiceIdOrService2IdList(List<string> serviceRequestServiceIdListOrService2IdList, ref List<string> serviceList)
4742:          {
4743:              string service;
4744:   
4745:              foreach (var si in serviceRequestServiceIdListOrService2IdList)
4746:              {
4747:                  service = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceIdToService(si);
4748:   
4749:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4750:              }
4751:   
4752:              serviceList = serviceList.Distinct().ToList();
4753:          }
4754:   
4755:          ////////////////////////////////////////////////////////////////////////////   
4756:   
4757:          /// <summary>
4758:          /// 
4759:          /// </summary>
4760:          public static void CollectServiceListFromEmsOntSipInfoListAndEmsVoipPstnUserListByEmsOntIdList(List<string> emsOntIdList, ref List<string> serviceList)
4761:          {
4762:              string service;
4763:              List<string> emsOntSipInfoSipUserNameList, emsVoipPstnUserDnList;
4764:   
4765:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4766:              {
4767:                  emsOntSipInfoSipUserNameList = (from eosi in db.EmsOntSipInfoes
4768:                                                  where emsOntIdList.Contains(eosi.EmsOnt.Id)
4769:                                                  select eosi.SIPUSERNAME).Distinct().ToList();
4770:   
4771:                  emsVoipPstnUserDnList = (from evpu in db.EmsVoipPstnUsers
4772:                                           where emsOntIdList.Contains(evpu.EmsOnt.Id)
4773:                                           select evpu.DN).Distinct().ToList();
4774:              }
4775:   
4776:              foreach (var eosisun in emsOntSipInfoSipUserNameList)
4777:              {
4778:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(eosisun);
4779:   
4780:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4781:              }
4782:   
4783:              foreach (var evpud in emsVoipPstnUserDnList)
4784:              {
4785:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(evpud);
4786:   
4787:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4788:              }
4789:   
4790:              serviceList = serviceList.Distinct().ToList();
4791:          }
4792:   
4793:          ////////////////////////////////////////////////////////////////////////////   
4794:   
4795:          /// <summary>
4796:          /// 
4797:          /// </summary>
4798:          public static void CollectServiceListFromAgcfEndpointList(List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList, ref List<string> serviceList)
4799:          {
4800:              string service;
4801:   
4802:              foreach (var ep in agcfEndpointList)
4803:              {
4804:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(ep.PrividUser);
4805:   
4806:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4807:              }
4808:   
4809:              serviceList = serviceList.Distinct().ToList();
4810:          }
4811:   
4812:          ////////////////////////////////////////////////////////////////////////////   
4813:   
4814:          /// <summary>
4815:          /// 
4816:          /// </summary>
4817:          public static void CollectServiceListFromSubscriberList(List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList, ref List<string> serviceList)
4818:          {
4819:              string service;
4820:   
4821:              foreach (var s in subscriberList)
4822:              {
4823:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s.PartyId);
4824:   
4825:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4826:              }
4827:   
4828:              serviceList = serviceList.Distinct().ToList();
4829:          }
4830:   
4831:          ////////////////////////////////////////////////////////////////////////////
4832:          ////////////////////////////////////////////////////////////////////////////   
4833:      }
4834:   
4835:      ////////////////////////////////////////////////////////////////////////////
4836:      ////////////////////////////////////////////////////////////////////////////   
4837:  }