Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » Find

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

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

   1:  using System;
   2:  using System.Text.RegularExpressions;
   3:  using System.Data;
   4:  using System.Data.Entity;
   5:  using System.Collections.Generic;
   6:  using System.Linq;
   7:   
   8:  namespace Ia.Ngn.Cl.Model.Data.Maintenance
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Find subscriber and network information support class for the Next Generation Network data model
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  18:      ///
  19:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  20:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  21:      ///
  22:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  23:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  24:      /// 
  25:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  26:      /// 
  27:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  28:      /// </remarks> 
  29:      public class Find
  30:      {
  31:          ////////////////////////////////////////////////////////////////////////////
  32:   
  33:          /// <summary>
  34:          ///
  35:          /// </summary>
  36:          public Find() { }
  37:   
  38:          ////////////////////////////////////////////////////////////////////////////
  39:   
  40:          /// <summary>
  41:          /// 
  42:          /// </summary>
  43:          public static List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> ServiceRequestServiceList(List<string> serviceRequestServiceIdList)
  44:          {
  45:              List<Ia.Ngn.Cl.Model.ServiceRequestService> inList;
  46:              List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> list;
  47:   
  48:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  49:              {
  50:                  if (serviceRequestServiceIdList.Count <= 32)
  51:                  {
  52:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList on srs.Id equals srsid select srs).ToList();
  53:                  }
  54:                  else if (serviceRequestServiceIdList.Count <= 64)
  55:                  {
  56:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  57:                      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();
  58:                  }
  59:                  else if (serviceRequestServiceIdList.Count <= 96)
  60:                  {
  61:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  62:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  63:                      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();
  64:                  }
  65:                  else if (serviceRequestServiceIdList.Count <= 128)
  66:                  {
  67:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  68:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  69:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  70:                      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();
  71:                  }
  72:                  else if (serviceRequestServiceIdList.Count <= 160)
  73:                  {
  74:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  75:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  76:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  77:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  78:                      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();
  79:                  }
  80:                  else if (serviceRequestServiceIdList.Count <= 192)
  81:                  {
  82:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  83:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  84:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  85:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  86:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
  87:                      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();
  88:                  }
  89:                  else if (serviceRequestServiceIdList.Count <= 224)
  90:                  {
  91:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  92:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  93:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  94:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  95:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
  96:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, 32) on srs.Id equals srsid select srs).ToList();
  97:                      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();
  98:                  }
  99:                  else //if (serviceRequestServiceIdList.Count <= 256)
 100:                  {
 101:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
 102:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
 103:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
 104:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
 105:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
 106:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, 32) on srs.Id equals srsid select srs).ToList();
 107:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(192, 32) on srs.Id equals srsid select srs).ToList();
 108:                      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();
 109:                  }
 110:   
 111:                  list = (from srs in inList
 112:                          select new Ia.Ngn.Cl.Model.Ui.ServiceRequestService()
 113:                          {
 114:                              Id = srs.Id,
 115:                              AbbriviatedCalling = srs.AbbriviatedCalling,
 116:                              Access = srs.Access,
 117:                              AlarmCall = srs.AlarmCall,
 118:                              CallBarring = srs.CallBarring,
 119:                              CallerId = srs.CallerId,
 120:                              CallForwarding = srs.CallForwarding,
 121:                              CallWaiting = srs.CallWaiting,
 122:                              ConferenceCall = srs.ConferenceCall,
 123:                              Created = srs.Created,
 124:                              InternationalCalling = srs.InternationalCalling,
 125:                              InternationalCallingUserControlled = srs.InternationalCallingUserControlled,
 126:                              LastRequestDateTime = srs.LastRequestDateTime,
 127:                              Provisioned = srs.Provisioned,
 128:                              Service = srs.Service,
 129:                              ServiceType = srs.ServiceType,
 130:                              ServiceSuspension = srs.ServiceSuspension,
 131:                              Type = srs.Type,
 132:                              Updated = srs.Updated
 133:                          }).ToList();
 134:   
 135:                  return list.Distinct().ToList();
 136:              }
 137:          }
 138:   
 139:          ////////////////////////////////////////////////////////////////////////////
 140:   
 141:          /// <summary>
 142:          /// 
 143:          /// </summary>
 144:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestList(List<int> serviceRequestIdList)
 145:          {
 146:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 147:   
 148:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 149:              {
 150:                  if (serviceRequestIdList.Count <= 32)
 151:                  {
 152:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList on sr.Id equals srid select sr).ToList();
 153:                  }
 154:                  else if (serviceRequestIdList.Count <= 64)
 155:                  {
 156:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 157:                      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();
 158:                  }
 159:                  else if (serviceRequestIdList.Count <= 96)
 160:                  {
 161:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 162:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 163:                      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();
 164:                  }
 165:                  else if (serviceRequestIdList.Count <= 128)
 166:                  {
 167:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 168:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 169:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 170:                      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();
 171:                  }
 172:                  else if (serviceRequestIdList.Count <= 160)
 173:                  {
 174:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 175:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 176:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 177:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 178:                      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();
 179:                  }
 180:                  else if (serviceRequestIdList.Count <= 192)
 181:                  {
 182:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 183:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 184:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 185:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 186:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 187:                      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();
 188:                  }
 189:                  else if (serviceRequestIdList.Count <= 224)
 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, 32) on sr.Id equals srid select sr).ToList();
 197:                      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();
 198:                  }
 199:                  else if (serviceRequestIdList.Count <= 256)
 200:                  {
 201:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 202:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 203:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 204:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 205:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 206:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 207:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 208:                      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();
 209:                  }
 210:                  else if (serviceRequestIdList.Count <= 288)
 211:                  {
 212:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 213:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 214:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 215:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 216:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 217:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 218:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 219:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 220:                      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();
 221:                  }
 222:                  else if (serviceRequestIdList.Count <= 320)
 223:                  {
 224:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 225:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 226:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 227:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 228:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 229:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 230:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 231:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 232:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 233:                      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();
 234:                  }
 235:                  else if (serviceRequestIdList.Count <= 352)
 236:                  {
 237:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 238:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 239:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 240:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 241:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 242:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 243:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 244:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 245:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 246:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 247:                      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();
 248:                  }
 249:                  else if (serviceRequestIdList.Count <= 384)
 250:                  {
 251:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 252:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 253:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 254:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 255:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 256:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 257:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 258:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 259:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 260:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 261:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 262:                      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();
 263:                  }
 264:                  else if (serviceRequestIdList.Count <= 416)
 265:                  {
 266:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 267:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 268:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 269:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 270:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 271:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 272:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 273:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 274:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 275:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 276:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 277:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 278:                      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();
 279:                  }
 280:                  else if (serviceRequestIdList.Count <= 448)
 281:                  {
 282:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 283:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 284:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 285:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 286:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 287:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 288:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 289:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 290:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 291:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 292:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 293:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 294:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 295:                      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();
 296:                  }
 297:                  else if (serviceRequestIdList.Count <= 480)
 298:                  {
 299:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 300:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 301:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 302:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 303:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 304:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 305:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 306:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 307:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 308:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 309:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 310:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 311:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 312:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 313:                      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();
 314:                  }
 315:                  else if (serviceRequestIdList.Count <= 512)
 316:                  {
 317:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 318:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 319:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 320:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 321:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 322:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 323:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 324:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 325:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 326:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 327:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 328:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 329:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 330:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 331:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 332:                      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();
 333:                  }
 334:                  else if (serviceRequestIdList.Count <= 544)
 335:                  {
 336:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 337:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 338:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 339:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 340:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 341:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 342:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 343:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 344:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 345:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 346:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 347:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 348:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 349:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 350:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 351:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 352:                      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();
 353:                  }
 354:                  else //if (serviceIdList.Count <= ??)
 355:                  {
 356:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 357:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 358:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 359:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 360:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 361:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 362:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 363:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 364:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 365:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 366:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 367:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 368:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 369:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 370:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 371:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 372:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(512, 32) on sr.Id equals srid select sr).ToList();
 373:                      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();
 374:                  }
 375:              }
 376:   
 377:              return list.Distinct().ToList();
 378:          }
 379:   
 380:          ////////////////////////////////////////////////////////////////////////////
 381:   
 382:          /// <summary>
 383:          /// 
 384:          /// </summary>
 385:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerId(int customerId, int maxNumberOfResults)
 386:          {
 387:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 388:   
 389:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 390:              {
 391:                  list = (from sr in db.ServiceRequests where sr.CustomerId == customerId select sr).Take(maxNumberOfResults).ToList();
 392:              }
 393:   
 394:              return list.Distinct().ToList();
 395:          }
 396:   
 397:          ////////////////////////////////////////////////////////////////////////////
 398:   
 399:          /// <summary>
 400:          /// 
 401:          /// </summary>
 402:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerName(string customerName, int maxNumberOfResults)
 403:          {
 404:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 405:   
 406:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 407:              {
 408:                  list = (from sr in db.ServiceRequests where sr.CustomerName == customerName || sr.CustomerName.Contains(customerName) select sr).Take(maxNumberOfResults).ToList();
 409:              }
 410:   
 411:              return list.Distinct().ToList();
 412:          }
 413:   
 414:          ////////////////////////////////////////////////////////////////////////////
 415:   
 416:          /// <summary>
 417:          /// 
 418:          /// </summary>
 419:          public static List<Ia.Ngn.Cl.Model.ServiceRequestType> ServiceRequestTypeList(List<int> serviceRequestTypeIdList)
 420:          {
 421:              List<Ia.Ngn.Cl.Model.ServiceRequestType> list;
 422:   
 423:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 424:              {
 425:                  if (serviceRequestTypeIdList.Count <= 32)
 426:                  {
 427:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList on srt.Id equals srtid select srt).ToList();
 428:                  }
 429:                  else if (serviceRequestTypeIdList.Count <= 64)
 430:                  {
 431:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 432:                      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();
 433:                  }
 434:                  else if (serviceRequestTypeIdList.Count <= 96)
 435:                  {
 436:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 437:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 438:                      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();
 439:                  }
 440:                  else if (serviceRequestTypeIdList.Count <= 128)
 441:                  {
 442:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 443:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 444:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 445:                      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();
 446:                  }
 447:                  else if (serviceRequestTypeIdList.Count <= 160)
 448:                  {
 449:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 450:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 451:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 452:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 453:                      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();
 454:                  }
 455:                  else if (serviceRequestTypeIdList.Count <= 192)
 456:                  {
 457:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 458:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 459:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 460:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 461:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 462:                      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();
 463:                  }
 464:                  else if (serviceRequestTypeIdList.Count <= 224)
 465:                  {
 466:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 467:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 468:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 469:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 470:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 471:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 472:                      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();
 473:                  }
 474:                  else if (serviceRequestTypeIdList.Count <= 256)
 475:                  {
 476:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 477:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 478:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 479:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 480:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 481:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 482:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 483:                      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();
 484:                  }
 485:                  else if (serviceRequestTypeIdList.Count <= 288)
 486:                  {
 487:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 488:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 489:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 490:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 491:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 492:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 493:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 494:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 495:                      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();
 496:                  }
 497:                  else if (serviceRequestTypeIdList.Count <= 320)
 498:                  {
 499:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 500:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 501:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 502:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 503:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 504:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 505:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 506:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 507:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 508:                      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();
 509:                  }
 510:                  else if (serviceRequestTypeIdList.Count <= 352)
 511:                  {
 512:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 513:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 514:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 515:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 516:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 517:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 518:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 519:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 520:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 521:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 522:                      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();
 523:                  }
 524:                  else if (serviceRequestTypeIdList.Count <= 384)
 525:                  {
 526:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 527:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 528:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 529:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 530:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 531:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 532:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 533:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 534:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 535:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 536:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 537:                      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();
 538:                  }
 539:                  else if (serviceRequestTypeIdList.Count <= 416)
 540:                  {
 541:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 542:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 543:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 544:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 545:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 546:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 547:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 548:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 549:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 550:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 551:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 552:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 553:                      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();
 554:                  }
 555:                  else if (serviceRequestTypeIdList.Count <= 448)
 556:                  {
 557:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 558:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 559:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 560:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 561:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 562:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 563:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 564:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 565:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 566:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 567:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 568:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 569:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 570:                      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();
 571:                  }
 572:                  else if (serviceRequestTypeIdList.Count <= 480)
 573:                  {
 574:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 575:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 576:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 577:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 578:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 579:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 580:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 581:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 582:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 583:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 584:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 585:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 586:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 587:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 588:                      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();
 589:                  }
 590:                  else if (serviceRequestTypeIdList.Count <= 512)
 591:                  {
 592:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 593:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 594:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 595:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 596:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 597:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 598:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 599:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 600:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 601:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 602:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 603:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 604:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 605:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 606:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 607:                      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();
 608:                  }
 609:                  else if (serviceRequestTypeIdList.Count <= 544)
 610:                  {
 611:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 612:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 613:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 614:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 615:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 616:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 617:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 618:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 619:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 620:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 621:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 622:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 623:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 624:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 625:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 626:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 627:                      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();
 628:                  }
 629:                  else if (serviceRequestTypeIdList.Count <= 576)
 630:                  {
 631:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 632:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 633:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 634:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 635:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 636:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 637:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 638:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 639:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 640:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 641:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 642:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 643:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 644:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 645:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 646:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 647:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 648:                      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();
 649:                  }
 650:                  else if (serviceRequestTypeIdList.Count <= 608)
 651:                  {
 652:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 653:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 654:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 655:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 656:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 657:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 658:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 659:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 660:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 661:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 662:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 663:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 664:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 665:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 666:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 667:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 668:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 669:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 670:                      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();
 671:                  }
 672:                  else if (serviceRequestTypeIdList.Count <= 640)
 673:                  {
 674:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 675:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 676:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 677:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 678:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 679:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 680:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 681:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 682:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 683:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 684:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 685:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 686:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 687:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 688:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 689:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 690:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 691:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 692:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 693:                      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();
 694:                  }
 695:                  else if (serviceRequestTypeIdList.Count <= 672)
 696:                  {
 697:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 698:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 699:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 700:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 701:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 702:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 703:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 704:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 705:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 706:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 707:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 708:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 709:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 710:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 711:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 712:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 713:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 714:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 715:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 716:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 717:                      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();
 718:                  }
 719:                  else if (serviceRequestTypeIdList.Count <= 704)
 720:                  {
 721:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 722:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 723:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 724:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 725:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 726:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 727:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 728:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 729:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 730:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 731:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 732:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 733:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 734:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 735:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 736:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 737:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 738:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 739:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 740:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 741:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
 742:                      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();
 743:                  }
 744:                  else if (serviceRequestTypeIdList.Count <= 736)
 745:                  {
 746:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 747:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 748:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 749:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 750:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 751:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 752:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 753:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 754:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 755:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 756:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 757:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 758:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 759:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 760:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 761:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 762:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 763:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 764:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 765:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 766:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
 767:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
 768:                      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();
 769:                  }
 770:                  else if (serviceRequestTypeIdList.Count <= 768)
 771:                  {
 772:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 773:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 774:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 775:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 776:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 777:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 778:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 779:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 780:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 781:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 782:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 783:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 784:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 785:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 786:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 787:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 788:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 789:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 790:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 791:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 792:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
 793:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
 794:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
 795:                      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();
 796:                  }
 797:                  else if (serviceRequestTypeIdList.Count <= 800)
 798:                  {
 799:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 800:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 801:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 802:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 803:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 804:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 805:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 806:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 807:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 808:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 809:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 810:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 811:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 812:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 813:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 814:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 815:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 816:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 817:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 818:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 819:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
 820:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
 821:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
 822:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
 823:                      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();
 824:                  }
 825:                  else //if (serviceRequestTypeIdList.Count <= 832)
 826:                  {
 827:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 828:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 829:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 830:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 831:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 832:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 833:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 834:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 835:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 836:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 837:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 838:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 839:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 840:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 841:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 842:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 843:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 844:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 845:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 846:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 847:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
 848:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
 849:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
 850:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
 851:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(768, 32) on srt.Id equals srtid select srt).ToList();
 852:                      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();
 853:                  }
 854:              }
 855:   
 856:              return list.Distinct().ToList();
 857:          }
 858:   
 859:          ////////////////////////////////////////////////////////////////////////////
 860:   
 861:          /// <summary>
 862:          /// 
 863:          /// </summary>
 864:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> AgcfGatewayRecordList(List<int> agcfGatewayRecordIdList)
 865:          {
 866:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> list;
 867:   
 868:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 869:              {
 870:                  if (agcfGatewayRecordIdList.Count <= 32)
 871:                  {
 872:                      list = (from gr in db.AgcfGatewayRecords
 873:                              join grid in agcfGatewayRecordIdList on gr.Id equals grid
 874:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
 875:                              {
 876:                                  Id = gr.Id,
 877:                                  GwId = gr.GwId,
 878:                                  GwUserId = gr.GwUserId,
 879:                                  GwDomain = gr.GwDomain,
 880:                                  GwName = gr.GwName,
 881:                                  IP1 = gr.IP1,
 882:                                  IP2 = gr.IP2,
 883:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
 884:                                  IsPrimary = gr.IsPrimary,
 885:                                  Created = gr.Created,
 886:                                  Updated = gr.Updated
 887:                              }).ToList();
 888:                  }
 889:                  else
 890:                  {
 891:                      list = (from gr in db.AgcfGatewayRecords
 892:                              join grid in agcfGatewayRecordIdList.GetRange(0, 32) on gr.Id equals grid
 893:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
 894:                              {
 895:                                  Id = gr.Id,
 896:                                  GwId = gr.GwId,
 897:                                  GwUserId = gr.GwUserId,
 898:                                  GwDomain = gr.GwDomain,
 899:                                  GwName = gr.GwName,
 900:                                  IP1 = gr.IP1,
 901:                                  IP2 = gr.IP2,
 902:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
 903:                                  IsPrimary = gr.IsPrimary,
 904:                                  Created = gr.Created,
 905:                                  Updated = gr.Updated
 906:                              }).ToList();
 907:   
 908:                      list = list.Union(from gr in db.AgcfGatewayRecords
 909:                                        join grid in agcfGatewayRecordIdList.GetRange(32, agcfGatewayRecordIdList.Count - 32 - 1) on gr.Id equals grid
 910:                                        select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
 911:                                        {
 912:                                            Id = gr.Id,
 913:                                            GwId = gr.GwId,
 914:                                            GwUserId = gr.GwUserId,
 915:                                            GwDomain = gr.GwDomain,
 916:                                            GwName = gr.GwName,
 917:                                            IP1 = gr.IP1,
 918:                                            IP2 = gr.IP2,
 919:                                            MateExternalIPAddr = gr.MateExternalIPAddr,
 920:                                            IsPrimary = gr.IsPrimary,
 921:                                            Created = gr.Created,
 922:                                            Updated = gr.Updated
 923:                                        }).ToList();
 924:                  }
 925:              }
 926:   
 927:              return list.Distinct().ToList();
 928:          }
 929:   
 930:          ////////////////////////////////////////////////////////////////////////////
 931:   
 932:          /// <summary>
 933:          /// 
 934:          /// </summary>
 935:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> AgcfEndpointList(List<string> agcfEndpointIdList)
 936:          {
 937:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> list;
 938:   
 939:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 940:              {
 941:                  list = (from e in db.AgcfEndpoints
 942:                          join eid in agcfEndpointIdList on e.Id equals eid
 943:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint()
 944:                          {
 945:                              Id = e.Id,
 946:                              PrividUser = e.PrividUser,
 947:                              GwId = e.GwId,
 948:                              Dn = e.Dn,
 949:                              FlatTermID = e.FlatTermID,
 950:                              CallHoldLc = e.CallHoldLc,
 951:                              CallWaitingLc = e.CallWaitingLc,
 952:                              CallToggleLc = e.CallToggleLc,
 953:                              ThreeWayCallLc = e.ThreeWayCallLc,
 954:                              McidLc = e.McidLc,
 955:                              Password = e.Password,
 956:                              CallTransferLc = e.CallTransferLc,
 957:                              Created = e.Created,
 958:                              Updated = e.Updated
 959:                          }).ToList();
 960:              }
 961:   
 962:              return list.Distinct().ToList();
 963:          }
 964:   
 965:          ////////////////////////////////////////////////////////////////////////////
 966:   
 967:          /// <summary>
 968:          /// 
 969:          /// </summary>
 970:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> EmsOntList(List<string> emsOntIdList)
 971:          {
 972:              List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> list;
 973:   
 974:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 975:              {
 976:                  list = (from eo in db.EmsOnts
 977:                          join oid in emsOntIdList on eo.Id equals oid
 978:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt()
 979:                          {
 980:                              Id = eo.Id,
 981:                              Access = eo.Access,
 982:                              ALIAS = eo.ALIAS,
 983:                              AUTH = eo.AUTH,
 984:                              CAPABPROF = eo.CAPABPROF,
 985:                              Created = eo.Created,
 986:                              DEV = eo.DEV,
 987:                              DID = eo.DID,
 988:                              EQUIPMENTID = eo.EQUIPMENTID,
 989:                              FN = eo.FN,
 990:                              GATE = eo.GATE,
 991:                              IP = eo.IP,
 992:                              MAINSOFTVERSION = eo.MAINSOFTVERSION,
 993:                              NAME = eo.NAME,
 994:                              ONTID = eo.ONTID,
 995:                              PN = eo.PN,
 996:                              ROUTEIP = eo.ROUTEIP,
 997:                              SERIALNUM = eo.SERIALNUM,
 998:                              SN = eo.SN,
 999:                              Updated = eo.Updated,
1000:                              VENDORID = eo.VENDORID,
1001:                              VLAN = eo.VLAN
1002:                          }).ToList();
1003:              }
1004:   
1005:              return list.Distinct().ToList();
1006:          }
1007:   
1008:          ////////////////////////////////////////////////////////////////////////////
1009:   
1010:          /// <summary>
1011:          /// 
1012:          /// </summary>
1013:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdList(List<string> emsOntIdList)
1014:          {
1015:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1016:   
1017:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1018:              {
1019:                  list = (from eosi in db.EmsOntSipInfos join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid select eosi).Include(o => o.EmsOnt).ToList();
1020:              }
1021:   
1022:              return list.Distinct().ToList();
1023:          }
1024:   
1025:          ////////////////////////////////////////////////////////////////////////////
1026:   
1027:          /// <summary>
1028:          /// 
1029:          /// </summary>
1030:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdList(List<string> emsOntIdList)
1031:          {
1032:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1033:   
1034:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1035:              {
1036:                  list = (from evpu in db.EmsVoipPstnUsers join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid select evpu).Include(o => o.EmsOnt).ToList();
1037:              }
1038:   
1039:              return list.Distinct().ToList();
1040:          }
1041:   
1042:          ////////////////////////////////////////////////////////////////////////////
1043:   
1044:          /// <summary>
1045:          /// 
1046:          /// </summary>
1047:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOnt> ServiceRequestOntList(List<string> serviceRequestOntIdList)
1048:          {
1049:              List<Ia.Ngn.Cl.Model.ServiceRequestOnt> list;
1050:   
1051:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1052:              {
1053:                  list = (from sro in db.ServiceRequestOnts join sroid in serviceRequestOntIdList on sro.Id equals sroid select sro).ToList();
1054:              }
1055:   
1056:              return list.Distinct().ToList();
1057:          }
1058:   
1059:          ////////////////////////////////////////////////////////////////////////////
1060:   
1061:          /// <summary>
1062:          /// 
1063:          /// </summary>
1064:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> ServiceRequestOntDetailList(List<string> serviceRequestOntIdList)
1065:          {
1066:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1067:   
1068:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1069:              {
1070:                  list = (from srod in db.ServiceRequestOntDetails join sroid in serviceRequestOntIdList on srod.ServiceRequestOnt.Id equals sroid select srod).ToList();
1071:              }
1072:   
1073:              return list.Distinct().ToList();
1074:          }
1075:   
1076:          ////////////////////////////////////////////////////////////////////////////
1077:   
1078:          /// <summary>
1079:          /// 
1080:          /// </summary>
1081:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntList(List<string> nddOntIdList)
1082:          {
1083:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
1084:   
1085:              list = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdList on n.Id equals nid select n).ToList();
1086:   
1087:              return list.Distinct().ToList();
1088:          }
1089:   
1090:          ////////////////////////////////////////////////////////////////////////////
1091:   
1092:          /// <summary>
1093:          /// 
1094:          /// </summary>
1095:          public static List<Ia.Ngn.Cl.Model.Access> AccessList(List<string> accessIdList)
1096:          {
1097:              List<Ia.Ngn.Cl.Model.Access> list;
1098:   
1099:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1100:              {
1101:                  list = (from a in db.Accesses join aid in accessIdList on a.Id equals aid select a).ToList();
1102:              }
1103:   
1104:              return list.Distinct().ToList();
1105:          }
1106:   
1107:          ////////////////////////////////////////////////////////////////////////////
1108:   
1109:          /// <summary>
1110:          /// 
1111:          /// </summary>
1112:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAddress(int kuwaitNgnAreaId, string block, int street, int premisesOld, int premisesNew)
1113:          {
1114:              string streetString, premisesOldString, premisesNewString;
1115:              List<Ia.Ngn.Cl.Model.Access> list;
1116:   
1117:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1118:              {
1119:                  //oltIdList = kuwaitNgnArea.Site.Routers.SelectMany(v => v.Odfs.SelectMany(u => u.Olts.Select(w => w.Id))).ToList();
1120:   
1121:                  streetString = street.ToString();
1122:                  premisesOldString = premisesOld.ToString();
1123:                  premisesNewString = premisesNew.ToString();
1124:   
1125:                  list = (from a in db.Accesses
1126:                              //join oid in oltIdList on a.Olt equals oid
1127:                          where
1128:                          a.AreaId == kuwaitNgnAreaId
1129:                          &&
1130:                          (
1131:                          a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString
1132:                          || a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && premisesNew == 0
1133:                          || a.Block == block && a.Street == streetString && a.PremisesNew == premisesNewString && premisesOld == 0
1134:                          || a.Block == block && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString && street == 0
1135:                          || a.Block == block && a.PremisesOld == premisesOldString && street == 0 && premisesNew == 0
1136:                          || a.Block == block && a.PremisesNew == premisesNewString && street == 0 && premisesOld == 0
1137:                          || a.Block == block && a.Street == streetString && premisesOld == 0 && premisesNew == 0
1138:                          || a.Block == block && street == 0 && premisesOld == 0 && premisesNew == 0
1139:                          )
1140:                          select a).ToList();
1141:              }
1142:   
1143:              return list.Distinct().ToList();
1144:          }
1145:   
1146:          ////////////////////////////////////////////////////////////////////////////
1147:   
1148:          /// <summary>
1149:          /// 
1150:          /// </summary>
1151:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAreaAndBlock(int kuwaitNgnAreaId, string block)
1152:          {
1153:              List<Ia.Ngn.Cl.Model.Access> list;
1154:   
1155:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1156:              {
1157:                  list = (from a in db.Accesses where a.AreaId == kuwaitNgnAreaId && a.Block == block select a).ToList();
1158:              }
1159:   
1160:              return list.Distinct().ToList();
1161:          }
1162:   
1163:          ////////////////////////////////////////////////////////////////////////////
1164:   
1165:          /// <summary>
1166:          /// 
1167:          /// </summary>
1168:          public static List<Ia.Ngn.Cl.Model.ServiceInitialState> ServiceInitialStateList(List<string> serviceInitialStateIdList)
1169:          {
1170:              List<Ia.Ngn.Cl.Model.ServiceInitialState> list;
1171:   
1172:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1173:              {
1174:                  if (serviceInitialStateIdList.Count <= 32)
1175:                  {
1176:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList on sis.Id equals sisid select sis).ToList();
1177:                  }
1178:                  else if (serviceInitialStateIdList.Count <= 64)
1179:                  {
1180:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1181:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, serviceInitialStateIdList.Count - 32 - 1) on sis.Id equals sisid select sis).ToList();
1182:                  }
1183:                  else if (serviceInitialStateIdList.Count <= 96)
1184:                  {
1185:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1186:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1187:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, serviceInitialStateIdList.Count - 64 - 1) on sis.Id equals sisid select sis).ToList();
1188:                  }
1189:                  else if (serviceInitialStateIdList.Count <= 128)
1190:                  {
1191:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1192:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1193:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1194:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, serviceInitialStateIdList.Count - 96 - 1) on sis.Id equals sisid select sis).ToList();
1195:                  }
1196:                  else if (serviceInitialStateIdList.Count <= 160)
1197:                  {
1198:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1199:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1200:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1201:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1202:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, serviceInitialStateIdList.Count - 128 - 1) on sis.Id equals sisid select sis).ToList();
1203:                  }
1204:                  else if (serviceInitialStateIdList.Count <= 192)
1205:                  {
1206:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1207:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1208:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1209:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1210:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, 32) on sis.Id equals sisid select sis).ToList();
1211:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(160, serviceInitialStateIdList.Count - 160 - 1) on sis.Id equals sisid select sis).ToList();
1212:                  }
1213:                  else if (serviceInitialStateIdList.Count <= 224)
1214:                  {
1215:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1216:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1217:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1218:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1219:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, 32) on sis.Id equals sisid select sis).ToList();
1220:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(160, 32) on sis.Id equals sisid select sis).ToList();
1221:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(192, serviceInitialStateIdList.Count - 192 - 1) on sis.Id equals sisid select sis).ToList();
1222:                  }
1223:                  else //if (serviceList.Count <= 256)
1224:                  {
1225:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1226:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1227:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1228:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1229:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, 32) on sis.Id equals sisid select sis).ToList();
1230:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(160, 32) on sis.Id equals sisid select sis).ToList();
1231:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(192, 32) on sis.Id equals sisid select sis).ToList();
1232:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(224, serviceInitialStateIdList.Count - 224 - 1) on sis.Id equals sisid select sis).ToList();
1233:                  }
1234:              }
1235:   
1236:              return list.Distinct().ToList();
1237:          }
1238:   
1239:          ////////////////////////////////////////////////////////////////////////////
1240:   
1241:          /// <summary>
1242:          /// 
1243:          /// </summary>
1244:          public static List<Ia.Ngn.Cl.Model.Ont> OntList(List<string> ontIdList)
1245:          {
1246:              List<Ia.Ngn.Cl.Model.Ont> list;
1247:   
1248:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1249:              {
1250:                  list = (from o in db.Onts join oid in ontIdList on o.Id equals oid select o).ToList();
1251:              }
1252:   
1253:              return list.Distinct().ToList();
1254:          }
1255:   
1256:          ////////////////////////////////////////////////////////////////////////////
1257:   
1258:          /// <summary>
1259:          /// 
1260:          /// </summary>
1261:          public static List<Ia.Ngn.Cl.Model.OntOntPots> OntOntPotsListFromOntOntPotsIdList(List<string> ontOntPotsIdList)
1262:          {
1263:              List<Ia.Ngn.Cl.Model.OntOntPots> list;
1264:   
1265:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1266:              {
1267:                  list = (from oop in db.OntOntPotses join oid in ontOntPotsIdList on oop.Id equals oid select oop).ToList();
1268:              }
1269:   
1270:              return list.Distinct().ToList();
1271:          }
1272:   
1273:          ////////////////////////////////////////////////////////////////////////////
1274:   
1275:          /// <summary>
1276:          /// 
1277:          /// </summary>
1278:          public static List<Ia.Ngn.Cl.Model.Event> EventList(List<long> eventIdList)
1279:          {
1280:              List<Ia.Ngn.Cl.Model.Event> list;
1281:   
1282:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1283:              {
1284:                  list = (from e in db.Events join eid in eventIdList on e.Id equals eid select e).ToList();
1285:              }
1286:   
1287:              return list.Distinct().ToList();
1288:          }
1289:   
1290:          ////////////////////////////////////////////////////////////////////////////
1291:   
1292:          /// <summary>
1293:          /// 
1294:          /// </summary>
1295:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> SubPartyList(List<string> subPartyIdList)
1296:          {
1297:              List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> list;
1298:   
1299:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1300:              {
1301:                  list = (from sp in db.SubParties
1302:                          join spid in subPartyIdList on sp.Id equals spid
1303:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
1304:                          {
1305:                              Id = sp.Id,
1306:                              PartyId = sp.PartyId,
1307:                              PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
1308:                              DisplayName = sp.DisplayName,
1309:                              Category = sp.Category,
1310:                              AssocOtasRealm = sp.AssocOtasRealm,
1311:                              ServiceSuspension = sp.ServiceSuspension,
1312:                              Created = sp.Created,
1313:                              Updated = sp.Updated
1314:                          }).ToList();
1315:              }
1316:   
1317:              return list.Distinct().ToList();
1318:          }
1319:   
1320:          ////////////////////////////////////////////////////////////////////////////
1321:   
1322:          /// <summary>
1323:          /// 
1324:          /// </summary>
1325:          public static List<Ia.Ngn.Cl.Model.Report> ReportList(List<int> reportIdList)
1326:          {
1327:              List<Ia.Ngn.Cl.Model.Report> list;
1328:   
1329:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1330:              {
1331:                  if (reportIdList.Count <= 32)
1332:                  {
1333:                      list = (from r in db.Reports join rid in reportIdList on r.Id equals rid select r).ToList();
1334:                  }
1335:                  else if (reportIdList.Count <= 64)
1336:                  {
1337:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1338:                      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).ToList();
1339:                  }
1340:                  else if (reportIdList.Count <= 96)
1341:                  {
1342:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1343:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1344:                      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).ToList();
1345:                  }
1346:                  else if (reportIdList.Count <= 128)
1347:                  {
1348:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1349:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1350:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1351:                      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).ToList();
1352:                  }
1353:                  else if (reportIdList.Count <= 160)
1354:                  {
1355:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1356:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1357:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1358:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1359:                      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).ToList();
1360:                  }
1361:                  else if (reportIdList.Count <= 192)
1362:                  {
1363:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1364:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1365:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1366:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1367:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1368:                      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).ToList();
1369:                  }
1370:                  else if (reportIdList.Count <= 224)
1371:                  {
1372:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1373:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1374:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1375:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1376:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1377:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).ToList();
1378:                      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).ToList();
1379:                  }
1380:                  else //if (reportIdList.Count <= 256)
1381:                  {
1382:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1383:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1384:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1385:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1386:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1387:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).ToList();
1388:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(192, 32) on r.Id equals rid select r).ToList();
1389:                      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).ToList();
1390:                  }
1391:              }
1392:   
1393:              return list.Distinct().ToList();
1394:          }
1395:   
1396:          ////////////////////////////////////////////////////////////////////////////
1397:   
1398:          /// <summary>
1399:          /// 
1400:          /// </summary>
1401:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> HuSbrList(List<string> huSbrImpuList)
1402:          {
1403:              List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> list;
1404:   
1405:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1406:              {
1407:                  list = (from h in db.HuSbrs
1408:                          join hid in huSbrImpuList on h.IMPU equals hid
1409:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
1410:                          {
1411:                              COP = h.COP,
1412:                              CSC = h.CSC,
1413:                              Id = h.Id,
1414:                              IMPU = h.IMPU,
1415:                              ITT = h.ITT,
1416:                              LP = h.LP,
1417:                              NS3PTY = h.NS3PTY,
1418:                              NSABRC = h.NSABRC,
1419:                              NSCBA = h.NSCBA,
1420:                              NSCFU = h.NSCFU,
1421:                              NSCLIP = h.NSCLIP,
1422:                              NSCW = h.NSCW,
1423:                              NSFAX = h.NSFAX,
1424:                              NSHOLD = h.NSHOLD,
1425:                              NSNPTY = h.NSNPTY,
1426:                              NSWAKE_UP = h.NSWAKE_UP,
1427:                              Created = h.Created,
1428:                              Updated = h.Updated
1429:                          }).ToList();
1430:              }
1431:   
1432:              return list.Distinct().ToList();
1433:          }
1434:   
1435:          ////////////////////////////////////////////////////////////////////////////
1436:   
1437:          /// <summary>
1438:          /// 
1439:          /// </summary>
1440:          public static List<Ia.Ngn.Cl.Model.Huawei.Owsbr> OwsbrList(List<string> owsbrImpuList)
1441:          {
1442:              List<Ia.Ngn.Cl.Model.Huawei.Owsbr> list;
1443:   
1444:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1445:              {
1446:                  list = (from o in db.Owsbrs join oid in owsbrImpuList on o.IMPU equals oid select o).ToList();
1447:              }
1448:   
1449:              return list.Distinct().ToList();
1450:          }
1451:   
1452:          ////////////////////////////////////////////////////////////////////////////
1453:   
1454:          /// <summary>
1455:          /// 
1456:          /// </summary>
1457:          public static List<Ia.Ngn.Cl.Model.OntServiceVoip> OntServiceVoipList(List<string> ontServiceVoipIdList)
1458:          {
1459:              List<Ia.Ngn.Cl.Model.OntServiceVoip> list;
1460:   
1461:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1462:              {
1463:                  if (ontServiceVoipIdList.Count <= 32)
1464:                  {
1465:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList on ov.Id equals ovid select ov).ToList();
1466:                  }
1467:                  else
1468:                  {
1469:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList.GetRange(0, 32) on ov.Id equals ovid select ov).ToList();
1470:                      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();
1471:                  }
1472:              }
1473:   
1474:              return list.Distinct().ToList();
1475:          }
1476:   
1477:          ////////////////////////////////////////////////////////////////////////////
1478:   
1479:          /// <summary>
1480:          /// 
1481:          /// </summary>
1482:          public static List<Ia.Ngn.Cl.Model.Ui.Service2> ServiceList(List<string> serviceIdList)
1483:          {
1484:              List<Ia.Ngn.Cl.Model.Service2> list;
1485:              List<Ia.Ngn.Cl.Model.Ui.Service2> uiList;
1486:   
1487:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1488:              {
1489:                  if (serviceIdList.Count <= 32)
1490:                  {
1491:                      list = (from s in db.Service2s join sid in serviceIdList on s.Id equals sid select s).ToList();
1492:                  }
1493:                  else if (serviceIdList.Count <= 64)
1494:                  {
1495:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1496:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on s.Id equals sid select s).ToList();
1497:                  }
1498:                  else if (serviceIdList.Count <= 96)
1499:                  {
1500:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1501:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1502:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on s.Id equals sid select s).ToList();
1503:                  }
1504:                  else if (serviceIdList.Count <= 128)
1505:                  {
1506:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1507:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1508:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1509:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on s.Id equals sid select s).ToList();
1510:                  }
1511:                  else if (serviceIdList.Count <= 160)
1512:                  {
1513:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1514:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1515:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1516:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1517:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on s.Id equals sid select s).ToList();
1518:                  }
1519:                  else if (serviceIdList.Count <= 192)
1520:                  {
1521:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1522:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1523:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1524:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1525:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1526:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on s.Id equals sid select s).ToList();
1527:                  }
1528:                  else if (serviceIdList.Count <= 224)
1529:                  {
1530:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1531:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1532:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1533:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1534:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1535:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1536:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on s.Id equals sid select s).ToList();
1537:                  }
1538:                  else if (serviceIdList.Count <= 256)
1539:                  {
1540:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1541:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1542:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1543:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1544:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1545:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1546:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1547:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on s.Id equals sid select s).ToList();
1548:                  }
1549:                  else if (serviceIdList.Count <= 288)
1550:                  {
1551:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1552:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1553:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1554:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1555:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1556:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1557:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1558:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1559:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, serviceIdList.Count - 256 - 1) on s.Id equals sid select s).ToList();
1560:                  }
1561:                  else if (serviceIdList.Count <= 320)
1562:                  {
1563:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1564:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1565:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1566:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1567:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1568:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1569:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1570:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1571:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1572:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, serviceIdList.Count - 288 - 1) on s.Id equals sid select s).ToList();
1573:                  }
1574:                  else if (serviceIdList.Count <= 352)
1575:                  {
1576:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1577:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1578:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1579:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1580:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1581:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1582:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1583:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1584:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1585:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1586:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, serviceIdList.Count - 320 - 1) on s.Id equals sid select s).ToList();
1587:                  }
1588:                  else if (serviceIdList.Count <= 384)
1589:                  {
1590:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1591:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1592:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1593:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1594:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1595:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1596:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1597:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1598:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1599:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1600:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1601:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, serviceIdList.Count - 352 - 1) on s.Id equals sid select s).ToList();
1602:                  }
1603:                  else if (serviceIdList.Count <= 416)
1604:                  {
1605:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1606:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1607:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1608:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1609:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1610:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1611:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1612:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1613:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1614:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1615:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1616:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1617:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, serviceIdList.Count - 384 - 1) on s.Id equals sid select s).ToList();
1618:                  }
1619:                  else if (serviceIdList.Count <= 448)
1620:                  {
1621:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1622:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1623:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1624:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1625:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1626:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1627:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1628:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1629:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1630:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1631:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1632:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1633:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1634:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, serviceIdList.Count - 416 - 1) on s.Id equals sid select s).ToList();
1635:                  }
1636:                  else if (serviceIdList.Count <= 480)
1637:                  {
1638:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1639:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1640:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1641:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1642:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1643:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1644:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1645:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1646:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1647:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1648:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1649:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1650:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1651:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1652:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, serviceIdList.Count - 448 - 1) on s.Id equals sid select s).ToList();
1653:                  }
1654:                  else if (serviceIdList.Count <= 512)
1655:                  {
1656:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1657:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1658:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1659:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1660:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1661:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1662:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1663:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1664:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1665:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1666:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1667:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1668:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1669:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1670:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
1671:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, serviceIdList.Count - 480 - 1) on s.Id equals sid select s).ToList();
1672:                  }
1673:                  else if (serviceIdList.Count <= 544)
1674:                  {
1675:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1676:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1677:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1678:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1679:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1680:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1681:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1682:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1683:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1684:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1685:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1686:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1687:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1688:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1689:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
1690:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).ToList();
1691:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, serviceIdList.Count - 512 - 1) on s.Id equals sid select s).ToList();
1692:                  }
1693:                  else //if (serviceIdList.Count <= ??)
1694:                  {
1695:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1696:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1697:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1698:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1699:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1700:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1701:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1702:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1703:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1704:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1705:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1706:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1707:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1708:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1709:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
1710:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).ToList();
1711:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, 32) on s.Id equals sid select s).ToList();
1712:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(544, serviceIdList.Count - 544 - 1) on s.Id equals sid select s).ToList();
1713:                  }
1714:   
1715:                  uiList = (from s in list
1716:                            select new Ia.Ngn.Cl.Model.Ui.Service2()
1717:                            {
1718:                                Id = s.Id,
1719:                                AbbriviatedCalling = s.AbbriviatedCalling,
1720:                                AlarmCall = s.AlarmCall,
1721:                                CallBarring = s.CallBarring,
1722:                                CallerId = s.CallerId,
1723:                                CallForwarding = s.CallForwarding,
1724:                                CallWaiting = s.CallWaiting,
1725:                                ConferenceCall = s.ConferenceCall,
1726:                                Created = s.Created,
1727:                                InternationalCalling = s.InternationalCalling,
1728:                                InternationalCallingUserControlled = s.InternationalCallingUserControlled,
1729:                                LineCard = s.LineCard,
1730:                                Pin = s.Pin,
1731:                                Service = s.Service,
1732:                                ServiceType = s.ServiceType,
1733:                                ServiceSuspension = s.ServiceSuspension,
1734:                                ServiceTypeName = s.ServiceType.ToString(),
1735:                                Updated = s.Updated,
1736:                                AccessId = (s.Access != null) ? s.Access.Id : string.Empty
1737:                            }).ToList();
1738:              }
1739:   
1740:              return uiList.Distinct().ToList();
1741:          }
1742:   
1743:          ////////////////////////////////////////////////////////////////////////////
1744:   
1745:          /// <summary>
1746:          /// 
1747:          /// </summary>
1748:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> SubscriberList(List<string> subscriberIdList)
1749:          {
1750:              List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> list;
1751:   
1752:              // below: db.Subscribers contains XML fields which can not be evaluated in a Union() function.
1753:   
1754:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1755:              {
1756:                  list = (from s in db.Subscribers
1757:                          join sid in subscriberIdList on s.Id equals sid
1758:                          select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
1759:                          {
1760:                              Id = s.Id,
1761:                              AlternateOtasRealm = s.AlternateOtasRealm,
1762:                              PartyId = s.PartyId,
1763:                              AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
1764:                              AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
1765:                              CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
1766:                              CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
1767:                              CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
1768:                              ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
1769:                              InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
1770:                              InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
1771:                              //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
1772:                              Created = s.Created,
1773:                              Updated = s.Updated,
1774:                          }).ToList();
1775:              }
1776:   
1777:              return list.Distinct().ToList();
1778:          }
1779:   
1780:          ////////////////////////////////////////////////////////////////////////////
1781:   
1782:          /// <summary>
1783:          /// 
1784:          /// </summary>
1785:          public static List<string> AccessIdList(int oltId, int ponNumber, int ontInternalNumber)
1786:          {
1787:              List<string> list;
1788:   
1789:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1790:              {
1791:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber && a.Ont == ontInternalNumber select a.Id).ToList();
1792:              }
1793:   
1794:              return list.Distinct().ToList();
1795:          }
1796:   
1797:          ////////////////////////////////////////////////////////////////////////////
1798:   
1799:          /// <summary>
1800:          /// 
1801:          /// </summary>
1802:          public static List<string> AccessIdList(int oltId, int ponNumber)
1803:          {
1804:              List<string> list;
1805:   
1806:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1807:              {
1808:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber select a.Id).ToList();
1809:              }
1810:   
1811:              return list.Distinct().ToList();
1812:          }
1813:   
1814:          ////////////////////////////////////////////////////////////////////////////
1815:   
1816:          /// <summary>
1817:          /// 
1818:          /// </summary>
1819:          public static List<string> EmsOntIdListFromNddOntIdList(List<string> nddOntIdList)
1820:          {
1821:              List<string> list;
1822:   
1823:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1824:              {
1825:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.Id).ToList();
1826:              }
1827:   
1828:              return list.Distinct().ToList();
1829:          }
1830:   
1831:          ////////////////////////////////////////////////////////////////////////////
1832:   
1833:          /// <summary>
1834:          /// 
1835:          /// </summary>
1836:          public static List<string> EmsOntIpListFromNddOntIdList(List<string> nddOntIdList)
1837:          {
1838:              List<string> list;
1839:   
1840:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1841:              {
1842:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.IP).ToList();
1843:              }
1844:   
1845:              return list.Distinct().ToList();
1846:          }
1847:   
1848:          ////////////////////////////////////////////////////////////////////////////
1849:   
1850:          /// <summary>
1851:          /// 
1852:          /// </summary>
1853:          public static List<string> SbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
1854:          {
1855:              List<string> list;
1856:   
1857:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1858:              {
1859:                  list = (from s in db.HuSbrs join i in impuSipDomainList on s.IMPU equals i select s.IMPU).ToList();
1860:              }
1861:   
1862:              return list.Distinct().ToList();
1863:          }
1864:   
1865:          ////////////////////////////////////////////////////////////////////////////
1866:   
1867:          /// <summary>
1868:          /// 
1869:          /// </summary>
1870:          public static List<string> OwSbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
1871:          {
1872:              List<string> list;
1873:   
1874:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1875:              {
1876:                  list = (from o in db.Owsbrs join i in impuSipDomainList on o.IMPU equals i select o.IMPU).ToList();
1877:              }
1878:   
1879:              return list.Distinct().ToList();
1880:          }
1881:   
1882:          ////////////////////////////////////////////////////////////////////////////
1883:   
1884:          /// <summary>
1885:          /// 
1886:          /// </summary>
1887:          public static List<string> ServiceRequestServiceIdListFromAccessIdList(List<string> accessIdList)
1888:          {
1889:              List<string> list;
1890:   
1891:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1892:              {
1893:                  list = (from srs in db.ServiceRequestServices join aid in accessIdList on srs.Access.Id equals aid select srs.Id).ToList();
1894:              }
1895:   
1896:              return list.Distinct().ToList();
1897:          }
1898:   
1899:          ////////////////////////////////////////////////////////////////////////////
1900:   
1901:          /// <summary>
1902:          /// 
1903:          /// </summary>
1904:          public static List<string> ServiceRequestServiceIdListFromServiceList(List<string> serviceList)
1905:          {
1906:              List<string> list;
1907:   
1908:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1909:              {
1910:                  list = (from srs in db.ServiceRequestServices join si in serviceList on srs.Service equals si select srs.Id).ToList();
1911:              }
1912:   
1913:              return list.Distinct().ToList();
1914:          }
1915:   
1916:          ////////////////////////////////////////////////////////////////////////////
1917:   
1918:          /// <summary>
1919:          /// 
1920:          /// </summary>
1921:          public static List<string> ServiceIdListFromServiceList(List<string> serviceList)
1922:          {
1923:              List<string> list;
1924:   
1925:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1926:              {
1927:                  if (serviceList.Count <= 32)
1928:                  {
1929:                      list = (from s in db.Service2s join si in serviceList on s.Service equals si select s.Id).ToList();
1930:                  }
1931:                  else if (serviceList.Count <= 64)
1932:                  {
1933:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1934:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, serviceList.Count - 32 - 1) on s.Service equals si select s.Id).ToList();
1935:                  }
1936:                  else if (serviceList.Count <= 96)
1937:                  {
1938:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1939:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
1940:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, serviceList.Count - 64 - 1) on s.Service equals si select s.Id).ToList();
1941:                  }
1942:                  else if (serviceList.Count <= 128)
1943:                  {
1944:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1945:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
1946:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
1947:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, serviceList.Count - 96 - 1) on s.Service equals si select s.Id).ToList();
1948:                  }
1949:                  else if (serviceList.Count <= 160)
1950:                  {
1951:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1952:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
1953:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
1954:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
1955:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, serviceList.Count - 128 - 1) on s.Service equals si select s.Id).ToList();
1956:                  }
1957:                  else if (serviceList.Count <= 192)
1958:                  {
1959:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1960:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
1961:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
1962:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
1963:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
1964:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, serviceList.Count - 160 - 1) on s.Service equals si select s.Id).ToList();
1965:                  }
1966:                  else if (serviceList.Count <= 224)
1967:                  {
1968:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1969:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
1970:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
1971:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
1972:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
1973:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
1974:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, serviceList.Count - 192 - 1) on s.Service equals si select s.Id).ToList();
1975:                  }
1976:                  else //if (serviceList.Count <= 256)
1977:                  {
1978:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
1979:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
1980:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
1981:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
1982:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
1983:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
1984:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, 32) on s.Service equals si select s.Id).ToList();
1985:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(224, serviceList.Count - 224 - 1) on s.Service equals si select s.Id).ToList();
1986:                  }
1987:              }
1988:   
1989:              return list.Distinct().ToList();
1990:          }
1991:   
1992:          ////////////////////////////////////////////////////////////////////////////
1993:   
1994:          /// <summary>
1995:          /// 
1996:          /// </summary>
1997:          public static List<string> ServiceInitialStateIdListFromAccessIdList(List<string> accessIdList)
1998:          {
1999:              List<string> list;
2000:   
2001:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2002:              {
2003:                  list = (from sis in db.ServiceInitialStates join aid in accessIdList on sis.Access.Id equals aid select sis.Id).ToList();
2004:              }
2005:   
2006:              return list.Distinct().ToList();
2007:          }
2008:   
2009:          ////////////////////////////////////////////////////////////////////////////
2010:   
2011:          /// <summary>
2012:          /// 
2013:          /// </summary>
2014:          public static List<string> ServiceInitialStateIdListFromServiceList(List<string> serviceList)
2015:          {
2016:              List<string> list;
2017:   
2018:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2019:              {
2020:                  if (serviceList.Count <= 32)
2021:                  {
2022:                      list = (from sis in db.ServiceInitialStates join s in serviceList on sis.Service equals s select sis.Id).ToList();
2023:                  }
2024:                  else if (serviceList.Count <= 64)
2025:                  {
2026:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2027:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, serviceList.Count - 32 - 1) on sis.Service equals s select sis.Id).ToList();
2028:                  }
2029:                  else if (serviceList.Count <= 96)
2030:                  {
2031:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2032:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2033:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, serviceList.Count - 64 - 1) on sis.Service equals s select sis.Id).ToList();
2034:                  }
2035:                  else if (serviceList.Count <= 128)
2036:                  {
2037:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2038:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2039:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2040:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, serviceList.Count - 96 - 1) on sis.Service equals s select sis.Id).ToList();
2041:                  }
2042:                  else if (serviceList.Count <= 160)
2043:                  {
2044:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2045:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2046:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2047:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2048:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, serviceList.Count - 128 - 1) on sis.Service equals s select sis.Id).ToList();
2049:                  }
2050:                  else if (serviceList.Count <= 192)
2051:                  {
2052:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2053:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2054:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2055:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2056:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, 32) on sis.Service equals s select sis.Id).ToList();
2057:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(160, serviceList.Count - 160 - 1) on sis.Service equals s select sis.Id).ToList();
2058:                  }
2059:                  else if (serviceList.Count <= 224)
2060:                  {
2061:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2062:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2063:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2064:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2065:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, 32) on sis.Service equals s select sis.Id).ToList();
2066:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(160, 32) on sis.Service equals s select sis.Id).ToList();
2067:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(192, serviceList.Count - 192 - 1) on sis.Service equals s select sis.Id).ToList();
2068:                  }
2069:                  else //if (serviceList.Count <= 256)
2070:                  {
2071:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2072:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2073:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2074:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2075:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, 32) on sis.Service equals s select sis.Id).ToList();
2076:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(160, 32) on sis.Service equals s select sis.Id).ToList();
2077:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(192, 32) on sis.Service equals s select sis.Id).ToList();
2078:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(224, serviceList.Count - 224 - 1) on sis.Service equals s select sis.Id).ToList();
2079:                  }
2080:              }
2081:   
2082:              return list.Distinct().ToList();
2083:          }
2084:   
2085:          ////////////////////////////////////////////////////////////////////////////
2086:   
2087:          /// <summary>
2088:          /// 
2089:          /// </summary>
2090:          public static List<int> ReportIdListFromServiceList(List<string> serviceList)
2091:          {
2092:              List<int> list;
2093:   
2094:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
2095:              // <type id="2" name="Ont Name" arabicName=""/>
2096:   
2097:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2098:              {
2099:                  if (serviceList.Count <= 32)
2100:                  {
2101:                      list = (from r in db.Reports join s in serviceList on r.Service equals s select r.Id).ToList();
2102:                  }
2103:                  else if (serviceList.Count <= 64)
2104:                  {
2105:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2106:                      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();
2107:                  }
2108:                  else if (serviceList.Count <= 96)
2109:                  {
2110:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2111:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2112:                      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();
2113:                  }
2114:                  else if (serviceList.Count <= 128)
2115:                  {
2116:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2117:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2118:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2119:                      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();
2120:                  }
2121:                  else if (serviceList.Count <= 160)
2122:                  {
2123:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2124:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2125:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2126:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2127:                      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();
2128:                  }
2129:                  else if (serviceList.Count <= 192)
2130:                  {
2131:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2132:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2133:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2134:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2135:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2136:                      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();
2137:                  }
2138:                  else if (serviceList.Count <= 224)
2139:                  {
2140:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2141:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2142:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2143:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2144:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2145:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
2146:                      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();
2147:                  }
2148:                  else //if (serviceList.Count <= 256)
2149:                  {
2150:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2151:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2152:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2153:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2154:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2155:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
2156:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
2157:                      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();
2158:                  }
2159:              }
2160:   
2161:              return list.Distinct().ToList();
2162:          }
2163:   
2164:          ////////////////////////////////////////////////////////////////////////////
2165:   
2166:          /// <summary>
2167:          /// 
2168:          /// </summary>
2169:          public static List<string> ServiceIdListFromAccessIdList(List<string> accessIdList)
2170:          {
2171:              List<string> list;
2172:   
2173:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2174:              {
2175:                  list = (from s in db.Service2s join aid in accessIdList on s.Access.Id equals aid select new Ia.Ngn.Cl.Model.Ui.Service2() { Id = s.Id }.Id).ToList();
2176:              }
2177:   
2178:              return list.Distinct().ToList();
2179:          }
2180:   
2181:          ////////////////////////////////////////////////////////////////////////////
2182:   
2183:          /// <summary>
2184:          /// 
2185:          /// </summary>
2186:          public static List<string> AccessIdListFromServiceList(List<string> serviceList)
2187:          {
2188:              List<string> list;
2189:   
2190:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2191:              {
2192:                  list = (from s in db.Service2s join si in serviceList on s.Service equals si where s.Access != null select s.Access.Id).ToList();
2193:              }
2194:   
2195:              return list.Distinct().ToList();
2196:          }
2197:   
2198:          ////////////////////////////////////////////////////////////////////////////
2199:   
2200:          /// <summary>
2201:          /// 
2202:          /// </summary>
2203:          public static List<string> AccessIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
2204:          {
2205:              List<string> list;
2206:   
2207:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2208:              {
2209:                  list = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList on srs.Id equals srsid where srs.Access != null select srs.Access.Id).ToList();
2210:              }
2211:   
2212:              return list.Distinct().ToList();
2213:          }
2214:   
2215:          ////////////////////////////////////////////////////////////////////////////
2216:   
2217:          /// <summary>
2218:          /// 
2219:          /// </summary>
2220:          public static List<string> ServiceRequestOntIdListFromAccessIdList(List<string> accessIdList)
2221:          {
2222:              List<string> list;
2223:   
2224:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2225:              {
2226:                  list = (from sro in db.ServiceRequestOnts join aid in accessIdList on sro.Access.Id equals aid select sro.Id).ToList();
2227:              }
2228:   
2229:              return list.Distinct().ToList();
2230:          }
2231:   
2232:          ////////////////////////////////////////////////////////////////////////////
2233:   
2234:          /// <summary>
2235:          /// 
2236:          /// </summary>
2237:          public static List<int> ServiceRequestIdListFromServiceList(List<string> serviceList)
2238:          {
2239:              List<int> list, numberList;
2240:   
2241:              if (serviceList.Count > 0)
2242:              {
2243:                  numberList = new List<int>();
2244:   
2245:                  foreach (string s in serviceList)
2246:                  {
2247:                      if (int.TryParse(s, out int i)) numberList.Add(i);
2248:                  }
2249:   
2250:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2251:                  {
2252:                      if (serviceList.Count <= 32)
2253:                      {
2254:                          list = (from sr in db.ServiceRequests join n in numberList on sr.Number equals n select sr.Id).ToList();
2255:                      }
2256:                      else if (serviceList.Count <= 64)
2257:                      {
2258:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2259:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, serviceList.Count - 32 - 1) on sr.Number equals n select sr.Id).ToList();
2260:                      }
2261:                      else if (serviceList.Count <= 96)
2262:                      {
2263:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2264:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2265:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, serviceList.Count - 64 - 1) on sr.Number equals n select sr.Id).ToList();
2266:                      }
2267:                      else if (serviceList.Count <= 128)
2268:                      {
2269:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2270:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2271:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2272:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, serviceList.Count - 96 - 1) on sr.Number equals n select sr.Id).ToList();
2273:                      }
2274:                      else if (serviceList.Count <= 160)
2275:                      {
2276:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2277:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2278:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2279:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2280:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, serviceList.Count - 128 - 1) on sr.Number equals n select sr.Id).ToList();
2281:                      }
2282:                      else if (serviceList.Count <= 192)
2283:                      {
2284:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2285:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2286:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2287:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2288:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, 32) on sr.Number equals n select sr.Id).ToList();
2289:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(160, serviceList.Count - 160 - 1) on sr.Number equals n select sr.Id).ToList();
2290:                      }
2291:                      else if (serviceList.Count <= 224)
2292:                      {
2293:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2294:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2295:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2296:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2297:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, 32) on sr.Number equals n select sr.Id).ToList();
2298:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(160, 32) on sr.Number equals n select sr.Id).ToList();
2299:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(192, serviceList.Count - 192 - 1) on sr.Number equals n select sr.Id).ToList();
2300:                      }
2301:                      else //if (serviceList.Count <= 256)
2302:                      {
2303:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2304:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2305:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2306:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2307:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, 32) on sr.Number equals n select sr.Id).ToList();
2308:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(160, 32) on sr.Number equals n select sr.Id).ToList();
2309:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(192, 32) on sr.Number equals n select sr.Id).ToList();
2310:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(224, serviceList.Count - 224 - 1) on sr.Number equals n select sr.Id).ToList();
2311:                      }
2312:                  }
2313:              }
2314:              else
2315:              {
2316:                  list = new List<int>();
2317:              }
2318:   
2319:              return list.Distinct().ToList();
2320:          }
2321:   
2322:          ////////////////////////////////////////////////////////////////////////////
2323:   
2324:          /// <summary>
2325:          /// 
2326:          /// </summary>
2327:          public static List<int> ServiceRequestTypeIdListFromServiceRequestIdList(List<int> serviceRequestIdList)
2328:          {
2329:              List<int> list;
2330:   
2331:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2332:              {
2333:                  if (serviceRequestIdList.Count <= 32)
2334:                  {
2335:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2336:                  }
2337:                  else if (serviceRequestIdList.Count <= 64)
2338:                  {
2339:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2340:                      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();
2341:                  }
2342:                  else if (serviceRequestIdList.Count <= 96)
2343:                  {
2344:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2345:                      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();
2346:                      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();
2347:                  }
2348:                  else if (serviceRequestIdList.Count <= 128)
2349:                  {
2350:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2351:                      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();
2352:                      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();
2353:                      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();
2354:                  }
2355:                  else if (serviceRequestIdList.Count <= 160)
2356:                  {
2357:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2358:                      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();
2359:                      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();
2360:                      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();
2361:                      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();
2362:                  }
2363:                  else if (serviceRequestIdList.Count <= 192)
2364:                  {
2365:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2366:                      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();
2367:                      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();
2368:                      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();
2369:                      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();
2370:                      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();
2371:                  }
2372:                  else if (serviceRequestIdList.Count <= 224)
2373:                  {
2374:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2375:                      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();
2376:                      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();
2377:                      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();
2378:                      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();
2379:                      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();
2380:                      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();
2381:                  }
2382:                  else if (serviceRequestIdList.Count <= 256)
2383:                  {
2384:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2385:                      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();
2386:                      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();
2387:                      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();
2388:                      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();
2389:                      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();
2390:                      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();
2391:                      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();
2392:                  }
2393:                  else if (serviceRequestIdList.Count <= 288)
2394:                  {
2395:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2396:                      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();
2397:                      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();
2398:                      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();
2399:                      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();
2400:                      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();
2401:                      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();
2402:                      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();
2403:                      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();
2404:                  }
2405:                  else if (serviceRequestIdList.Count <= 320)
2406:                  {
2407:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2408:                      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();
2409:                      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();
2410:                      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();
2411:                      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();
2412:                      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();
2413:                      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();
2414:                      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();
2415:                      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();
2416:                      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();
2417:                  }
2418:                  else if (serviceRequestIdList.Count <= 352)
2419:                  {
2420:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2421:                      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();
2422:                      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();
2423:                      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();
2424:                      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();
2425:                      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();
2426:                      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();
2427:                      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();
2428:                      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();
2429:                      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();
2430:                      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();
2431:                  }
2432:                  else if (serviceRequestIdList.Count <= 384)
2433:                  {
2434:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2435:                      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();
2436:                      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();
2437:                      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();
2438:                      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();
2439:                      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();
2440:                      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();
2441:                      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();
2442:                      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();
2443:                      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();
2444:                      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();
2445:                      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();
2446:                  }
2447:                  else if (serviceRequestIdList.Count <= 416)
2448:                  {
2449:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2450:                      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();
2451:                      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();
2452:                      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();
2453:                      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();
2454:                      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();
2455:                      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();
2456:                      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();
2457:                      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();
2458:                      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();
2459:                      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();
2460:                      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();
2461:                      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();
2462:                  }
2463:                  else if (serviceRequestIdList.Count <= 448)
2464:                  {
2465:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2466:                      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();
2467:                      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();
2468:                      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();
2469:                      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();
2470:                      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();
2471:                      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();
2472:                      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();
2473:                      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();
2474:                      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();
2475:                      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();
2476:                      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();
2477:                      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();
2478:                      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();
2479:                  }
2480:                  else if (serviceRequestIdList.Count <= 480)
2481:                  {
2482:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2483:                      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();
2484:                      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();
2485:                      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();
2486:                      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();
2487:                      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();
2488:                      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();
2489:                      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();
2490:                      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();
2491:                      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();
2492:                      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();
2493:                      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();
2494:                      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();
2495:                      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();
2496:                      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();
2497:                  }
2498:                  else if (serviceRequestIdList.Count <= 512)
2499:                  {
2500:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2501:                      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();
2502:                      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();
2503:                      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();
2504:                      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();
2505:                      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();
2506:                      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();
2507:                      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();
2508:                      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();
2509:                      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();
2510:                      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();
2511:                      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();
2512:                      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();
2513:                      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();
2514:                      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();
2515:                      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();
2516:                  }
2517:                  else if (serviceRequestIdList.Count <= 544)
2518:                  {
2519:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2520:                      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();
2521:                      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();
2522:                      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();
2523:                      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();
2524:                      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();
2525:                      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();
2526:                      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();
2527:                      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();
2528:                      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();
2529:                      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();
2530:                      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();
2531:                      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();
2532:                      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();
2533:                      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();
2534:                      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();
2535:                      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();
2536:                  }
2537:                  else //if (serviceRequestIdList.Count <= ??)
2538:                  {
2539:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2540:                      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();
2541:                      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();
2542:                      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();
2543:                      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();
2544:                      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();
2545:                      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();
2546:                      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();
2547:                      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();
2548:                      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();
2549:                      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();
2550:                      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();
2551:                      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();
2552:                      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();
2553:                      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();
2554:                      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();
2555:                      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();
2556:                      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();
2557:                  }
2558:              }
2559:   
2560:              return list.Distinct().ToList();
2561:          }
2562:   
2563:          ////////////////////////////////////////////////////////////////////////////
2564:   
2565:          /// <summary>
2566:          /// 
2567:          /// </summary>
2568:          public static List<string> NddOntIdList(int oltId, int ponNumber, int ontInternalNumber)
2569:          {
2570:              List<string> list;
2571:   
2572:              list = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Pon.PonGroup.Olt.Id == oltId && n.Pon.Number == ponNumber && n.Number == ontInternalNumber select n.Id).ToList();
2573:   
2574:              return list.Distinct().ToList();
2575:          }
2576:   
2577:          ////////////////////////////////////////////////////////////////////////////
2578:   
2579:          /// <summary>
2580:          /// 
2581:          /// </summary>
2582:          public static List<string> NddOntIdList(int oltId, int ponNumber)
2583:          {
2584:              List<string> list;
2585:   
2586:              list = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Pon.PonGroup.Olt.Id == oltId && n.Pon.Number == ponNumber select n.Id).ToList();
2587:   
2588:              return list.Distinct().ToList();
2589:          }
2590:   
2591:          ////////////////////////////////////////////////////////////////////////////
2592:   
2593:          /// <summary>
2594:          /// 
2595:          /// </summary>
2596:          public static List<string> NddOntIdListFromAccessIdList(List<string> accessIdList)
2597:          {
2598:              List<string> list;
2599:   
2600:              list = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join aid in accessIdList on n.Access.Id equals aid select n.Id).ToList();
2601:   
2602:              return list.Distinct().ToList();
2603:          }
2604:   
2605:          ////////////////////////////////////////////////////////////////////////////
2606:   
2607:          /// <summary>
2608:          /// 
2609:          /// </summary>
2610:          public static List<string> OntServiceVoipIpList(List<string> ontServiceVoipIdList)
2611:          {
2612:              List<string> list;
2613:   
2614:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2615:              {
2616:                  if (ontServiceVoipIdList.Count <= 32)
2617:                  {
2618:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList on osv.Id equals osvid select osv.Ip).ToList();
2619:                  }
2620:                  else
2621:                  {
2622:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList.GetRange(0, 32) on osv.Id equals osvid select osv.Ip).ToList();
2623:                      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();
2624:                  }
2625:              }
2626:   
2627:              return list.Distinct().ToList();
2628:          }
2629:   
2630:          ////////////////////////////////////////////////////////////////////////////
2631:   
2632:          /// <summary>
2633:          /// 
2634:          /// </summary>
2635:          public static List<string> NddPonIpList(int oltId, int ponNumber)
2636:          {
2637:              List<string> list;
2638:   
2639:              list = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where n.Pon.PonGroup.Olt.Id == oltId && n.Pon.Number == ponNumber select n.Ip).ToList();
2640:   
2641:              return list.Distinct().ToList();
2642:          }
2643:   
2644:          ////////////////////////////////////////////////////////////////////////////
2645:   
2646:          /// <summary>
2647:          /// 
2648:          /// </summary>
2649:          public static List<string> OntIdListFromNddOntIdList(List<string> nddOntIdList)
2650:          {
2651:              List<string> list;
2652:   
2653:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2654:              {
2655:                  list = (from o in db.Onts join nid in nddOntIdList on o.Id equals nid select o.Id).ToList();
2656:              }
2657:   
2658:              return list.Distinct().ToList();
2659:          }
2660:   
2661:          ////////////////////////////////////////////////////////////////////////////
2662:   
2663:          /// <summary>
2664:          /// 
2665:          /// </summary>
2666:          public static List<string> OntOntPotsIdListFromOntIdList(List<string> ontIdList)
2667:          {
2668:              List<string> list;
2669:   
2670:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2671:              {
2672:                  list = (from oop in db.OntOntPotses join oid in ontIdList on oop.Ont.Id equals oid select oop.Id).ToList();
2673:              }
2674:   
2675:              return list.Distinct().ToList();
2676:          }
2677:   
2678:          ////////////////////////////////////////////////////////////////////////////
2679:   
2680:          /// <summary>
2681:          /// 
2682:          /// </summary>
2683:          public static List<string> OntServiceVoipsIdListFromOntIdList(List<string> ontIdList)
2684:          {
2685:              List<string> list;
2686:   
2687:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2688:              {
2689:                  list = (from ov in db.OntServiceVoips join oid in ontIdList on ov.Ont.Id equals oid select ov.Id).ToList();
2690:              }
2691:   
2692:              return list.Distinct().ToList();
2693:          }
2694:   
2695:          ////////////////////////////////////////////////////////////////////////////
2696:   
2697:          /// <summary>
2698:          /// 
2699:          /// </summary>
2700:          public static List<string> OntServiceVoipsIdListFromIpList(List<string> ipList)
2701:          {
2702:              List<string> list;
2703:   
2704:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2705:              {
2706:                  list = (from ov in db.OntServiceVoips join npi in ipList on ov.Ip equals npi select ov.Id).ToList();
2707:              }
2708:   
2709:              return list.Distinct().ToList();
2710:          }
2711:   
2712:          ////////////////////////////////////////////////////////////////////////////
2713:   
2714:          /// <summary>
2715:          /// 
2716:          /// </summary>
2717:          public static List<long> EventIdListFromOntIdList(List<string> ontIdList)
2718:          {
2719:              List<long> list;
2720:   
2721:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2722:              {
2723:                  list = (from e in db.Events join oid in ontIdList on e.Ont.Id equals oid where e.Ont != null select e.Id).ToList();
2724:              }
2725:   
2726:              return list.Distinct().ToList();
2727:          }
2728:   
2729:          ////////////////////////////////////////////////////////////////////////////
2730:   
2731:          /// <summary>
2732:          /// 
2733:          /// </summary>
2734:          public static List<int> AgcfGatewayRecordIdListFromIpList(List<string> ipList)
2735:          {
2736:              List<int> list;
2737:   
2738:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2739:              {
2740:                  if (ipList.Count <= 32)
2741:                  {
2742:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList on gr.IP1 equals ip select gr.Id).ToList();
2743:                  }
2744:                  else
2745:                  {
2746:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
2747:                      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();
2748:                  }
2749:              }
2750:   
2751:              return list.Distinct().ToList();
2752:          }
2753:   
2754:          ////////////////////////////////////////////////////////////////////////////
2755:   
2756:          /// <summary>
2757:          /// 
2758:          /// </summary>
2759:          public static List<int> AgcfGatewayRecordIdListFromNddOntIdList(List<string> nddOntIdlist)
2760:          {
2761:              List<int> list;
2762:              List<string> nddIpList;
2763:   
2764:              nddIpList = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdlist on n.Id equals nid select n.Ip).ToList();
2765:   
2766:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2767:              {
2768:                  if (nddOntIdlist.Count <= 32)
2769:                  {
2770:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList on gr.IP1 equals ip select gr.Id).ToList();
2771:                  }
2772:                  else
2773:                  {
2774:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
2775:                      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();
2776:                  }
2777:              }
2778:   
2779:              return list.Distinct().ToList();
2780:          }
2781:   
2782:          ////////////////////////////////////////////////////////////////////////////
2783:   
2784:          /// <summary>
2785:          /// 
2786:          /// </summary>
2787:          public static List<int> AgcfGatewayRecordIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
2788:          {
2789:              List<int> list;
2790:   
2791:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2792:              {
2793:                  if (agcfEndpointIdList.Count <= 32)
2794:                  {
2795:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
2796:                  }
2797:                  else
2798:                  {
2799:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList.GetRange(0, 32) on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
2800:                      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();
2801:                  }
2802:              }
2803:   
2804:              return list.Distinct().ToList();
2805:          }
2806:   
2807:          ////////////////////////////////////////////////////////////////////////////
2808:   
2809:          /// <summary>
2810:          /// 
2811:          /// </summary>
2812:          public static List<string> AgcfEndpointIdListFromAgcfGatewayRecordIdList(List<int> agcfGatewayRecordIdList)
2813:          {
2814:              List<string> list;
2815:   
2816:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2817:              {
2818:                  list = (from e in db.AgcfEndpoints join grid in agcfGatewayRecordIdList on e.AgcfGatewayRecord.Id equals grid where e.AgcfGatewayRecord != null select e.Id).ToList();
2819:              }
2820:   
2821:              return list.Distinct().ToList();
2822:          }
2823:   
2824:          ////////////////////////////////////////////////////////////////////////////
2825:   
2826:          /// <summary>
2827:          /// 
2828:          /// </summary>
2829:          public static List<string> AgcfEndpointIdListFromSubPartyIdList(List<string> subPartyIdList)
2830:          {
2831:              List<string> list;
2832:   
2833:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2834:              {
2835:                  list = (from sp in db.SubParties join spid in subPartyIdList on sp.Id equals spid select sp.AgcfEndpoint.Id).ToList();
2836:              }
2837:   
2838:              return list.Distinct().ToList();
2839:          }
2840:   
2841:          ////////////////////////////////////////////////////////////////////////////
2842:   
2843:          /// <summary>
2844:          /// 
2845:          /// </summary>
2846:          public static List<string> AgcfEndpointIdListFromPrividUserList(List<string> prividUserList)
2847:          {
2848:              List<string> list;
2849:   
2850:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2851:              {
2852:                  list = (from ep in db.AgcfEndpoints join pu in prividUserList on ep.PrividUser equals pu select ep.Id).ToList();
2853:              }
2854:   
2855:              return list.Distinct().ToList();
2856:          }
2857:   
2858:          ////////////////////////////////////////////////////////////////////////////
2859:   
2860:          /// <summary>
2861:          /// 
2862:          /// </summary>
2863:          public static List<string> SubPartyIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
2864:          {
2865:              List<string> list;
2866:   
2867:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2868:              {
2869:                  if (agcfEndpointIdList.Count <= 32)
2870:                  {
2871:                      list = (from sp in db.SubParties join e in agcfEndpointIdList on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
2872:                  }
2873:                  else if (agcfEndpointIdList.Count <= 64)
2874:                  {
2875:                      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();
2876:                      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();
2877:                  }
2878:                  else if (agcfEndpointIdList.Count <= 96)
2879:                  {
2880:                      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();
2881:                      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();
2882:                      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();
2883:                  }
2884:                  else //if (agcfEndpointIdList.Count <= 128)
2885:                  {
2886:                      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();
2887:                      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();
2888:                      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();
2889:                      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();
2890:                  }
2891:              }
2892:   
2893:              return list.Distinct().ToList();
2894:          }
2895:   
2896:          ////////////////////////////////////////////////////////////////////////////
2897:   
2898:          /// <summary>
2899:          /// 
2900:          /// </summary>
2901:          public static List<string> SubPartyIdListFromPartyIdList(List<string> partyIdList)
2902:          {
2903:              List<string> list;
2904:   
2905:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2906:              {
2907:                  if (partyIdList.Count <= 32)
2908:                  {
2909:                      list = (from sp in db.SubParties join pid in partyIdList on sp.PartyId equals pid select sp.Id).ToList();
2910:                  }
2911:                  else if (partyIdList.Count <= 64)
2912:                  {
2913:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
2914:                      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();
2915:                  }
2916:                  else if (partyIdList.Count <= 96)
2917:                  {
2918:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
2919:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
2920:                      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();
2921:                  }
2922:                  else //if (agcfEndpointIdList.Count <= 128)
2923:                  {
2924:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
2925:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
2926:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(64, 32) on sp.PartyId equals pid select sp.Id).ToList();
2927:                      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();
2928:                  }
2929:              }
2930:   
2931:              return list.Distinct().ToList();
2932:          }
2933:   
2934:          ////////////////////////////////////////////////////////////////////////////
2935:   
2936:          /// <summary>
2937:          /// 
2938:          /// </summary>
2939:          public static List<string> SubscriberIdListFromSubPartyIdList(List<string> subPartyIdList)
2940:          {
2941:              List<string> list;
2942:   
2943:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2944:              {
2945:                  if (subPartyIdList.Count <= 32)
2946:                  {
2947:                      list = (from s in db.Subscribers join spid in subPartyIdList on s.SubParty.Id equals spid select s.Id).ToList();
2948:                  }
2949:                  else if (subPartyIdList.Count <= 64)
2950:                  {
2951:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
2952:                      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();
2953:                  }
2954:                  else if (subPartyIdList.Count <= 96)
2955:                  {
2956:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
2957:                      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();
2958:                      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();
2959:                  }
2960:                  else //if (subPartyIdList.Count <= 128)
2961:                  {
2962:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
2963:                      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();
2964:                      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();
2965:                      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();
2966:                  }
2967:              }
2968:   
2969:              return list.Distinct().ToList();
2970:          }
2971:   
2972:          ////////////////////////////////////////////////////////////////////////////
2973:   
2974:          /// <summary>
2975:          /// 
2976:          /// </summary>
2977:          public static List<string> SubscriberIdListFromPartyIdList(List<string> partyIdList)
2978:          {
2979:              List<string> list;
2980:   
2981:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2982:              {
2983:                  if (partyIdList.Count <= 32)
2984:                  {
2985:                      list = (from s in db.Subscribers join pid in partyIdList on s.PartyId equals pid select s.Id).ToList();
2986:                  }
2987:                  else if (partyIdList.Count <= 64)
2988:                  {
2989:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
2990:                      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();
2991:                  }
2992:                  else if (partyIdList.Count <= 96)
2993:                  {
2994:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
2995:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
2996:                      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();
2997:                  }
2998:                  else //if (subPartyIdList.Count <= 128)
2999:                  {
3000:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3001:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
3002:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(64, 32) on s.PartyId equals pid select s.Id).ToList();
3003:                      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();
3004:                  }
3005:              }
3006:   
3007:              return list.Distinct().ToList();
3008:          }
3009:   
3010:          ////////////////////////////////////////////////////////////////////////////
3011:          ////////////////////////////////////////////////////////////////////////////   
3012:   
3013:          /// <summary>
3014:          /// 
3015:          /// </summary>
3016:          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)
3017:          {
3018:              int number;
3019:              long numberWithCountryCode;
3020:              string service, impuSipDomain, partyId, prividUser;
3021:   
3022:              foreach (var pi in partyIdList)
3023:              {
3024:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(pi);
3025:   
3026:                  number = int.Parse(service);
3027:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3028:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3029:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3030:                  prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
3031:   
3032:                  serviceList.Add(service);
3033:                  numberList.Add(number);
3034:                  serviceLongList.Add(numberWithCountryCode);
3035:                  impuSipDomainList.Add(impuSipDomain);
3036:                  //partyIdList.Add(partyId);
3037:                  prividUserList.Add(prividUser);
3038:              }
3039:   
3040:              foreach (var s in serviceList)
3041:              {
3042:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s);
3043:   
3044:                  number = int.Parse(service);
3045:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3046:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3047:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3048:                  prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
3049:   
3050:                  //serviceList.Add(service);
3051:                  numberList.Add(number);
3052:                  serviceLongList.Add(numberWithCountryCode);
3053:                  impuSipDomainList.Add(impuSipDomain);
3054:                  partyIdList.Add(partyId);
3055:                  prividUserList.Add(prividUser);
3056:              }
3057:   
3058:              serviceList = serviceList.Distinct().ToList();
3059:              numberList = numberList.Distinct().ToList();
3060:              serviceLongList = serviceLongList.Distinct().ToList();
3061:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3062:              partyIdList = partyIdList.Distinct().ToList();
3063:              prividUserList = prividUserList.Distinct().ToList();
3064:          }
3065:   
3066:          ////////////////////////////////////////////////////////////////////////////   
3067:   
3068:          /// <summary>
3069:          /// 
3070:          /// </summary>
3071:          public static void CollectServiceListFromServiceRequestServiceIdOrService2IdList(List<string> serviceRequestServiceIdListOrService2IdList, ref List<string> serviceList)
3072:          {
3073:              string service;
3074:   
3075:              foreach (var si in serviceRequestServiceIdListOrService2IdList)
3076:              {
3077:                  service = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceIdToService(si);
3078:                  serviceList.Add(service);
3079:              }
3080:   
3081:              serviceList = serviceList.Distinct().ToList();
3082:          }
3083:   
3084:          ////////////////////////////////////////////////////////////////////////////   
3085:   
3086:          /// <summary>
3087:          /// 
3088:          /// </summary>
3089:          public static void CollectNumbersFromAgcfEndpointList(List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList, ref List<string> serviceList, ref List<int> numberList, ref List<long> serviceLongList, ref List<string> impuSipDomainList, ref List<string> partyIdList)
3090:          {
3091:              int number;
3092:              long numberWithCountryCode;
3093:              string service, impuSipDomain, partyId;
3094:   
3095:              foreach (var ep in agcfEndpointList)
3096:              {
3097:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(ep.PrividUser);
3098:   
3099:                  number = int.Parse(service);
3100:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3101:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3102:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3103:   
3104:                  serviceList.Add(service);
3105:                  numberList.Add(number);
3106:                  serviceLongList.Add(numberWithCountryCode);
3107:                  impuSipDomainList.Add(impuSipDomain);
3108:                  partyIdList.Add(partyId);
3109:              }
3110:   
3111:              serviceList = serviceList.Distinct().ToList();
3112:              numberList = numberList.Distinct().ToList();
3113:              serviceLongList = serviceLongList.Distinct().ToList();
3114:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3115:              partyIdList = impuSipDomainList.Distinct().ToList();
3116:          }
3117:   
3118:          ////////////////////////////////////////////////////////////////////////////   
3119:   
3120:          /// <summary>
3121:          /// 
3122:          /// </summary>
3123:          public static void CollectNumbersFromSubscriberList(List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList, ref List<string> serviceList, ref List<int> numberList, ref List<long> serviceLongList, ref List<string> impuSipDomainList, ref List<string> partyIdList)
3124:          {
3125:              int number;
3126:              long numberWithCountryCode;
3127:              string service, impuSipDomain, partyId;
3128:   
3129:              foreach (var s in subscriberList)
3130:              {
3131:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s.PartyId);
3132:   
3133:                  number = int.Parse(service);
3134:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3135:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3136:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3137:   
3138:                  serviceList.Add(service);
3139:                  numberList.Add(number);
3140:                  serviceLongList.Add(numberWithCountryCode);
3141:                  impuSipDomainList.Add(impuSipDomain);
3142:                  partyIdList.Add(partyId);
3143:              }
3144:   
3145:              serviceList = serviceList.Distinct().ToList();
3146:              numberList = numberList.Distinct().ToList();
3147:              serviceLongList = serviceLongList.Distinct().ToList();
3148:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3149:              partyIdList = impuSipDomainList.Distinct().ToList();
3150:          }
3151:   
3152:          ////////////////////////////////////////////////////////////////////////////
3153:          ////////////////////////////////////////////////////////////////////////////   
3154:      }
3155:   
3156:      ////////////////////////////////////////////////////////////////////////////
3157:      ////////////////////////////////////////////////////////////////////////////   
3158:  }