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.Huawei.Onu> OnuList(List<string> onuIdList)
 971:          {
 972:              List<Ia.Ngn.Cl.Model.Huawei.Onu> list;
 973:   
 974:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 975:              {
 976:                  list = (from o in db.Onus join oid in onuIdList on o.Id equals oid select o).ToList();
 977:              }
 978:   
 979:              return list.Distinct().ToList();
 980:          }
 981:   
 982:          ////////////////////////////////////////////////////////////////////////////
 983:   
 984:          /// <summary>
 985:          /// 
 986:          /// </summary>
 987:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> EmsOntList(List<string> emsOntIdList)
 988:          {
 989:              List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> list;
 990:   
 991:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 992:              {
 993:                  list = (from eo in db.EmsOnts
 994:                          join oid in emsOntIdList on eo.Id equals oid
 995:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt()
 996:                          {
 997:                              Id = eo.Id,
 998:                              Access = eo.Access,
 999:                              ALIAS = eo.ALIAS,
1000:                              AUTH = eo.AUTH,
1001:                              CAPABPROF = eo.CAPABPROF,
1002:                              Created = eo.Created,
1003:                              DEV = eo.DEV,
1004:                              DID = eo.DID,
1005:                              EQUIPMENTID = eo.EQUIPMENTID,
1006:                              FN = eo.FN,
1007:                              GATE = eo.GATE,
1008:                              IP = eo.IP,
1009:                              MAINSOFTVERSION = eo.MAINSOFTVERSION,
1010:                              NAME = eo.NAME,
1011:                              ONTID = eo.ONTID,
1012:                              PN = eo.PN,
1013:                              ROUTEIP = eo.ROUTEIP,
1014:                              SERIALNUM = eo.SERIALNUM,
1015:                              SN = eo.SN,
1016:                              Updated = eo.Updated,
1017:                              VENDORID = eo.VENDORID,
1018:                              VLAN = eo.VLAN
1019:                          }).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.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdList(List<string> emsOntIdList)
1031:          {
1032:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1033:   
1034:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1035:              {
1036:                  list = (from eosi in db.EmsOntSipInfos join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid select eosi).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.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdList(List<string> emsOntIdList)
1048:          {
1049:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1050:   
1051:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1052:              {
1053:                  list = (from evpu in db.EmsVoipPstnUsers join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid select evpu).Include(o => o.EmsOnt).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.ServiceRequestOnt> ServiceRequestOntList(List<string> serviceRequestOntIdList)
1065:          {
1066:              List<Ia.Ngn.Cl.Model.ServiceRequestOnt> list;
1067:   
1068:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1069:              {
1070:                  list = (from sro in db.ServiceRequestOnts join sroid in serviceRequestOntIdList on sro.Id equals sroid select sro).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.ServiceRequestOntDetail> ServiceRequestOntDetailList(List<string> serviceRequestOntIdList)
1082:          {
1083:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1084:   
1085:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1086:              {
1087:                  list = (from srod in db.ServiceRequestOntDetails join sroid in serviceRequestOntIdList on srod.ServiceRequestOnt.Id equals sroid select srod).ToList();
1088:              }
1089:   
1090:              return list.Distinct().ToList();
1091:          }
1092:   
1093:          ////////////////////////////////////////////////////////////////////////////
1094:   
1095:          /// <summary>
1096:          /// 
1097:          /// </summary>
1098:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntList(List<string> nddOntIdList)
1099:          {
1100:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
1101:   
1102:              list = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdList on n.Id equals nid select n).ToList();
1103:   
1104:              return list.Distinct().ToList();
1105:          }
1106:   
1107:          ////////////////////////////////////////////////////////////////////////////
1108:   
1109:          /// <summary>
1110:          /// 
1111:          /// </summary>
1112:          public static List<Ia.Ngn.Cl.Model.Access> AccessList(List<string> accessIdList)
1113:          {
1114:              List<Ia.Ngn.Cl.Model.Access> list;
1115:   
1116:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1117:              {
1118:                  list = (from a in db.Accesses join aid in accessIdList on a.Id equals aid select a).ToList();
1119:              }
1120:   
1121:              return list.Distinct().ToList();
1122:          }
1123:   
1124:          ////////////////////////////////////////////////////////////////////////////
1125:   
1126:          /// <summary>
1127:          /// 
1128:          /// </summary>
1129:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAddress(int kuwaitNgnAreaId, string block, int street, int premisesOld, int premisesNew)
1130:          {
1131:              string streetString, premisesOldString, premisesNewString;
1132:              List<Ia.Ngn.Cl.Model.Access> list;
1133:   
1134:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1135:              {
1136:                  //oltIdList = kuwaitNgnArea.Site.Routers.SelectMany(v => v.Odfs.SelectMany(u => u.Olts.Select(w => w.Id))).ToList();
1137:   
1138:                  streetString = street.ToString();
1139:                  premisesOldString = premisesOld.ToString();
1140:                  premisesNewString = premisesNew.ToString();
1141:   
1142:                  list = (from a in db.Accesses
1143:                              //join oid in oltIdList on a.Olt equals oid
1144:                          where
1145:                          a.AreaId == kuwaitNgnAreaId
1146:                          &&
1147:                          (
1148:                          a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString
1149:                          || a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && premisesNew == 0
1150:                          || a.Block == block && a.Street == streetString && a.PremisesNew == premisesNewString && premisesOld == 0
1151:                          || a.Block == block && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString && street == 0
1152:                          || a.Block == block && a.PremisesOld == premisesOldString && street == 0 && premisesNew == 0
1153:                          || a.Block == block && a.PremisesNew == premisesNewString && street == 0 && premisesOld == 0
1154:                          || a.Block == block && a.Street == streetString && premisesOld == 0 && premisesNew == 0
1155:                          || a.Block == block && street == 0 && premisesOld == 0 && premisesNew == 0
1156:                          )
1157:                          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.Access> AccessListFromAreaAndBlock(int kuwaitNgnAreaId, string block)
1169:          {
1170:              List<Ia.Ngn.Cl.Model.Access> list;
1171:   
1172:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1173:              {
1174:                  list = (from a in db.Accesses where a.AreaId == kuwaitNgnAreaId && a.Block == block select a).ToList();
1175:              }
1176:   
1177:              return list.Distinct().ToList();
1178:          }
1179:   
1180:          ////////////////////////////////////////////////////////////////////////////
1181:   
1182:          /// <summary>
1183:          /// 
1184:          /// </summary>
1185:          public static List<Ia.Ngn.Cl.Model.ServiceInitialState> ServiceInitialStateList(List<string> serviceInitialStateIdList)
1186:          {
1187:              List<Ia.Ngn.Cl.Model.ServiceInitialState> list;
1188:   
1189:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1190:              {
1191:                  if (serviceInitialStateIdList.Count <= 32)
1192:                  {
1193:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList on sis.Id equals sisid select sis).ToList();
1194:                  }
1195:                  else if (serviceInitialStateIdList.Count <= 64)
1196:                  {
1197:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1198:                      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();
1199:                  }
1200:                  else if (serviceInitialStateIdList.Count <= 96)
1201:                  {
1202:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1203:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1204:                      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();
1205:                  }
1206:                  else if (serviceInitialStateIdList.Count <= 128)
1207:                  {
1208:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1209:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1210:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1211:                      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();
1212:                  }
1213:                  else if (serviceInitialStateIdList.Count <= 160)
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, serviceInitialStateIdList.Count - 128 - 1) on sis.Id equals sisid select sis).ToList();
1220:                  }
1221:                  else if (serviceInitialStateIdList.Count <= 192)
1222:                  {
1223:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1224:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1225:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1226:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1227:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, 32) on sis.Id equals sisid select sis).ToList();
1228:                      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();
1229:                  }
1230:                  else if (serviceInitialStateIdList.Count <= 224)
1231:                  {
1232:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1233:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1234:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1235:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1236:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, 32) on sis.Id equals sisid select sis).ToList();
1237:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(160, 32) on sis.Id equals sisid select sis).ToList();
1238:                      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();
1239:                  }
1240:                  else //if (serviceList.Count <= 256)
1241:                  {
1242:                      list = (from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(0, 32) on sis.Id equals sisid select sis).ToList();
1243:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(32, 32) on sis.Id equals sisid select sis).ToList();
1244:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(64, 32) on sis.Id equals sisid select sis).ToList();
1245:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(96, 32) on sis.Id equals sisid select sis).ToList();
1246:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(128, 32) on sis.Id equals sisid select sis).ToList();
1247:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(160, 32) on sis.Id equals sisid select sis).ToList();
1248:                      list = list.Union(from sis in db.ServiceInitialStates join sisid in serviceInitialStateIdList.GetRange(192, 32) on sis.Id equals sisid select sis).ToList();
1249:                      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();
1250:                  }
1251:              }
1252:   
1253:              return list.Distinct().ToList();
1254:          }
1255:   
1256:          ////////////////////////////////////////////////////////////////////////////
1257:   
1258:          /// <summary>
1259:          /// 
1260:          /// </summary>
1261:          public static List<Ia.Ngn.Cl.Model.Ont> OntList(List<string> ontIdList)
1262:          {
1263:              List<Ia.Ngn.Cl.Model.Ont> list;
1264:   
1265:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1266:              {
1267:                  list = (from o in db.Onts join oid in ontIdList on o.Id equals oid select o).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.OntOntPots> OntOntPotsListFromOntOntPotsIdList(List<string> ontOntPotsIdList)
1279:          {
1280:              List<Ia.Ngn.Cl.Model.OntOntPots> list;
1281:   
1282:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1283:              {
1284:                  list = (from oop in db.OntOntPotses join oid in ontOntPotsIdList on oop.Id equals oid select oop).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.OntServiceHsi> OntServiceHsiList(List<string> ontServiceHsiIdList)
1296:          {
1297:              List<Ia.Ngn.Cl.Model.OntServiceHsi> list;
1298:   
1299:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1300:              {
1301:                  list = (from osh in db.OntServiceHsis join oshid in ontServiceHsiIdList on osh.Id equals oshid select osh).ToList();
1302:              }
1303:   
1304:              return list.Distinct().ToList();
1305:          }
1306:   
1307:          ////////////////////////////////////////////////////////////////////////////
1308:   
1309:          /// <summary>
1310:          /// 
1311:          /// </summary>
1312:          public static List<Ia.Ngn.Cl.Model.OntServiceHsi> OntServiceHsiListFromOntIdList(List<string> ontIdList)
1313:          {
1314:              List<Ia.Ngn.Cl.Model.OntServiceHsi> list;
1315:   
1316:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1317:              {
1318:                  list = (from osh in db.OntServiceHsis join oid in ontIdList on osh.Ont.Id equals oid select osh).ToList();
1319:              }
1320:   
1321:              return list.Distinct().ToList();
1322:          }
1323:   
1324:          ////////////////////////////////////////////////////////////////////////////
1325:   
1326:          /// <summary>
1327:          /// 
1328:          /// </summary>
1329:          public static List<Ia.Ngn.Cl.Model.Event> EventList(List<long> eventIdList)
1330:          {
1331:              List<Ia.Ngn.Cl.Model.Event> list;
1332:   
1333:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1334:              {
1335:                  list = (from e in db.Events join eid in eventIdList on e.Id equals eid select e).ToList();
1336:              }
1337:   
1338:              return list.Distinct().ToList();
1339:          }
1340:   
1341:          ////////////////////////////////////////////////////////////////////////////
1342:   
1343:          /// <summary>
1344:          /// 
1345:          /// </summary>
1346:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> SubPartyList(List<string> subPartyIdList)
1347:          {
1348:              List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> list;
1349:   
1350:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1351:              {
1352:                  list = (from sp in db.SubParties
1353:                          join spid in subPartyIdList on sp.Id equals spid
1354:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
1355:                          {
1356:                              Id = sp.Id,
1357:                              PartyId = sp.PartyId,
1358:                              PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
1359:                              DisplayName = sp.DisplayName,
1360:                              Category = sp.Category,
1361:                              AssocOtasRealm = sp.AssocOtasRealm,
1362:                              ServiceSuspension = sp.ServiceSuspension,
1363:                              Created = sp.Created,
1364:                              Updated = sp.Updated
1365:                          }).ToList();
1366:              }
1367:   
1368:              return list.Distinct().ToList();
1369:          }
1370:   
1371:          ////////////////////////////////////////////////////////////////////////////
1372:   
1373:          /// <summary>
1374:          /// 
1375:          /// </summary>
1376:          public static List<Ia.Ngn.Cl.Model.Report> ReportList(List<int> reportIdList)
1377:          {
1378:              List<Ia.Ngn.Cl.Model.Report> list;
1379:   
1380:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1381:              {
1382:                  if (reportIdList.Count <= 32)
1383:                  {
1384:                      list = (from r in db.Reports join rid in reportIdList on r.Id equals rid select r).ToList();
1385:                  }
1386:                  else if (reportIdList.Count <= 64)
1387:                  {
1388:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1389:                      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();
1390:                  }
1391:                  else if (reportIdList.Count <= 96)
1392:                  {
1393:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1394:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1395:                      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();
1396:                  }
1397:                  else if (reportIdList.Count <= 128)
1398:                  {
1399:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1400:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1401:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1402:                      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();
1403:                  }
1404:                  else if (reportIdList.Count <= 160)
1405:                  {
1406:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1407:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1408:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1409:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1410:                      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();
1411:                  }
1412:                  else if (reportIdList.Count <= 192)
1413:                  {
1414:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1415:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1416:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1417:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1418:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1419:                      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();
1420:                  }
1421:                  else if (reportIdList.Count <= 224)
1422:                  {
1423:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1424:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1425:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1426:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1427:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1428:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).ToList();
1429:                      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();
1430:                  }
1431:                  else //if (reportIdList.Count <= 256)
1432:                  {
1433:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1434:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1435:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1436:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1437:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1438:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).ToList();
1439:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(192, 32) on r.Id equals rid select r).ToList();
1440:                      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();
1441:                  }
1442:              }
1443:   
1444:              return list.Distinct().ToList();
1445:          }
1446:   
1447:          ////////////////////////////////////////////////////////////////////////////
1448:   
1449:          /// <summary>
1450:          /// 
1451:          /// </summary>
1452:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> HuSbrList(List<string> huSbrImpuList)
1453:          {
1454:              List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> list;
1455:   
1456:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1457:              {
1458:                  list = (from h in db.HuSbrs
1459:                          join hid in huSbrImpuList on h.IMPU equals hid
1460:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
1461:                          {
1462:                              COP = h.COP,
1463:                              CSC = h.CSC,
1464:                              Id = h.Id,
1465:                              IMPU = h.IMPU,
1466:                              ITT = h.ITT,
1467:                              LP = h.LP,
1468:                              NS3PTY = h.NS3PTY,
1469:                              NSABRC = h.NSABRC,
1470:                              NSCBA = h.NSCBA,
1471:                              NSCFU = h.NSCFU,
1472:                              NSCLIP = h.NSCLIP,
1473:                              NSCW = h.NSCW,
1474:                              NSFAX = h.NSFAX,
1475:                              NSHOLD = h.NSHOLD,
1476:                              NSNPTY = h.NSNPTY,
1477:                              NSWAKE_UP = h.NSWAKE_UP,
1478:                              Created = h.Created,
1479:                              Updated = h.Updated
1480:                          }).ToList();
1481:              }
1482:   
1483:              return list.Distinct().ToList();
1484:          }
1485:   
1486:          ////////////////////////////////////////////////////////////////////////////
1487:   
1488:          /// <summary>
1489:          /// 
1490:          /// </summary>
1491:          public static List<Ia.Ngn.Cl.Model.Huawei.Owsbr> OwsbrList(List<string> owsbrImpuList)
1492:          {
1493:              List<Ia.Ngn.Cl.Model.Huawei.Owsbr> list;
1494:   
1495:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1496:              {
1497:                  list = (from o in db.Owsbrs join oid in owsbrImpuList on o.IMPU equals oid select o).ToList();
1498:              }
1499:   
1500:              return list.Distinct().ToList();
1501:          }
1502:   
1503:          ////////////////////////////////////////////////////////////////////////////
1504:   
1505:          /// <summary>
1506:          /// 
1507:          /// </summary>
1508:          public static List<Ia.Ngn.Cl.Model.OntServiceVoip> OntServiceVoipList(List<string> ontServiceVoipIdList)
1509:          {
1510:              List<Ia.Ngn.Cl.Model.OntServiceVoip> list;
1511:   
1512:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1513:              {
1514:                  if (ontServiceVoipIdList.Count <= 32)
1515:                  {
1516:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList on ov.Id equals ovid select ov).ToList();
1517:                  }
1518:                  else
1519:                  {
1520:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList.GetRange(0, 32) on ov.Id equals ovid select ov).ToList();
1521:                      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();
1522:                  }
1523:              }
1524:   
1525:              return list.Distinct().ToList();
1526:          }
1527:   
1528:          ////////////////////////////////////////////////////////////////////////////
1529:   
1530:          /// <summary>
1531:          /// 
1532:          /// </summary>
1533:          public static List<Ia.Ngn.Cl.Model.Ui.Service2> ServiceList(List<string> serviceIdList)
1534:          {
1535:              List<Ia.Ngn.Cl.Model.Service2> list;
1536:              List<Ia.Ngn.Cl.Model.Ui.Service2> uiList;
1537:   
1538:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1539:              {
1540:                  if (serviceIdList.Count <= 32)
1541:                  {
1542:                      list = (from s in db.Service2s join sid in serviceIdList on s.Id equals sid select s).ToList();
1543:                  }
1544:                  else if (serviceIdList.Count <= 64)
1545:                  {
1546:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1547:                      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();
1548:                  }
1549:                  else if (serviceIdList.Count <= 96)
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, serviceIdList.Count - 64 - 1) on s.Id equals sid select s).ToList();
1554:                  }
1555:                  else if (serviceIdList.Count <= 128)
1556:                  {
1557:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1558:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1559:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1560:                      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();
1561:                  }
1562:                  else if (serviceIdList.Count <= 160)
1563:                  {
1564:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1565:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1566:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1567:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1568:                      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();
1569:                  }
1570:                  else if (serviceIdList.Count <= 192)
1571:                  {
1572:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1573:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1574:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1575:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1576:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1577:                      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();
1578:                  }
1579:                  else if (serviceIdList.Count <= 224)
1580:                  {
1581:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1582:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1583:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1584:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1585:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1586:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1587:                      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();
1588:                  }
1589:                  else if (serviceIdList.Count <= 256)
1590:                  {
1591:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1592:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1593:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1594:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1595:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1596:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1597:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1598:                      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();
1599:                  }
1600:                  else if (serviceIdList.Count <= 288)
1601:                  {
1602:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1603:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1604:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1605:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1606:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1607:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1608:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1609:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1610:                      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();
1611:                  }
1612:                  else if (serviceIdList.Count <= 320)
1613:                  {
1614:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1615:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1616:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1617:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1618:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1619:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1620:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1621:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1622:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1623:                      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();
1624:                  }
1625:                  else if (serviceIdList.Count <= 352)
1626:                  {
1627:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1628:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1629:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1630:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1631:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1632:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1633:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1634:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1635:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1636:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1637:                      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();
1638:                  }
1639:                  else if (serviceIdList.Count <= 384)
1640:                  {
1641:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1642:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1643:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1644:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1645:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1646:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1647:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1648:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1649:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1650:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1651:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1652:                      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();
1653:                  }
1654:                  else if (serviceIdList.Count <= 416)
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, serviceIdList.Count - 384 - 1) on s.Id equals sid select s).ToList();
1669:                  }
1670:                  else if (serviceIdList.Count <= 448)
1671:                  {
1672:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1673:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1674:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1675:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1676:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1677:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1678:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1679:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1680:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1681:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1682:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1683:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1684:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1685:                      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();
1686:                  }
1687:                  else if (serviceIdList.Count <= 480)
1688:                  {
1689:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1690:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1691:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1692:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1693:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1694:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1695:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1696:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1697:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1698:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1699:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1700:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1701:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1702:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1703:                      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();
1704:                  }
1705:                  else if (serviceIdList.Count <= 512)
1706:                  {
1707:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1708:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1709:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1710:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1711:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1712:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1713:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1714:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1715:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1716:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1717:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1718:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1719:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1720:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1721:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
1722:                      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();
1723:                  }
1724:                  else if (serviceIdList.Count <= 544)
1725:                  {
1726:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1727:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1728:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1729:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1730:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1731:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1732:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1733:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1734:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1735:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1736:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1737:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1738:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1739:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1740:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
1741:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).ToList();
1742:                      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();
1743:                  }
1744:                  else //if (serviceIdList.Count <= ??)
1745:                  {
1746:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
1747:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
1748:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
1749:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
1750:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
1751:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
1752:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
1753:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
1754:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
1755:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
1756:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
1757:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
1758:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
1759:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
1760:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
1761:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).ToList();
1762:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, 32) on s.Id equals sid select s).ToList();
1763:                      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();
1764:                  }
1765:   
1766:                  uiList = (from s in list
1767:                            select new Ia.Ngn.Cl.Model.Ui.Service2()
1768:                            {
1769:                                Id = s.Id,
1770:                                AbbriviatedCalling = s.AbbriviatedCalling,
1771:                                AlarmCall = s.AlarmCall,
1772:                                CallBarring = s.CallBarring,
1773:                                CallerId = s.CallerId,
1774:                                CallForwarding = s.CallForwarding,
1775:                                CallWaiting = s.CallWaiting,
1776:                                ConferenceCall = s.ConferenceCall,
1777:                                Created = s.Created,
1778:                                InternationalCalling = s.InternationalCalling,
1779:                                InternationalCallingUserControlled = s.InternationalCallingUserControlled,
1780:                                LineCard = s.LineCard,
1781:                                Pin = s.Pin,
1782:                                Service = s.Service,
1783:                                ServiceType = s.ServiceType,
1784:                                ServiceSuspension = s.ServiceSuspension,
1785:                                ServiceTypeName = s.ServiceType.ToString(),
1786:                                Updated = s.Updated,
1787:                                AccessId = (s.Access != null) ? s.Access.Id : string.Empty
1788:                            }).ToList();
1789:              }
1790:   
1791:              return uiList.Distinct().ToList();
1792:          }
1793:   
1794:          ////////////////////////////////////////////////////////////////////////////
1795:   
1796:          /// <summary>
1797:          /// 
1798:          /// </summary>
1799:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> SubscriberList(List<string> subscriberIdList)
1800:          {
1801:              List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> list;
1802:   
1803:              // below: db.Subscribers contains XML fields which can not be evaluated in a Union() function.
1804:   
1805:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1806:              {
1807:                  list = (from s in db.Subscribers
1808:                          join sid in subscriberIdList on s.Id equals sid
1809:                          select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
1810:                          {
1811:                              Id = s.Id,
1812:                              AlternateOtasRealm = s.AlternateOtasRealm,
1813:                              PartyId = s.PartyId,
1814:                              AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
1815:                              AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
1816:                              CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
1817:                              CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
1818:                              CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
1819:                              ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
1820:                              InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
1821:                              InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
1822:                              //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
1823:                              Created = s.Created,
1824:                              Updated = s.Updated,
1825:                          }).ToList();
1826:              }
1827:   
1828:              return list.Distinct().ToList();
1829:          }
1830:   
1831:          ////////////////////////////////////////////////////////////////////////////
1832:   
1833:          /// <summary>
1834:          /// 
1835:          /// </summary>
1836:          public static List<string> AccessIdList(int oltId, int ponNumber, int ontInternalNumber)
1837:          {
1838:              List<string> list;
1839:   
1840:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1841:              {
1842:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber && a.Ont == ontInternalNumber select a.Id).ToList();
1843:              }
1844:   
1845:              return list.Distinct().ToList();
1846:          }
1847:   
1848:          ////////////////////////////////////////////////////////////////////////////
1849:   
1850:          /// <summary>
1851:          /// 
1852:          /// </summary>
1853:          public static List<string> AccessIdList(int oltId, int ponNumber)
1854:          {
1855:              List<string> list;
1856:   
1857:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1858:              {
1859:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber select a.Id).ToList();
1860:              }
1861:   
1862:              return list.Distinct().ToList();
1863:          }
1864:   
1865:          ////////////////////////////////////////////////////////////////////////////
1866:   
1867:          /// <summary>
1868:          /// 
1869:          /// </summary>
1870:          public static List<string> OnuIdListFromNddOntIdList(List<string> nddOntIdList)
1871:          {
1872:              List<string> list;
1873:   
1874:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1875:              {
1876:                  list = (from o in db.Onus join nid in nddOntIdList on o.Id equals nid select o.Id).ToList();
1877:              }
1878:   
1879:              return list.Distinct().ToList();
1880:          }
1881:   
1882:          ////////////////////////////////////////////////////////////////////////////
1883:   
1884:          /// <summary>
1885:          /// 
1886:          /// </summary>
1887:          public static List<string> EmsOntIdListFromNddOntIdList(List<string> nddOntIdList)
1888:          {
1889:              List<string> list;
1890:   
1891:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1892:              {
1893:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.Id).ToList();
1894:              }
1895:   
1896:              return list.Distinct().ToList();
1897:          }
1898:   
1899:          ////////////////////////////////////////////////////////////////////////////
1900:   
1901:          /// <summary>
1902:          /// 
1903:          /// </summary>
1904:          public static List<string> EmsOntIpListFromNddOntIdList(List<string> nddOntIdList)
1905:          {
1906:              List<string> list;
1907:   
1908:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1909:              {
1910:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.IP).ToList();
1911:              }
1912:   
1913:              return list.Distinct().ToList();
1914:          }
1915:   
1916:          ////////////////////////////////////////////////////////////////////////////
1917:   
1918:          /// <summary>
1919:          /// 
1920:          /// </summary>
1921:          public static List<string> SbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
1922:          {
1923:              List<string> list;
1924:   
1925:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1926:              {
1927:                  list = (from s in db.HuSbrs join i in impuSipDomainList on s.IMPU equals i select s.IMPU).ToList();
1928:              }
1929:   
1930:              return list.Distinct().ToList();
1931:          }
1932:   
1933:          ////////////////////////////////////////////////////////////////////////////
1934:   
1935:          /// <summary>
1936:          /// 
1937:          /// </summary>
1938:          public static List<string> OwSbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
1939:          {
1940:              List<string> list;
1941:   
1942:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1943:              {
1944:                  list = (from o in db.Owsbrs join i in impuSipDomainList on o.IMPU equals i select o.IMPU).ToList();
1945:              }
1946:   
1947:              return list.Distinct().ToList();
1948:          }
1949:   
1950:          ////////////////////////////////////////////////////////////////////////////
1951:   
1952:          /// <summary>
1953:          /// 
1954:          /// </summary>
1955:          public static List<string> ServiceRequestServiceIdListFromAccessIdList(List<string> accessIdList)
1956:          {
1957:              List<string> list;
1958:   
1959:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1960:              {
1961:                  list = (from srs in db.ServiceRequestServices join aid in accessIdList on srs.Access.Id equals aid select srs.Id).ToList();
1962:              }
1963:   
1964:              return list.Distinct().ToList();
1965:          }
1966:   
1967:          ////////////////////////////////////////////////////////////////////////////
1968:   
1969:          /// <summary>
1970:          /// 
1971:          /// </summary>
1972:          public static List<string> ServiceRequestServiceIdListFromServiceList(List<string> serviceList)
1973:          {
1974:              List<string> list;
1975:   
1976:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1977:              {
1978:                  list = (from srs in db.ServiceRequestServices join si in serviceList on srs.Service equals si select srs.Id).ToList();
1979:              }
1980:   
1981:              return list.Distinct().ToList();
1982:          }
1983:   
1984:          ////////////////////////////////////////////////////////////////////////////
1985:   
1986:          /// <summary>
1987:          /// 
1988:          /// </summary>
1989:          public static List<string> ServiceIdListFromServiceList(List<string> serviceList)
1990:          {
1991:              List<string> list;
1992:   
1993:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1994:              {
1995:                  if (serviceList.Count <= 32)
1996:                  {
1997:                      list = (from s in db.Service2s join si in serviceList on s.Service equals si select s.Id).ToList();
1998:                  }
1999:                  else if (serviceList.Count <= 64)
2000:                  {
2001:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2002:                      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();
2003:                  }
2004:                  else if (serviceList.Count <= 96)
2005:                  {
2006:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2007:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2008:                      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();
2009:                  }
2010:                  else if (serviceList.Count <= 128)
2011:                  {
2012:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2013:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2014:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2015:                      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();
2016:                  }
2017:                  else if (serviceList.Count <= 160)
2018:                  {
2019:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2020:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2021:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2022:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2023:                      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();
2024:                  }
2025:                  else if (serviceList.Count <= 192)
2026:                  {
2027:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2028:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2029:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2030:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2031:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
2032:                      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();
2033:                  }
2034:                  else if (serviceList.Count <= 224)
2035:                  {
2036:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2037:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2038:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2039:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2040:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
2041:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
2042:                      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();
2043:                  }
2044:                  else //if (serviceList.Count <= 256)
2045:                  {
2046:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2047:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2048:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2049:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2050:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
2051:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
2052:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, 32) on s.Service equals si select s.Id).ToList();
2053:                      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();
2054:                  }
2055:              }
2056:   
2057:              return list.Distinct().ToList();
2058:          }
2059:   
2060:          ////////////////////////////////////////////////////////////////////////////
2061:   
2062:          /// <summary>
2063:          /// 
2064:          /// </summary>
2065:          public static List<string> ServiceInitialStateIdListFromAccessIdList(List<string> accessIdList)
2066:          {
2067:              List<string> list;
2068:   
2069:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2070:              {
2071:                  list = (from sis in db.ServiceInitialStates join aid in accessIdList on sis.Access.Id equals aid select sis.Id).ToList();
2072:              }
2073:   
2074:              return list.Distinct().ToList();
2075:          }
2076:   
2077:          ////////////////////////////////////////////////////////////////////////////
2078:   
2079:          /// <summary>
2080:          /// 
2081:          /// </summary>
2082:          public static List<string> ServiceInitialStateIdListFromServiceList(List<string> serviceList)
2083:          {
2084:              List<string> list;
2085:   
2086:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2087:              {
2088:                  if (serviceList.Count <= 32)
2089:                  {
2090:                      list = (from sis in db.ServiceInitialStates join s in serviceList on sis.Service equals s select sis.Id).ToList();
2091:                  }
2092:                  else if (serviceList.Count <= 64)
2093:                  {
2094:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2095:                      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();
2096:                  }
2097:                  else if (serviceList.Count <= 96)
2098:                  {
2099:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2100:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2101:                      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();
2102:                  }
2103:                  else if (serviceList.Count <= 128)
2104:                  {
2105:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2106:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2107:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2108:                      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();
2109:                  }
2110:                  else if (serviceList.Count <= 160)
2111:                  {
2112:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2113:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2114:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2115:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2116:                      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();
2117:                  }
2118:                  else if (serviceList.Count <= 192)
2119:                  {
2120:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2121:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2122:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2123:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2124:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, 32) on sis.Service equals s select sis.Id).ToList();
2125:                      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();
2126:                  }
2127:                  else if (serviceList.Count <= 224)
2128:                  {
2129:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2130:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2131:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2132:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2133:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, 32) on sis.Service equals s select sis.Id).ToList();
2134:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(160, 32) on sis.Service equals s select sis.Id).ToList();
2135:                      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();
2136:                  }
2137:                  else //if (serviceList.Count <= 256)
2138:                  {
2139:                      list = (from sis in db.ServiceInitialStates join s in serviceList.GetRange(0, 32) on sis.Service equals s select sis.Id).ToList();
2140:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(32, 32) on sis.Service equals s select sis.Id).ToList();
2141:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(64, 32) on sis.Service equals s select sis.Id).ToList();
2142:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(96, 32) on sis.Service equals s select sis.Id).ToList();
2143:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(128, 32) on sis.Service equals s select sis.Id).ToList();
2144:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(160, 32) on sis.Service equals s select sis.Id).ToList();
2145:                      list = list.Union(from sis in db.ServiceInitialStates join s in serviceList.GetRange(192, 32) on sis.Service equals s select sis.Id).ToList();
2146:                      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();
2147:                  }
2148:              }
2149:   
2150:              return list.Distinct().ToList();
2151:          }
2152:   
2153:          ////////////////////////////////////////////////////////////////////////////
2154:   
2155:          /// <summary>
2156:          /// 
2157:          /// </summary>
2158:          public static List<int> ReportIdListFromServiceList(List<string> serviceList)
2159:          {
2160:              List<int> list;
2161:   
2162:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
2163:              // <type id="2" name="Ont Name" arabicName=""/>
2164:   
2165:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2166:              {
2167:                  if (serviceList.Count <= 32)
2168:                  {
2169:                      list = (from r in db.Reports join s in serviceList on r.Service equals s select r.Id).ToList();
2170:                  }
2171:                  else if (serviceList.Count <= 64)
2172:                  {
2173:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2174:                      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();
2175:                  }
2176:                  else if (serviceList.Count <= 96)
2177:                  {
2178:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2179:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2180:                      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();
2181:                  }
2182:                  else if (serviceList.Count <= 128)
2183:                  {
2184:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2185:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2186:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2187:                      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();
2188:                  }
2189:                  else if (serviceList.Count <= 160)
2190:                  {
2191:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2192:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2193:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2194:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2195:                      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();
2196:                  }
2197:                  else if (serviceList.Count <= 192)
2198:                  {
2199:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2200:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2201:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2202:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2203:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2204:                      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();
2205:                  }
2206:                  else if (serviceList.Count <= 224)
2207:                  {
2208:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2209:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2210:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2211:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2212:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2213:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
2214:                      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();
2215:                  }
2216:                  else //if (serviceList.Count <= 256)
2217:                  {
2218:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2219:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2220:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2221:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2222:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2223:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
2224:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
2225:                      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();
2226:                  }
2227:              }
2228:   
2229:              return list.Distinct().ToList();
2230:          }
2231:   
2232:          ////////////////////////////////////////////////////////////////////////////
2233:   
2234:          /// <summary>
2235:          /// 
2236:          /// </summary>
2237:          public static List<string> ServiceIdListFromAccessIdList(List<string> accessIdList)
2238:          {
2239:              List<string> list;
2240:   
2241:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2242:              {
2243:                  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();
2244:              }
2245:   
2246:              return list.Distinct().ToList();
2247:          }
2248:   
2249:          ////////////////////////////////////////////////////////////////////////////
2250:   
2251:          /// <summary>
2252:          /// 
2253:          /// </summary>
2254:          public static List<string> AccessIdListFromServiceList(List<string> serviceList)
2255:          {
2256:              List<string> list;
2257:   
2258:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2259:              {
2260:                  list = (from s in db.Service2s join si in serviceList on s.Service equals si where s.Access != null select s.Access.Id).ToList();
2261:              }
2262:   
2263:              return list.Distinct().ToList();
2264:          }
2265:   
2266:          ////////////////////////////////////////////////////////////////////////////
2267:   
2268:          /// <summary>
2269:          /// 
2270:          /// </summary>
2271:          public static List<string> AccessIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
2272:          {
2273:              List<string> list;
2274:   
2275:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2276:              {
2277:                  list = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList on srs.Id equals srsid where srs.Access != null select srs.Access.Id).ToList();
2278:              }
2279:   
2280:              return list.Distinct().ToList();
2281:          }
2282:   
2283:          ////////////////////////////////////////////////////////////////////////////
2284:   
2285:          /// <summary>
2286:          /// 
2287:          /// </summary>
2288:          public static List<string> ServiceRequestOntIdListFromAccessIdList(List<string> accessIdList)
2289:          {
2290:              List<string> list;
2291:   
2292:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2293:              {
2294:                  list = (from sro in db.ServiceRequestOnts join aid in accessIdList on sro.Access.Id equals aid select sro.Id).ToList();
2295:              }
2296:   
2297:              return list.Distinct().ToList();
2298:          }
2299:   
2300:          ////////////////////////////////////////////////////////////////////////////
2301:   
2302:          /// <summary>
2303:          /// 
2304:          /// </summary>
2305:          public static List<int> ServiceRequestIdListFromServiceList(List<string> serviceList)
2306:          {
2307:              List<int> list, numberList;
2308:   
2309:              if (serviceList.Count > 0)
2310:              {
2311:                  numberList = new List<int>();
2312:   
2313:                  foreach (string s in serviceList)
2314:                  {
2315:                      if (int.TryParse(s, out int i)) numberList.Add(i);
2316:                  }
2317:   
2318:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2319:                  {
2320:                      if (serviceList.Count <= 32)
2321:                      {
2322:                          list = (from sr in db.ServiceRequests join n in numberList on sr.Number equals n select sr.Id).ToList();
2323:                      }
2324:                      else if (serviceList.Count <= 64)
2325:                      {
2326:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2327:                          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();
2328:                      }
2329:                      else if (serviceList.Count <= 96)
2330:                      {
2331:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2332:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2333:                          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();
2334:                      }
2335:                      else if (serviceList.Count <= 128)
2336:                      {
2337:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2338:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2339:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2340:                          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();
2341:                      }
2342:                      else if (serviceList.Count <= 160)
2343:                      {
2344:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2345:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2346:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2347:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2348:                          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();
2349:                      }
2350:                      else if (serviceList.Count <= 192)
2351:                      {
2352:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2353:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2354:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2355:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2356:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, 32) on sr.Number equals n select sr.Id).ToList();
2357:                          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();
2358:                      }
2359:                      else if (serviceList.Count <= 224)
2360:                      {
2361:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2362:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2363:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2364:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2365:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, 32) on sr.Number equals n select sr.Id).ToList();
2366:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(160, 32) on sr.Number equals n select sr.Id).ToList();
2367:                          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();
2368:                      }
2369:                      else //if (serviceList.Count <= 256)
2370:                      {
2371:                          list = (from sr in db.ServiceRequests join n in numberList.GetRange(0, 32) on sr.Number equals n select sr.Id).ToList();
2372:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(32, 32) on sr.Number equals n select sr.Id).ToList();
2373:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(64, 32) on sr.Number equals n select sr.Id).ToList();
2374:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(96, 32) on sr.Number equals n select sr.Id).ToList();
2375:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(128, 32) on sr.Number equals n select sr.Id).ToList();
2376:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(160, 32) on sr.Number equals n select sr.Id).ToList();
2377:                          list = list.Union(from sr in db.ServiceRequests join n in numberList.GetRange(192, 32) on sr.Number equals n select sr.Id).ToList();
2378:                          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();
2379:                      }
2380:                  }
2381:              }
2382:              else
2383:              {
2384:                  list = new List<int>();
2385:              }
2386:   
2387:              return list.Distinct().ToList();
2388:          }
2389:   
2390:          ////////////////////////////////////////////////////////////////////////////
2391:   
2392:          /// <summary>
2393:          /// 
2394:          /// </summary>
2395:          public static List<int> ServiceRequestTypeIdListFromServiceRequestIdList(List<int> serviceRequestIdList)
2396:          {
2397:              List<int> list;
2398:   
2399:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2400:              {
2401:                  if (serviceRequestIdList.Count <= 32)
2402:                  {
2403:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2404:                  }
2405:                  else if (serviceRequestIdList.Count <= 64)
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, serviceRequestIdList.Count - 32 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2409:                  }
2410:                  else if (serviceRequestIdList.Count <= 96)
2411:                  {
2412:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, serviceRequestIdList.Count - 64 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2415:                  }
2416:                  else if (serviceRequestIdList.Count <= 128)
2417:                  {
2418:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2419:                      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();
2420:                      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();
2421:                      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();
2422:                  }
2423:                  else if (serviceRequestIdList.Count <= 160)
2424:                  {
2425:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 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(128, serviceRequestIdList.Count - 128 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2430:                  }
2431:                  else if (serviceRequestIdList.Count <= 192)
2432:                  {
2433:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2434:                      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();
2435:                      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();
2436:                      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();
2437:                      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();
2438:                      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();
2439:                  }
2440:                  else if (serviceRequestIdList.Count <= 224)
2441:                  {
2442:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2446:                      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();
2447:                      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();
2448:                      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();
2449:                  }
2450:                  else if (serviceRequestIdList.Count <= 256)
2451:                  {
2452:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 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(128, 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(160, 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(192, 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(224, serviceRequestIdList.Count - 224 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2460:                  }
2461:                  else if (serviceRequestIdList.Count <= 288)
2462:                  {
2463:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2464:                      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();
2465:                      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();
2466:                      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();
2467:                      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();
2468:                      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();
2469:                      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();
2470:                      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();
2471:                      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();
2472:                  }
2473:                  else if (serviceRequestIdList.Count <= 320)
2474:                  {
2475:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2479:                      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();
2480:                      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();
2481:                      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();
2482:                      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();
2483:                      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();
2484:                      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();
2485:                  }
2486:                  else if (serviceRequestIdList.Count <= 352)
2487:                  {
2488:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 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(128, 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(160, 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(192, 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(224, 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(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2497:                      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();
2498:                      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();
2499:                  }
2500:                  else if (serviceRequestIdList.Count <= 384)
2501:                  {
2502:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 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(128, 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(160, 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(192, 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(224, 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(256, 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(288, 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(320, 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(352, serviceRequestIdList.Count - 352 - 1) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2514:                  }
2515:                  else if (serviceRequestIdList.Count <= 416)
2516:                  {
2517:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2518:                      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();
2519:                      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();
2520:                      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();
2521:                      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();
2522:                      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();
2523:                      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();
2524:                      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();
2525:                      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();
2526:                      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();
2527:                      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();
2528:                      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();
2529:                      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();
2530:                  }
2531:                  else if (serviceRequestIdList.Count <= 448)
2532:                  {
2533:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2536:                      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();
2537:                      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();
2538:                      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();
2539:                      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();
2540:                      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();
2541:                      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();
2542:                      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();
2543:                      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();
2544:                      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();
2545:                      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();
2546:                      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();
2547:                  }
2548:                  else if (serviceRequestIdList.Count <= 480)
2549:                  {
2550:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 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(32, 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(64, 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(96, 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(128, 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(160, 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(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2557:                      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();
2558:                      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();
2559:                      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();
2560:                      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();
2561:                      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();
2562:                      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();
2563:                      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();
2564:                      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();
2565:                  }
2566:                  else if (serviceRequestIdList.Count <= 512)
2567:                  {
2568:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2569:                      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();
2570:                      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();
2571:                      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();
2572:                      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();
2573:                      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();
2574:                      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();
2575:                      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();
2576:                      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();
2577:                      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();
2578:                      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();
2579:                      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();
2580:                      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();
2581:                      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();
2582:                      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();
2583:                      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();
2584:                  }
2585:                  else if (serviceRequestIdList.Count <= 544)
2586:                  {
2587:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2588:                      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();
2589:                      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();
2590:                      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();
2591:                      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();
2592:                      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();
2593:                      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();
2594:                      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();
2595:                      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();
2596:                      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();
2597:                      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();
2598:                      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();
2599:                      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();
2600:                      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();
2601:                      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();
2602:                      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();
2603:                      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();
2604:                  }
2605:                  else //if (serviceRequestIdList.Count <= ??)
2606:                  {
2607:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2608:                      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();
2609:                      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();
2610:                      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();
2611:                      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();
2612:                      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();
2613:                      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();
2614:                      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();
2615:                      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();
2616:                      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();
2617:                      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();
2618:                      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();
2619:                      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();
2620:                      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();
2621:                      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();
2622:                      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();
2623:                      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();
2624:                      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();
2625:                  }
2626:              }
2627:   
2628:              return list.Distinct().ToList();
2629:          }
2630:   
2631:          ////////////////////////////////////////////////////////////////////////////
2632:   
2633:          /// <summary>
2634:          /// 
2635:          /// </summary>
2636:          public static List<string> NddOntIdList(int oltId, int ponNumber, int ontInternalNumber)
2637:          {
2638:              List<string> list;
2639:   
2640:              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();
2641:   
2642:              return list.Distinct().ToList();
2643:          }
2644:   
2645:          ////////////////////////////////////////////////////////////////////////////
2646:   
2647:          /// <summary>
2648:          /// 
2649:          /// </summary>
2650:          public static List<string> NddOntIdList(int oltId, int ponNumber)
2651:          {
2652:              List<string> list;
2653:   
2654:              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();
2655:   
2656:              return list.Distinct().ToList();
2657:          }
2658:   
2659:          ////////////////////////////////////////////////////////////////////////////
2660:   
2661:          /// <summary>
2662:          /// 
2663:          /// </summary>
2664:          public static List<string> NddOntIdListFromAccessIdList(List<string> accessIdList)
2665:          {
2666:              List<string> list;
2667:   
2668:              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();
2669:   
2670:              return list.Distinct().ToList();
2671:          }
2672:   
2673:          ////////////////////////////////////////////////////////////////////////////
2674:   
2675:          /// <summary>
2676:          /// 
2677:          /// </summary>
2678:          public static List<string> OntServiceVoipIpList(List<string> ontServiceVoipIdList)
2679:          {
2680:              List<string> list;
2681:   
2682:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2683:              {
2684:                  if (ontServiceVoipIdList.Count <= 32)
2685:                  {
2686:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList on osv.Id equals osvid select osv.Ip).ToList();
2687:                  }
2688:                  else
2689:                  {
2690:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList.GetRange(0, 32) on osv.Id equals osvid select osv.Ip).ToList();
2691:                      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();
2692:                  }
2693:              }
2694:   
2695:              return list.Distinct().ToList();
2696:          }
2697:   
2698:          ////////////////////////////////////////////////////////////////////////////
2699:   
2700:          /// <summary>
2701:          /// 
2702:          /// </summary>
2703:          public static List<string> NddPonIpList(int oltId, int ponNumber)
2704:          {
2705:              List<string> list;
2706:   
2707:              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();
2708:   
2709:              return list.Distinct().ToList();
2710:          }
2711:   
2712:          ////////////////////////////////////////////////////////////////////////////
2713:   
2714:          /// <summary>
2715:          /// 
2716:          /// </summary>
2717:          public static List<string> OntIdListFromNddOntIdList(List<string> nddOntIdList)
2718:          {
2719:              List<string> list;
2720:   
2721:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2722:              {
2723:                  list = (from o in db.Onts join nid in nddOntIdList on o.Id equals nid select o.Id).ToList();
2724:              }
2725:   
2726:              return list.Distinct().ToList();
2727:          }
2728:   
2729:          ////////////////////////////////////////////////////////////////////////////
2730:   
2731:          /// <summary>
2732:          /// 
2733:          /// </summary>
2734:          public static List<string> OntOntPotsIdListFromOntIdList(List<string> ontIdList)
2735:          {
2736:              List<string> list;
2737:   
2738:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2739:              {
2740:                  list = (from oop in db.OntOntPotses join oid in ontIdList on oop.Ont.Id equals oid select oop.Id).ToList();
2741:              }
2742:   
2743:              return list.Distinct().ToList();
2744:          }
2745:   
2746:          ////////////////////////////////////////////////////////////////////////////
2747:   
2748:          /// <summary>
2749:          /// 
2750:          /// </summary>
2751:          public static List<string> OntServiceHsiIdListFromOntIdList(List<string> ontIdList)
2752:          {
2753:              List<string> list;
2754:   
2755:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2756:              {
2757:                  list = (from osh in db.OntServiceHsis join oid in ontIdList on osh.Ont.Id equals oid select osh.Id).ToList();
2758:              }
2759:   
2760:              return list.Distinct().ToList();
2761:          }
2762:   
2763:          ////////////////////////////////////////////////////////////////////////////
2764:   
2765:          /// <summary>
2766:          /// 
2767:          /// </summary>
2768:          public static List<string> OntServiceVoipsIdListFromOntIdList(List<string> ontIdList)
2769:          {
2770:              List<string> list;
2771:   
2772:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2773:              {
2774:                  list = (from ov in db.OntServiceVoips join oid in ontIdList on ov.Ont.Id equals oid select ov.Id).ToList();
2775:              }
2776:   
2777:              return list.Distinct().ToList();
2778:          }
2779:   
2780:          ////////////////////////////////////////////////////////////////////////////
2781:   
2782:          /// <summary>
2783:          /// 
2784:          /// </summary>
2785:          public static List<string> OntServiceVoipsIdListFromIpList(List<string> ipList)
2786:          {
2787:              List<string> list;
2788:   
2789:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2790:              {
2791:                  list = (from ov in db.OntServiceVoips join npi in ipList on ov.Ip equals npi select ov.Id).ToList();
2792:              }
2793:   
2794:              return list.Distinct().ToList();
2795:          }
2796:   
2797:          ////////////////////////////////////////////////////////////////////////////
2798:   
2799:          /// <summary>
2800:          /// 
2801:          /// </summary>
2802:          public static List<long> EventIdListFromOntIdList(List<string> ontIdList)
2803:          {
2804:              List<long> list;
2805:   
2806:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2807:              {
2808:                  list = (from e in db.Events join oid in ontIdList on e.Ont.Id equals oid where e.Ont != null select e.Id).ToList();
2809:              }
2810:   
2811:              return list.Distinct().ToList();
2812:          }
2813:   
2814:          ////////////////////////////////////////////////////////////////////////////
2815:   
2816:          /// <summary>
2817:          /// 
2818:          /// </summary>
2819:          public static List<int> AgcfGatewayRecordIdListFromIpList(List<string> ipList)
2820:          {
2821:              List<int> list;
2822:   
2823:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2824:              {
2825:                  if (ipList.Count <= 32)
2826:                  {
2827:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList on gr.IP1 equals ip select gr.Id).ToList();
2828:                  }
2829:                  else
2830:                  {
2831:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
2832:                      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();
2833:                  }
2834:              }
2835:   
2836:              return list.Distinct().ToList();
2837:          }
2838:   
2839:          ////////////////////////////////////////////////////////////////////////////
2840:   
2841:          /// <summary>
2842:          /// 
2843:          /// </summary>
2844:          public static List<int> AgcfGatewayRecordIdListFromNddOntIdList(List<string> nddOntIdlist)
2845:          {
2846:              List<int> list;
2847:              List<string> nddIpList;
2848:   
2849:              nddIpList = (from n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdlist on n.Id equals nid select n.Ip).ToList();
2850:   
2851:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2852:              {
2853:                  if (nddOntIdlist.Count <= 32)
2854:                  {
2855:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList on gr.IP1 equals ip select gr.Id).ToList();
2856:                  }
2857:                  else
2858:                  {
2859:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
2860:                      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();
2861:                  }
2862:              }
2863:   
2864:              return list.Distinct().ToList();
2865:          }
2866:   
2867:          ////////////////////////////////////////////////////////////////////////////
2868:   
2869:          /// <summary>
2870:          /// 
2871:          /// </summary>
2872:          public static List<int> AgcfGatewayRecordIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
2873:          {
2874:              List<int> list;
2875:   
2876:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2877:              {
2878:                  if (agcfEndpointIdList.Count <= 32)
2879:                  {
2880:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
2881:                  }
2882:                  else
2883:                  {
2884:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList.GetRange(0, 32) on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
2885:                      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();
2886:                  }
2887:              }
2888:   
2889:              return list.Distinct().ToList();
2890:          }
2891:   
2892:          ////////////////////////////////////////////////////////////////////////////
2893:   
2894:          /// <summary>
2895:          /// 
2896:          /// </summary>
2897:          public static List<string> AgcfEndpointIdListFromAgcfGatewayRecordIdList(List<int> agcfGatewayRecordIdList)
2898:          {
2899:              List<string> list;
2900:   
2901:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2902:              {
2903:                  list = (from e in db.AgcfEndpoints join grid in agcfGatewayRecordIdList on e.AgcfGatewayRecord.Id equals grid where e.AgcfGatewayRecord != null select e.Id).ToList();
2904:              }
2905:   
2906:              return list.Distinct().ToList();
2907:          }
2908:   
2909:          ////////////////////////////////////////////////////////////////////////////
2910:   
2911:          /// <summary>
2912:          /// 
2913:          /// </summary>
2914:          public static List<string> AgcfEndpointIdListFromSubPartyIdList(List<string> subPartyIdList)
2915:          {
2916:              List<string> list;
2917:   
2918:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2919:              {
2920:                  list = (from sp in db.SubParties join spid in subPartyIdList on sp.Id equals spid select sp.AgcfEndpoint.Id).ToList();
2921:              }
2922:   
2923:              return list.Distinct().ToList();
2924:          }
2925:   
2926:          ////////////////////////////////////////////////////////////////////////////
2927:   
2928:          /// <summary>
2929:          /// 
2930:          /// </summary>
2931:          public static List<string> AgcfEndpointIdListFromPrividUserList(List<string> prividUserList)
2932:          {
2933:              List<string> list;
2934:   
2935:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2936:              {
2937:                  list = (from ep in db.AgcfEndpoints join pu in prividUserList on ep.PrividUser equals pu select ep.Id).ToList();
2938:              }
2939:   
2940:              return list.Distinct().ToList();
2941:          }
2942:   
2943:          ////////////////////////////////////////////////////////////////////////////
2944:   
2945:          /// <summary>
2946:          /// 
2947:          /// </summary>
2948:          public static List<string> SubPartyIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
2949:          {
2950:              List<string> list;
2951:   
2952:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2953:              {
2954:                  if (agcfEndpointIdList.Count <= 32)
2955:                  {
2956:                      list = (from sp in db.SubParties join e in agcfEndpointIdList on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
2957:                  }
2958:                  else if (agcfEndpointIdList.Count <= 64)
2959:                  {
2960:                      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();
2961:                      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();
2962:                  }
2963:                  else if (agcfEndpointIdList.Count <= 96)
2964:                  {
2965:                      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();
2966:                      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();
2967:                      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();
2968:                  }
2969:                  else //if (agcfEndpointIdList.Count <= 128)
2970:                  {
2971:                      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();
2972:                      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();
2973:                      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();
2974:                      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();
2975:                  }
2976:              }
2977:   
2978:              return list.Distinct().ToList();
2979:          }
2980:   
2981:          ////////////////////////////////////////////////////////////////////////////
2982:   
2983:          /// <summary>
2984:          /// 
2985:          /// </summary>
2986:          public static List<string> SubPartyIdListFromPartyIdList(List<string> partyIdList)
2987:          {
2988:              List<string> list;
2989:   
2990:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2991:              {
2992:                  if (partyIdList.Count <= 32)
2993:                  {
2994:                      list = (from sp in db.SubParties join pid in partyIdList on sp.PartyId equals pid select sp.Id).ToList();
2995:                  }
2996:                  else if (partyIdList.Count <= 64)
2997:                  {
2998:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
2999:                      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();
3000:                  }
3001:                  else if (partyIdList.Count <= 96)
3002:                  {
3003:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
3004:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
3005:                      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();
3006:                  }
3007:                  else //if (agcfEndpointIdList.Count <= 128)
3008:                  {
3009:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
3010:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
3011:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(64, 32) on sp.PartyId equals pid select sp.Id).ToList();
3012:                      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();
3013:                  }
3014:              }
3015:   
3016:              return list.Distinct().ToList();
3017:          }
3018:   
3019:          ////////////////////////////////////////////////////////////////////////////
3020:   
3021:          /// <summary>
3022:          /// 
3023:          /// </summary>
3024:          public static List<string> SubscriberIdListFromSubPartyIdList(List<string> subPartyIdList)
3025:          {
3026:              List<string> list;
3027:   
3028:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3029:              {
3030:                  if (subPartyIdList.Count <= 32)
3031:                  {
3032:                      list = (from s in db.Subscribers join spid in subPartyIdList on s.SubParty.Id equals spid select s.Id).ToList();
3033:                  }
3034:                  else if (subPartyIdList.Count <= 64)
3035:                  {
3036:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
3037:                      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();
3038:                  }
3039:                  else if (subPartyIdList.Count <= 96)
3040:                  {
3041:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
3042:                      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();
3043:                      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();
3044:                  }
3045:                  else //if (subPartyIdList.Count <= 128)
3046:                  {
3047:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
3048:                      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();
3049:                      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();
3050:                      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();
3051:                  }
3052:              }
3053:   
3054:              return list.Distinct().ToList();
3055:          }
3056:   
3057:          ////////////////////////////////////////////////////////////////////////////
3058:   
3059:          /// <summary>
3060:          /// 
3061:          /// </summary>
3062:          public static List<string> SubscriberIdListFromPartyIdList(List<string> partyIdList)
3063:          {
3064:              List<string> list;
3065:   
3066:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3067:              {
3068:                  if (partyIdList.Count <= 32)
3069:                  {
3070:                      list = (from s in db.Subscribers join pid in partyIdList on s.PartyId equals pid select s.Id).ToList();
3071:                  }
3072:                  else if (partyIdList.Count <= 64)
3073:                  {
3074:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3075:                      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();
3076:                  }
3077:                  else if (partyIdList.Count <= 96)
3078:                  {
3079:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3080:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
3081:                      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();
3082:                  }
3083:                  else //if (subPartyIdList.Count <= 128)
3084:                  {
3085:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3086:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
3087:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(64, 32) on s.PartyId equals pid select s.Id).ToList();
3088:                      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();
3089:                  }
3090:              }
3091:   
3092:              return list.Distinct().ToList();
3093:          }
3094:   
3095:          ////////////////////////////////////////////////////////////////////////////
3096:          ////////////////////////////////////////////////////////////////////////////   
3097:   
3098:          /// <summary>
3099:          /// 
3100:          /// </summary>
3101:          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)
3102:          {
3103:              int number;
3104:              long numberWithCountryCode;
3105:              string service, impuSipDomain, partyId, prividUser;
3106:   
3107:              foreach (var pi in partyIdList)
3108:              {
3109:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(pi);
3110:   
3111:                  number = int.Parse(service);
3112:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3113:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3114:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3115:                  prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
3116:   
3117:                  serviceList.Add(service);
3118:                  numberList.Add(number);
3119:                  serviceLongList.Add(numberWithCountryCode);
3120:                  impuSipDomainList.Add(impuSipDomain);
3121:                  //partyIdList.Add(partyId);
3122:                  prividUserList.Add(prividUser);
3123:              }
3124:   
3125:              foreach (var s in serviceList)
3126:              {
3127:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s);
3128:   
3129:                  number = int.Parse(service);
3130:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3131:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3132:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3133:                  prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
3134:   
3135:                  //serviceList.Add(service);
3136:                  numberList.Add(number);
3137:                  serviceLongList.Add(numberWithCountryCode);
3138:                  impuSipDomainList.Add(impuSipDomain);
3139:                  partyIdList.Add(partyId);
3140:                  prividUserList.Add(prividUser);
3141:              }
3142:   
3143:              serviceList = serviceList.Distinct().ToList();
3144:              numberList = numberList.Distinct().ToList();
3145:              serviceLongList = serviceLongList.Distinct().ToList();
3146:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3147:              partyIdList = partyIdList.Distinct().ToList();
3148:              prividUserList = prividUserList.Distinct().ToList();
3149:          }
3150:   
3151:          ////////////////////////////////////////////////////////////////////////////   
3152:   
3153:          /// <summary>
3154:          /// 
3155:          /// </summary>
3156:          public static void CollectServiceListFromServiceRequestServiceIdOrService2IdList(List<string> serviceRequestServiceIdListOrService2IdList, ref List<string> serviceList)
3157:          {
3158:              string service;
3159:   
3160:              foreach (var si in serviceRequestServiceIdListOrService2IdList)
3161:              {
3162:                  service = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceIdToService(si);
3163:                  serviceList.Add(service);
3164:              }
3165:   
3166:              serviceList = serviceList.Distinct().ToList();
3167:          }
3168:   
3169:          ////////////////////////////////////////////////////////////////////////////   
3170:   
3171:          /// <summary>
3172:          /// 
3173:          /// </summary>
3174:          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)
3175:          {
3176:              int number;
3177:              long numberWithCountryCode;
3178:              string service, impuSipDomain, partyId;
3179:   
3180:              foreach (var ep in agcfEndpointList)
3181:              {
3182:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(ep.PrividUser);
3183:   
3184:                  number = int.Parse(service);
3185:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3186:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3187:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3188:   
3189:                  serviceList.Add(service);
3190:                  numberList.Add(number);
3191:                  serviceLongList.Add(numberWithCountryCode);
3192:                  impuSipDomainList.Add(impuSipDomain);
3193:                  partyIdList.Add(partyId);
3194:              }
3195:   
3196:              serviceList = serviceList.Distinct().ToList();
3197:              numberList = numberList.Distinct().ToList();
3198:              serviceLongList = serviceLongList.Distinct().ToList();
3199:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3200:              partyIdList = impuSipDomainList.Distinct().ToList();
3201:          }
3202:   
3203:          ////////////////////////////////////////////////////////////////////////////   
3204:   
3205:          /// <summary>
3206:          /// 
3207:          /// </summary>
3208:          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)
3209:          {
3210:              int number;
3211:              long numberWithCountryCode;
3212:              string service, impuSipDomain, partyId;
3213:   
3214:              foreach (var s in subscriberList)
3215:              {
3216:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s.PartyId);
3217:   
3218:                  number = int.Parse(service);
3219:                  numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3220:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3221:                  partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3222:   
3223:                  serviceList.Add(service);
3224:                  numberList.Add(number);
3225:                  serviceLongList.Add(numberWithCountryCode);
3226:                  impuSipDomainList.Add(impuSipDomain);
3227:                  partyIdList.Add(partyId);
3228:              }
3229:   
3230:              serviceList = serviceList.Distinct().ToList();
3231:              numberList = numberList.Distinct().ToList();
3232:              serviceLongList = serviceLongList.Distinct().ToList();
3233:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3234:              partyIdList = impuSipDomainList.Distinct().ToList();
3235:          }
3236:   
3237:          ////////////////////////////////////////////////////////////////////////////
3238:          ////////////////////////////////////////////////////////////////////////////   
3239:      }
3240:   
3241:      ////////////////////////////////////////////////////////////////////////////
3242:      ////////////////////////////////////////////////////////////////////////////   
3243:  }