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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Find

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

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

   1:  using System;
   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:                              Serial = srs.Serial,
 130:                              ServiceType = srs.ServiceType,
 131:                              ServiceSuspension = srs.ServiceSuspension,
 132:                              Type = srs.Type,
 133:                              Updated = srs.Updated
 134:                          }).ToList();
 135:   
 136:                  return list.Distinct().ToList();
 137:              }
 138:          }
 139:   
 140:          ////////////////////////////////////////////////////////////////////////////
 141:   
 142:          /// <summary>
 143:          /// 
 144:          /// </summary>
 145:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestList(List<int> serviceRequestIdList)
 146:          {
 147:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 148:   
 149:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 150:              {
 151:                  if (serviceRequestIdList.Count <= 32)
 152:                  {
 153:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList on sr.Id equals srid select sr).ToList();
 154:                  }
 155:                  else if (serviceRequestIdList.Count <= 64)
 156:                  {
 157:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 158:                      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();
 159:                  }
 160:                  else if (serviceRequestIdList.Count <= 96)
 161:                  {
 162:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 163:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 164:                      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();
 165:                  }
 166:                  else if (serviceRequestIdList.Count <= 128)
 167:                  {
 168:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 169:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 170:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 171:                      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();
 172:                  }
 173:                  else if (serviceRequestIdList.Count <= 160)
 174:                  {
 175:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 176:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 177:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 178:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 179:                      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();
 180:                  }
 181:                  else if (serviceRequestIdList.Count <= 192)
 182:                  {
 183:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 184:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 185:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 186:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 187:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 188:                      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();
 189:                  }
 190:                  else if (serviceRequestIdList.Count <= 224)
 191:                  {
 192:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 193:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 194:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 195:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 196:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 197:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 198:                      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();
 199:                  }
 200:                  else if (serviceRequestIdList.Count <= 256)
 201:                  {
 202:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 203:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 204:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 205:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 206:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 207:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 208:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 209:                      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();
 210:                  }
 211:                  else if (serviceRequestIdList.Count <= 288)
 212:                  {
 213:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 214:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 215:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 216:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 217:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 218:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 219:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 220:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 221:                      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();
 222:                  }
 223:                  else if (serviceRequestIdList.Count <= 320)
 224:                  {
 225:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 226:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 227:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 228:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 229:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 230:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 231:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 232:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 233:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 234:                      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();
 235:                  }
 236:                  else if (serviceRequestIdList.Count <= 352)
 237:                  {
 238:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 239:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 240:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 241:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 242:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 243:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 244:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 245:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 246:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 247:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 248:                      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();
 249:                  }
 250:                  else if (serviceRequestIdList.Count <= 384)
 251:                  {
 252:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 253:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 254:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 255:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 256:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 257:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 258:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 259:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 260:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 261:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 262:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 263:                      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();
 264:                  }
 265:                  else if (serviceRequestIdList.Count <= 416)
 266:                  {
 267:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 268:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 269:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 270:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 271:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 272:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 273:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 274:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 275:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 276:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 277:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 278:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 279:                      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();
 280:                  }
 281:                  else if (serviceRequestIdList.Count <= 448)
 282:                  {
 283:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 284:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 285:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 286:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 287:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 288:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 289:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 290:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 291:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 292:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 293:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 294:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 295:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 296:                      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();
 297:                  }
 298:                  else if (serviceRequestIdList.Count <= 480)
 299:                  {
 300:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 301:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 302:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 303:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 304:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 305:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 306:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 307:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 308:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 309:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 310:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 311:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 312:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 313:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 314:                      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();
 315:                  }
 316:                  else if (serviceRequestIdList.Count <= 512)
 317:                  {
 318:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 319:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 320:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 321:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 322:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 323:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 324:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 325:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 326:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 327:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 328:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 329:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 330:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 331:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 332:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 333:                      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();
 334:                  }
 335:                  else if (serviceRequestIdList.Count <= 544)
 336:                  {
 337:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 338:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 339:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 340:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 341:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 342:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 343:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 344:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 345:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 346:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 347:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 348:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 349:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 350:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 351:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 352:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 353:                      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();
 354:                  }
 355:                  else //if (serviceIdList.Count <= ??)
 356:                  {
 357:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 358:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 359:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 360:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 361:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 362:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 363:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 364:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 365:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 366:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 367:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 368:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 369:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 370:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 371:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 372:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 373:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(512, 32) on sr.Id equals srid select sr).ToList();
 374:                      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();
 375:                  }
 376:              }
 377:   
 378:              return list.Distinct().ToList();
 379:          }
 380:   
 381:          ////////////////////////////////////////////////////////////////////////////
 382:   
 383:          /// <summary>
 384:          /// 
 385:          /// </summary>
 386:          public static List<Ia.Ngn.Cl.Model.ServiceRequestHistory> ServiceRequestHistoryList(List<string> serviceRequestHistoryIdList)
 387:          {
 388:              List<Ia.Ngn.Cl.Model.ServiceRequestHistory> list;
 389:   
 390:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 391:              {
 392:                  if (serviceRequestHistoryIdList.Count <= 32)
 393:                  {
 394:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList on srh.Id equals srhid select srh).ToList();
 395:                  }
 396:                  else if (serviceRequestHistoryIdList.Count <= 64)
 397:                  {
 398:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 399:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, serviceRequestHistoryIdList.Count - 32 - 1) on srh.Id equals srhid select srh).ToList();
 400:                  }
 401:                  else if (serviceRequestHistoryIdList.Count <= 96)
 402:                  {
 403:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 404:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 405:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, serviceRequestHistoryIdList.Count - 64 - 1) on srh.Id equals srhid select srh).ToList();
 406:                  }
 407:                  else if (serviceRequestHistoryIdList.Count <= 128)
 408:                  {
 409:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 410:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 411:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 412:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, serviceRequestHistoryIdList.Count - 96 - 1) on srh.Id equals srhid select srh).ToList();
 413:                  }
 414:                  else if (serviceRequestHistoryIdList.Count <= 160)
 415:                  {
 416:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 417:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 418:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 419:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 420:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, serviceRequestHistoryIdList.Count - 128 - 1) on srh.Id equals srhid select srh).ToList();
 421:                  }
 422:                  else if (serviceRequestHistoryIdList.Count <= 192)
 423:                  {
 424:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 425:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 426:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 427:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 428:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 429:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, serviceRequestHistoryIdList.Count - 160 - 1) on srh.Id equals srhid select srh).ToList();
 430:                  }
 431:                  else if (serviceRequestHistoryIdList.Count <= 224)
 432:                  {
 433:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 434:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 435:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 436:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 437:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 438:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 439:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, serviceRequestHistoryIdList.Count - 192 - 1) on srh.Id equals srhid select srh).ToList();
 440:                  }
 441:                  else if (serviceRequestHistoryIdList.Count <= 256)
 442:                  {
 443:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 444:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 445:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 446:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 447:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 448:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 449:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 450:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, serviceRequestHistoryIdList.Count - 224 - 1) on srh.Id equals srhid select srh).ToList();
 451:                  }
 452:                  else if (serviceRequestHistoryIdList.Count <= 288)
 453:                  {
 454:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 455:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 456:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 457:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 458:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 459:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 460:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 461:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 462:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, serviceRequestHistoryIdList.Count - 256 - 1) on srh.Id equals srhid select srh).ToList();
 463:                  }
 464:                  else if (serviceRequestHistoryIdList.Count <= 320)
 465:                  {
 466:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 467:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 468:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 469:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 470:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 471:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 472:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 473:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 474:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 475:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, serviceRequestHistoryIdList.Count - 288 - 1) on srh.Id equals srhid select srh).ToList();
 476:                  }
 477:                  else if (serviceRequestHistoryIdList.Count <= 352)
 478:                  {
 479:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 480:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 481:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 482:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 483:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 484:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 485:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 486:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 487:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 488:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 489:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, serviceRequestHistoryIdList.Count - 320 - 1) on srh.Id equals srhid select srh).ToList();
 490:                  }
 491:                  else if (serviceRequestHistoryIdList.Count <= 384)
 492:                  {
 493:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 494:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 495:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 496:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 497:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 498:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 499:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 500:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 501:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 502:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 503:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 504:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, serviceRequestHistoryIdList.Count - 352 - 1) on srh.Id equals srhid select srh).ToList();
 505:                  }
 506:                  else if (serviceRequestHistoryIdList.Count <= 416)
 507:                  {
 508:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 509:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 510:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 511:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 512:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 513:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 514:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 515:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 516:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 517:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 518:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 519:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 520:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, serviceRequestHistoryIdList.Count - 384 - 1) on srh.Id equals srhid select srh).ToList();
 521:                  }
 522:                  else if (serviceRequestHistoryIdList.Count <= 448)
 523:                  {
 524:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 525:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 526:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 527:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 528:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 529:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 530:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 531:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 532:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 533:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 534:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 535:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 536:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 537:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, serviceRequestHistoryIdList.Count - 416 - 1) on srh.Id equals srhid select srh).ToList();
 538:                  }
 539:                  else if (serviceRequestHistoryIdList.Count <= 480)
 540:                  {
 541:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 542:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 543:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 544:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 545:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 546:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 547:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 548:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 549:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 550:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 551:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 552:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 553:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 554:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 555:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, serviceRequestHistoryIdList.Count - 448 - 1) on srh.Id equals srhid select srh).ToList();
 556:                  }
 557:                  else if (serviceRequestHistoryIdList.Count <= 512)
 558:                  {
 559:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 560:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 561:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 562:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 563:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 564:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 565:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 566:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 567:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 568:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 569:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 570:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 571:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 572:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 573:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 574:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, serviceRequestHistoryIdList.Count - 480 - 1) on srh.Id equals srhid select srh).ToList();
 575:                  }
 576:                  else if (serviceRequestHistoryIdList.Count <= 544)
 577:                  {
 578:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 579:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 580:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 581:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 582:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 583:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 584:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 585:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 586:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 587:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 588:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 589:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 590:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 591:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 592:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 593:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, 32) on srh.Id equals srhid select srh).ToList();
 594:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(512, serviceRequestHistoryIdList.Count - 512 - 1) on srh.Id equals srhid select srh).ToList();
 595:                  }
 596:                  else //if (serviceIdList.Count <= ??)
 597:                  {
 598:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 599:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 600:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 601:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 602:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 603:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 604:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 605:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 606:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 607:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 608:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 609:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 610:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 611:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 612:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 613:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, 32) on srh.Id equals srhid select srh).ToList();
 614:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(512, 32) on srh.Id equals srhid select srh).ToList();
 615:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(544, serviceRequestHistoryIdList.Count - 544 - 1) on srh.Id equals srhid select srh).ToList();
 616:                  }
 617:              }
 618:   
 619:              return list.Distinct().ToList();
 620:          }
 621:   
 622:          ////////////////////////////////////////////////////////////////////////////
 623:   
 624:          /// <summary>
 625:          /// 
 626:          /// </summary>
 627:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerId(int customerId, int maxNumberOfResults)
 628:          {
 629:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 630:   
 631:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 632:              {
 633:                  list = (from sr in db.ServiceRequests where sr.CustomerId == customerId select sr).Take(maxNumberOfResults).ToList();
 634:              }
 635:   
 636:              return list.Distinct().ToList();
 637:          }
 638:   
 639:          ////////////////////////////////////////////////////////////////////////////
 640:   
 641:          /// <summary>
 642:          /// 
 643:          /// </summary>
 644:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerName(string customerName, int maxNumberOfResults)
 645:          {
 646:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 647:   
 648:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 649:              {
 650:                  list = (from sr in db.ServiceRequests where sr.CustomerName == customerName || sr.CustomerName.Contains(customerName) select sr).Take(maxNumberOfResults).ToList();
 651:              }
 652:   
 653:              return list.Distinct().ToList();
 654:          }
 655:   
 656:          ////////////////////////////////////////////////////////////////////////////
 657:   
 658:          /// <summary>
 659:          /// 
 660:          /// </summary>
 661:          public static List<Ia.Ngn.Cl.Model.ServiceRequestType> ServiceRequestTypeList(List<int> serviceRequestTypeIdList)
 662:          {
 663:              List<Ia.Ngn.Cl.Model.ServiceRequestType> list;
 664:   
 665:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 666:              {
 667:                  if (serviceRequestTypeIdList.Count <= 32)
 668:                  {
 669:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList on srt.Id equals srtid select srt).ToList();
 670:                  }
 671:                  else if (serviceRequestTypeIdList.Count <= 64)
 672:                  {
 673:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 674:                      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();
 675:                  }
 676:                  else if (serviceRequestTypeIdList.Count <= 96)
 677:                  {
 678:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 679:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 680:                      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();
 681:                  }
 682:                  else if (serviceRequestTypeIdList.Count <= 128)
 683:                  {
 684:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 685:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 686:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 687:                      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();
 688:                  }
 689:                  else if (serviceRequestTypeIdList.Count <= 160)
 690:                  {
 691:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 692:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 693:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 694:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 695:                      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();
 696:                  }
 697:                  else if (serviceRequestTypeIdList.Count <= 192)
 698:                  {
 699:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 700:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 701:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 702:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 703:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 704:                      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();
 705:                  }
 706:                  else if (serviceRequestTypeIdList.Count <= 224)
 707:                  {
 708:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 709:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 710:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 711:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 712:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 713:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 714:                      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();
 715:                  }
 716:                  else if (serviceRequestTypeIdList.Count <= 256)
 717:                  {
 718:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 719:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 720:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 721:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 722:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 723:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 724:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 725:                      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();
 726:                  }
 727:                  else if (serviceRequestTypeIdList.Count <= 288)
 728:                  {
 729:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 730:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 731:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 732:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 733:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 734:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 735:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 736:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 737:                      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();
 738:                  }
 739:                  else if (serviceRequestTypeIdList.Count <= 320)
 740:                  {
 741:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 742:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 743:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 744:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 745:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 746:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 747:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 748:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 749:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 750:                      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();
 751:                  }
 752:                  else if (serviceRequestTypeIdList.Count <= 352)
 753:                  {
 754:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 755:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 756:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 757:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 758:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 759:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 760:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 761:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 762:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 763:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 764:                      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();
 765:                  }
 766:                  else if (serviceRequestTypeIdList.Count <= 384)
 767:                  {
 768:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 769:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 770:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 771:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 772:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 773:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 774:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 775:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 776:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 777:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 778:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 779:                      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();
 780:                  }
 781:                  else if (serviceRequestTypeIdList.Count <= 416)
 782:                  {
 783:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 784:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 785:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 786:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 787:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 788:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 789:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 790:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 791:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 792:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 793:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 794:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 795:                      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();
 796:                  }
 797:                  else if (serviceRequestTypeIdList.Count <= 448)
 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, serviceRequestTypeIdList.Count - 416 - 1) on srt.Id equals srtid select srt).ToList();
 813:                  }
 814:                  else if (serviceRequestTypeIdList.Count <= 480)
 815:                  {
 816:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 817:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 818:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 819:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 820:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 821:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 822:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 823:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 824:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 825:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 826:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 827:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 828:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 829:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 830:                      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();
 831:                  }
 832:                  else if (serviceRequestTypeIdList.Count <= 512)
 833:                  {
 834:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 835:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 836:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 837:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 838:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 839:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 840:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 841:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 842:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 843:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 844:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 845:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 846:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 847:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 848:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 849:                      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();
 850:                  }
 851:                  else if (serviceRequestTypeIdList.Count <= 544)
 852:                  {
 853:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 854:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 855:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 856:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 857:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 858:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 859:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 860:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 861:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 862:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 863:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 864:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 865:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 866:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 867:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 868:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 869:                      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();
 870:                  }
 871:                  else if (serviceRequestTypeIdList.Count <= 576)
 872:                  {
 873:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 874:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 875:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 876:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 877:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 878:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 879:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 880:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 881:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 882:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 883:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 884:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 885:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 886:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 887:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 888:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 889:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 890:                      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();
 891:                  }
 892:                  else if (serviceRequestTypeIdList.Count <= 608)
 893:                  {
 894:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 895:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 896:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 897:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 898:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 899:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 900:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 901:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 902:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 903:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 904:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 905:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 906:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 907:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 908:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 909:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 910:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 911:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 912:                      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();
 913:                  }
 914:                  else if (serviceRequestTypeIdList.Count <= 640)
 915:                  {
 916:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 917:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 918:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 919:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 920:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 921:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 922:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 923:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 924:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 925:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 926:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 927:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 928:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 929:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 930:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 931:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 932:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 933:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 934:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 935:                      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();
 936:                  }
 937:                  else if (serviceRequestTypeIdList.Count <= 672)
 938:                  {
 939:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 940:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 941:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 942:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 943:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 944:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 945:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 946:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 947:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 948:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 949:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 950:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 951:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 952:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 953:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 954:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 955:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 956:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 957:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 958:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 959:                      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();
 960:                  }
 961:                  else if (serviceRequestTypeIdList.Count <= 704)
 962:                  {
 963:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 964:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 965:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 966:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 967:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 968:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 969:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 970:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 971:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 972:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 973:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 974:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
 975:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
 976:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
 977:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
 978:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
 979:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
 980:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
 981:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
 982:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
 983:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
 984:                      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();
 985:                  }
 986:                  else if (serviceRequestTypeIdList.Count <= 736)
 987:                  {
 988:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 989:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 990:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 991:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 992:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 993:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 994:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 995:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
 996:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
 997:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
 998:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
 999:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1000:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1001:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1002:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1003:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1004:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1005:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1006:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1007:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1008:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1009:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1010:                      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();
1011:                  }
1012:                  else if (serviceRequestTypeIdList.Count <= 768)
1013:                  {
1014:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1015:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1016:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1017:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1018:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1019:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1020:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1021:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1022:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1023:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1024:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1025:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1026:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1027:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1028:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1029:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1030:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1031:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1032:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1033:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1034:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1035:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1036:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1037:                      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();
1038:                  }
1039:                  else if (serviceRequestTypeIdList.Count <= 800)
1040:                  {
1041:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1042:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1043:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1044:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1045:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1046:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1047:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1048:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1049:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1050:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1051:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1052:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1053:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1054:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1055:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1056:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1057:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1058:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1059:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1060:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1061:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1062:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1063:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1064:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
1065:                      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();
1066:                  }
1067:                  else //if (serviceRequestTypeIdList.Count <= 832)
1068:                  {
1069:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1070:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1071:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1072:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1073:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1074:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1075:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1076:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1077:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1078:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1079:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1080:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1081:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1082:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1083:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1084:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1085:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1086:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1087:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1088:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1089:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1090:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1091:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1092:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
1093:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(768, 32) on srt.Id equals srtid select srt).ToList();
1094:                      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();
1095:                  }
1096:              }
1097:   
1098:              return list.Distinct().ToList();
1099:          }
1100:   
1101:          ////////////////////////////////////////////////////////////////////////////
1102:   
1103:          /// <summary>
1104:          /// 
1105:          /// </summary>
1106:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> AgcfGatewayRecordList(List<int> agcfGatewayRecordIdList)
1107:          {
1108:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> list;
1109:   
1110:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1111:              {
1112:                  if (agcfGatewayRecordIdList.Count <= 32)
1113:                  {
1114:                      list = (from gr in db.AgcfGatewayRecords
1115:                              join grid in agcfGatewayRecordIdList on gr.Id equals grid
1116:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1117:                              {
1118:                                  Id = gr.Id,
1119:                                  GwId = gr.GwId,
1120:                                  GwUserId = gr.GwUserId,
1121:                                  GwDomain = gr.GwDomain,
1122:                                  GwName = gr.GwName,
1123:                                  IP1 = gr.IP1,
1124:                                  IP2 = gr.IP2,
1125:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
1126:                                  IsPrimary = gr.IsPrimary,
1127:                                  Created = gr.Created,
1128:                                  Updated = gr.Updated
1129:                              }).ToList();
1130:                  }
1131:                  else
1132:                  {
1133:                      list = (from gr in db.AgcfGatewayRecords
1134:                              join grid in agcfGatewayRecordIdList.GetRange(0, 32) on gr.Id equals grid
1135:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1136:                              {
1137:                                  Id = gr.Id,
1138:                                  GwId = gr.GwId,
1139:                                  GwUserId = gr.GwUserId,
1140:                                  GwDomain = gr.GwDomain,
1141:                                  GwName = gr.GwName,
1142:                                  IP1 = gr.IP1,
1143:                                  IP2 = gr.IP2,
1144:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
1145:                                  IsPrimary = gr.IsPrimary,
1146:                                  Created = gr.Created,
1147:                                  Updated = gr.Updated
1148:                              }).ToList();
1149:   
1150:                      list = list.Union(from gr in db.AgcfGatewayRecords
1151:                                        join grid in agcfGatewayRecordIdList.GetRange(32, agcfGatewayRecordIdList.Count - 32 - 1) on gr.Id equals grid
1152:                                        select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1153:                                        {
1154:                                            Id = gr.Id,
1155:                                            GwId = gr.GwId,
1156:                                            GwUserId = gr.GwUserId,
1157:                                            GwDomain = gr.GwDomain,
1158:                                            GwName = gr.GwName,
1159:                                            IP1 = gr.IP1,
1160:                                            IP2 = gr.IP2,
1161:                                            MateExternalIPAddr = gr.MateExternalIPAddr,
1162:                                            IsPrimary = gr.IsPrimary,
1163:                                            Created = gr.Created,
1164:                                            Updated = gr.Updated
1165:                                        }).ToList();
1166:                  }
1167:              }
1168:   
1169:              return list.Distinct().ToList();
1170:          }
1171:   
1172:          ////////////////////////////////////////////////////////////////////////////
1173:   
1174:          /// <summary>
1175:          /// 
1176:          /// </summary>
1177:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> AgcfEndpointList(List<string> agcfEndpointIdList)
1178:          {
1179:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> list;
1180:   
1181:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1182:              {
1183:                  list = (from e in db.AgcfEndpoints
1184:                          join eid in agcfEndpointIdList on e.Id equals eid
1185:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint()
1186:                          {
1187:                              Id = e.Id,
1188:                              PrividUser = e.PrividUser,
1189:                              GwId = e.GwId,
1190:                              Dn = e.Dn,
1191:                              FlatTermID = e.FlatTermID,
1192:                              CallHoldLc = e.CallHoldLc,
1193:                              CallWaitingLc = e.CallWaitingLc,
1194:                              CallToggleLc = e.CallToggleLc,
1195:                              ThreeWayCallLc = e.ThreeWayCallLc,
1196:                              McidLc = e.McidLc,
1197:                              Password = e.Password,
1198:                              CallTransferLc = e.CallTransferLc,
1199:                              Created = e.Created,
1200:                              Updated = e.Updated
1201:                          }).ToList();
1202:              }
1203:   
1204:              return list.Distinct().ToList();
1205:          }
1206:   
1207:          ////////////////////////////////////////////////////////////////////////////
1208:   
1209:          /// <summary>
1210:          /// 
1211:          /// </summary>
1212:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevList(List<int> emsDevIdList)
1213:          {
1214:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
1215:   
1216:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1217:              {
1218:                  list = (from ed in db.EmsDevs
1219:                          join edid in emsDevIdList on ed.Id equals edid
1220:                          select ed).ToList();
1221:              }
1222:   
1223:              return list.Distinct().ToList();
1224:          }
1225:   
1226:          ////////////////////////////////////////////////////////////////////////////
1227:   
1228:          /// <summary>
1229:          /// 
1230:          /// </summary>
1231:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevListFromEmsOntIdList(List<string> emsOntIdList)
1232:          {
1233:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
1234:   
1235:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1236:              {
1237:                  list = (from ed in db.EmsDevs
1238:                          join eb in db.EmsBoards on ed.Id equals eb.EmsDev.Id
1239:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
1240:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1241:                          join eoid in emsOntIdList on eo.Id equals eoid
1242:                          select ed).ToList();
1243:              }
1244:   
1245:              return list.Distinct().ToList();
1246:          }
1247:   
1248:          ////////////////////////////////////////////////////////////////////////////
1249:   
1250:          /// <summary>
1251:          /// 
1252:          /// </summary>
1253:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> EmsBoardList(List<string> emsBoardIdList)
1254:          {
1255:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
1256:   
1257:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1258:              {
1259:                  list = (from eb in db.EmsBoards
1260:                          join ebid in emsBoardIdList on eb.Id equals ebid
1261:                          select eb).ToList();
1262:              }
1263:   
1264:              return list.Distinct().ToList();
1265:          }
1266:   
1267:          ////////////////////////////////////////////////////////////////////////////
1268:   
1269:          /// <summary>
1270:          /// 
1271:          /// </summary>
1272:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> EmsBoardListFromEmsOntIdList(List<string> emsOntIdList)
1273:          {
1274:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
1275:   
1276:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1277:              {
1278:                  list = (from eb in db.EmsBoards
1279:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
1280:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1281:                          join eoid in emsOntIdList on eo.Id equals eoid
1282:                          select eb).ToList();
1283:              }
1284:   
1285:              return list.Distinct().ToList();
1286:          }
1287:   
1288:          ////////////////////////////////////////////////////////////////////////////
1289:   
1290:          /// <summary>
1291:          /// 
1292:          /// </summary>
1293:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsPort> EmsPortList(List<string> emsPortIdList)
1294:          {
1295:              List<Ia.Ngn.Cl.Model.Huawei.EmsPort> list;
1296:   
1297:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1298:              {
1299:                  list = (from ep in db.EmsPorts
1300:                          join epid in emsPortIdList on ep.Id equals epid
1301:                          select ep).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.Huawei.EmsPort> EmsPortListFromEmsOntIdList(List<string> emsOntIdList)
1313:          {
1314:              List<Ia.Ngn.Cl.Model.Huawei.EmsPort> list;
1315:   
1316:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1317:              {
1318:                  list = (from ep in db.EmsPorts
1319:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1320:                          join eoid in emsOntIdList on eo.Id equals eoid
1321:                          select ep).ToList();
1322:              }
1323:   
1324:              return list.Distinct().ToList();
1325:          }
1326:   
1327:          ////////////////////////////////////////////////////////////////////////////
1328:   
1329:          /// <summary>
1330:          /// 
1331:          /// </summary>
1332:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> EmsOntList(List<string> emsOntIdList)
1333:          {
1334:              List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> list;
1335:   
1336:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1337:              {
1338:                  list = (from eo in db.EmsOnts
1339:                          join oid in emsOntIdList on eo.Id equals oid
1340:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt()
1341:                          {
1342:                              Id = eo.Id,
1343:                              Access = eo.Access,
1344:                              ALIAS = eo.ALIAS,
1345:                              AUTH = eo.AUTH,
1346:                              CAPABPROF = eo.CAPABPROF,
1347:                              Created = eo.Created,
1348:                              DEV = eo.DEV,
1349:                              DID = eo.DID,
1350:                              EQUIPMENTID = eo.EQUIPMENTID,
1351:                              FN = eo.FN,
1352:                              GATE = eo.GATE,
1353:                              IP = eo.IP,
1354:                              MAINSOFTVERSION = eo.MAINSOFTVERSION,
1355:                              NAME = eo.NAME,
1356:                              ONTID = eo.ONTID,
1357:                              PN = eo.PN,
1358:                              ROUTEIP = eo.ROUTEIP,
1359:                              SERIALNUM = eo.SERIALNUM,
1360:                              SN = eo.SN,
1361:                              Updated = eo.Updated,
1362:                              VENDORID = eo.VENDORID,
1363:                              VLAN = eo.VLAN
1364:                          }).ToList();
1365:              }
1366:   
1367:              return list.Distinct().ToList();
1368:          }
1369:   
1370:          ////////////////////////////////////////////////////////////////////////////
1371:   
1372:          /// <summary>
1373:          /// 
1374:          /// </summary>
1375:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdList(List<string> emsOntIdList)
1376:          {
1377:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1378:   
1379:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1380:              {
1381:                  list = (from eosi in db.EmsOntSipInfos join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid select eosi).Include(o => o.EmsOnt).ToList();
1382:              }
1383:   
1384:              return list.Distinct().ToList();
1385:          }
1386:   
1387:          ////////////////////////////////////////////////////////////////////////////
1388:   
1389:          /// <summary>
1390:          /// 
1391:          /// </summary>
1392:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdListAndService(List<string> emsOntIdList, string service)
1393:          {
1394:              string emsVoipPstnUserDn;
1395:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1396:   
1397:              emsVoipPstnUserDn = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
1398:   
1399:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1400:              {
1401:                  list = (from evpu in db.EmsVoipPstnUsers
1402:                          join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid
1403:                          where evpu.DN == emsVoipPstnUserDn
1404:                          select evpu).Include(o => o.EmsOnt).ToList();
1405:              }
1406:   
1407:              return list.Distinct().ToList();
1408:          }
1409:   
1410:          ////////////////////////////////////////////////////////////////////////////
1411:   
1412:          /// <summary>
1413:          /// 
1414:          /// </summary>
1415:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdList(List<string> emsOntIdList)
1416:          {
1417:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1418:   
1419:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1420:              {
1421:                  list = (from evpu in db.EmsVoipPstnUsers join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid select evpu).Include(o => o.EmsOnt).ToList();
1422:              }
1423:   
1424:              return list.Distinct().ToList();
1425:          }
1426:   
1427:          ////////////////////////////////////////////////////////////////////////////
1428:   
1429:          /// <summary>
1430:          /// 
1431:          /// </summary>
1432:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdListAndServiceList(List<string> emsOntIdList, List<string> serviceList)
1433:          {
1434:              string serviceWithCountryCode;
1435:              List<string> emsVoipPstnUserDnList;
1436:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1437:   
1438:              emsVoipPstnUserDnList = new List<string>();
1439:   
1440:              foreach (var service in serviceList)
1441:              {
1442:                  serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
1443:                  emsVoipPstnUserDnList.Add(serviceWithCountryCode);
1444:              }
1445:   
1446:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1447:              {
1448:                  list = (from evpu in db.EmsVoipPstnUsers
1449:                          join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid
1450:                          join evpud in emsVoipPstnUserDnList on evpu.DN equals evpud
1451:                          select evpu).Include(o => o.EmsOnt).ToList();
1452:              }
1453:   
1454:              return list.Distinct().ToList();
1455:          }
1456:   
1457:          ////////////////////////////////////////////////////////////////////////////
1458:   
1459:          /// <summary>
1460:          /// 
1461:          /// </summary>
1462:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdListAndService(List<string> emsOntIdList, string service)
1463:          {
1464:              string sipUserName;
1465:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1466:   
1467:              sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
1468:   
1469:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1470:              {
1471:                  list = (from eosi in db.EmsOntSipInfos
1472:                          join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid
1473:                          where eosi.SIPUSERNAME == sipUserName
1474:                          select eosi).Include(o => o.EmsOnt).ToList();
1475:              }
1476:   
1477:              return list.Distinct().ToList();
1478:          }
1479:   
1480:          ////////////////////////////////////////////////////////////////////////////
1481:   
1482:          /// <summary>
1483:          /// 
1484:          /// </summary>
1485:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOnt> ServiceRequestOntList(List<string> serviceRequestOntIdList)
1486:          {
1487:              List<Ia.Ngn.Cl.Model.ServiceRequestOnt> list;
1488:   
1489:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1490:              {
1491:                  list = (from sro in db.ServiceRequestOnts join sroid in serviceRequestOntIdList on sro.Id equals sroid select sro).ToList();
1492:              }
1493:   
1494:              return list.Distinct().ToList();
1495:          }
1496:   
1497:          ////////////////////////////////////////////////////////////////////////////
1498:   
1499:          /// <summary>
1500:          /// 
1501:          /// </summary>
1502:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> ServiceRequestOntDetailList(List<string> serviceRequestOntIdList)
1503:          {
1504:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1505:   
1506:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1507:              {
1508:                  list = (from srod in db.ServiceRequestOntDetails join sroid in serviceRequestOntIdList on srod.ServiceRequestOnt.Id equals sroid select srod).ToList();
1509:              }
1510:   
1511:              return list.Distinct().ToList();
1512:          }
1513:   
1514:          ////////////////////////////////////////////////////////////////////////////
1515:   
1516:          /// <summary>
1517:          /// 
1518:          /// </summary>
1519:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntList(List<string> nddOntIdList)
1520:          {
1521:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
1522:   
1523:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdList on srsid.Id equals nid select srsid).ToList();
1524:   
1525:              return list.Distinct().ToList();
1526:          }
1527:   
1528:          ////////////////////////////////////////////////////////////////////////////
1529:   
1530:          /// <summary>
1531:          /// 
1532:          /// </summary>
1533:          public static List<Ia.Ngn.Cl.Model.Access> AccessList(List<string> accessIdList)
1534:          {
1535:              List<Ia.Ngn.Cl.Model.Access> list;
1536:   
1537:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1538:              {
1539:                  list = (from a in db.Accesses join aid in accessIdList on a.Id equals aid select a).ToList();
1540:              }
1541:   
1542:              return list.Distinct().ToList();
1543:          }
1544:   
1545:          ////////////////////////////////////////////////////////////////////////////
1546:   
1547:          /// <summary>
1548:          /// 
1549:          /// </summary>
1550:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAddress(int kuwaitNgnAreaId, string block, int street, int premisesOld, int premisesNew)
1551:          {
1552:              string streetString, premisesOldString, premisesNewString;
1553:              List<Ia.Ngn.Cl.Model.Access> list;
1554:   
1555:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1556:              {
1557:                  //oltIdList = kuwaitNgnArea.Site.Routers.SelectMany(v => v.Odfs.SelectMany(u => u.Olts.Select(w => w.Id))).ToList();
1558:   
1559:                  streetString = street.ToString();
1560:                  premisesOldString = premisesOld.ToString();
1561:                  premisesNewString = premisesNew.ToString();
1562:   
1563:                  list = (from a in db.Accesses
1564:                              //join oid in oltIdList on a.Olt equals oid
1565:                          where
1566:                          a.AreaId == kuwaitNgnAreaId
1567:                          &&
1568:                          (
1569:                          a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString
1570:                          || a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && premisesNew == 0
1571:                          || a.Block == block && a.Street == streetString && a.PremisesNew == premisesNewString && premisesOld == 0
1572:                          || a.Block == block && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString && street == 0
1573:                          || a.Block == block && a.PremisesOld == premisesOldString && street == 0 && premisesNew == 0
1574:                          || a.Block == block && a.PremisesNew == premisesNewString && street == 0 && premisesOld == 0
1575:                          || a.Block == block && a.Street == streetString && premisesOld == 0 && premisesNew == 0
1576:                          || a.Block == block && street == 0 && premisesOld == 0 && premisesNew == 0
1577:                          )
1578:                          select a).ToList();
1579:              }
1580:   
1581:              return list.Distinct().ToList();
1582:          }
1583:   
1584:          ////////////////////////////////////////////////////////////////////////////
1585:   
1586:          /// <summary>
1587:          /// 
1588:          /// </summary>
1589:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAreaAndBlock(int kuwaitNgnAreaId, string block)
1590:          {
1591:              List<Ia.Ngn.Cl.Model.Access> list;
1592:   
1593:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1594:              {
1595:                  list = (from a in db.Accesses where a.AreaId == kuwaitNgnAreaId && a.Block == block select a).ToList();
1596:              }
1597:   
1598:              return list.Distinct().ToList();
1599:          }
1600:   
1601:          ////////////////////////////////////////////////////////////////////////////
1602:   
1603:          /// <summary>
1604:          /// 
1605:          /// </summary>
1606:          public static List<Ia.Ngn.Cl.Model.Ont> OntList(List<string> ontIdList)
1607:          {
1608:              List<Ia.Ngn.Cl.Model.Ont> list;
1609:   
1610:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1611:              {
1612:                  list = (from o in db.Onts join oid in ontIdList on o.Id equals oid select o).ToList();
1613:              }
1614:   
1615:              return list.Distinct().ToList();
1616:          }
1617:   
1618:          ////////////////////////////////////////////////////////////////////////////
1619:   
1620:          /// <summary>
1621:          /// 
1622:          /// </summary>
1623:          public static List<Ia.Ngn.Cl.Model.OntOntPots> OntOntPotsListFromOntOntPotsIdList(List<string> ontOntPotsIdList)
1624:          {
1625:              List<Ia.Ngn.Cl.Model.OntOntPots> list;
1626:   
1627:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1628:              {
1629:                  list = (from oop in db.OntOntPotses join oid in ontOntPotsIdList on oop.Id equals oid select oop).ToList();
1630:              }
1631:   
1632:              return list.Distinct().ToList();
1633:          }
1634:   
1635:          ////////////////////////////////////////////////////////////////////////////
1636:   
1637:          /// <summary>
1638:          /// 
1639:          /// </summary>
1640:          public static List<Ia.Ngn.Cl.Model.Event> EventList(List<long> eventIdList)
1641:          {
1642:              List<Ia.Ngn.Cl.Model.Event> list;
1643:   
1644:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1645:              {
1646:                  list = (from e in db.Events join eid in eventIdList on e.Id equals eid select e).ToList();
1647:              }
1648:   
1649:              return list.Distinct().ToList();
1650:          }
1651:   
1652:          ////////////////////////////////////////////////////////////////////////////
1653:   
1654:          /// <summary>
1655:          /// 
1656:          /// </summary>
1657:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> SubPartyList(List<string> subPartyIdList)
1658:          {
1659:              List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> list;
1660:   
1661:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1662:              {
1663:                  list = (from sp in db.SubParties
1664:                          join spid in subPartyIdList on sp.Id equals spid
1665:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
1666:                          {
1667:                              Id = sp.Id,
1668:                              PartyId = sp.PartyId,
1669:                              PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
1670:                              DisplayName = sp.DisplayName,
1671:                              Category = sp.Category,
1672:                              AssocOtasRealm = sp.AssocOtasRealm,
1673:                              ServiceSuspension = sp.ServiceSuspension,
1674:                              Created = sp.Created,
1675:                              Updated = sp.Updated
1676:                          }).ToList();
1677:              }
1678:   
1679:              return list.Distinct().ToList();
1680:          }
1681:   
1682:          ////////////////////////////////////////////////////////////////////////////
1683:   
1684:          /// <summary>
1685:          /// 
1686:          /// </summary>
1687:          public static List<Ia.Ngn.Cl.Model.Report> ReportList(List<int> reportIdList)
1688:          {
1689:              List<Ia.Ngn.Cl.Model.Report> list;
1690:   
1691:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1692:              {
1693:                  if (reportIdList.Count <= 32)
1694:                  {
1695:                      list = (from r in db.Reports join rid in reportIdList on r.Id equals rid select r).ToList();
1696:                  }
1697:                  else if (reportIdList.Count <= 64)
1698:                  {
1699:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1700:                      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();
1701:                  }
1702:                  else if (reportIdList.Count <= 96)
1703:                  {
1704:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1705:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1706:                      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();
1707:                  }
1708:                  else if (reportIdList.Count <= 128)
1709:                  {
1710:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1711:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1712:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1713:                      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();
1714:                  }
1715:                  else if (reportIdList.Count <= 160)
1716:                  {
1717:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1718:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1719:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1720:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1721:                      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();
1722:                  }
1723:                  else if (reportIdList.Count <= 192)
1724:                  {
1725:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1726:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1727:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1728:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1729:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1730:                      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();
1731:                  }
1732:                  else if (reportIdList.Count <= 224)
1733:                  {
1734:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1735:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1736:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1737:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1738:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1739:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).ToList();
1740:                      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();
1741:                  }
1742:                  else //if (reportIdList.Count <= 256)
1743:                  {
1744:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).ToList();
1745:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).ToList();
1746:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).ToList();
1747:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).ToList();
1748:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).ToList();
1749:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).ToList();
1750:                      list = list.Union(from r in db.Reports join rid in reportIdList.GetRange(192, 32) on r.Id equals rid select r).ToList();
1751:                      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();
1752:                  }
1753:              }
1754:   
1755:              return list.Distinct().ToList();
1756:          }
1757:   
1758:          ////////////////////////////////////////////////////////////////////////////
1759:   
1760:          /// <summary>
1761:          /// 
1762:          /// </summary>
1763:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> HuSbrList(List<string> huSbrImpuList)
1764:          {
1765:              List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> list;
1766:   
1767:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1768:              {
1769:                  list = (from h in db.HuSbrs
1770:                          join hid in huSbrImpuList on h.IMPU equals hid
1771:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
1772:                          {
1773:                              COP = h.COP,
1774:                              CSC = h.CSC,
1775:                              Id = h.Id,
1776:                              IMPU = h.IMPU,
1777:                              ITT = h.ITT,
1778:                              LP = h.LP,
1779:                              NS3PTY = h.NS3PTY,
1780:                              NSABRC = h.NSABRC,
1781:                              NSCBA = h.NSCBA,
1782:                              NSCFU = h.NSCFU,
1783:                              NSCLIP = h.NSCLIP,
1784:                              NSCW = h.NSCW,
1785:                              NSFAX = h.NSFAX,
1786:                              NSHOLD = h.NSHOLD,
1787:                              NSNPTY = h.NSNPTY,
1788:                              NSWAKE_UP = h.NSWAKE_UP,
1789:                              Created = h.Created,
1790:                              Updated = h.Updated
1791:                          }).ToList();
1792:              }
1793:   
1794:              return list.Distinct().ToList();
1795:          }
1796:   
1797:          ////////////////////////////////////////////////////////////////////////////
1798:   
1799:          /// <summary>
1800:          /// 
1801:          /// </summary>
1802:          public static List<Ia.Ngn.Cl.Model.Huawei.Owsbr> OwsbrList(List<string> owsbrImpuList)
1803:          {
1804:              List<Ia.Ngn.Cl.Model.Huawei.Owsbr> list;
1805:   
1806:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1807:              {
1808:                  list = (from o in db.Owsbrs join oid in owsbrImpuList on o.IMPU equals oid select o).ToList();
1809:              }
1810:   
1811:              return list.Distinct().ToList();
1812:          }
1813:   
1814:          ////////////////////////////////////////////////////////////////////////////
1815:   
1816:          /// <summary>
1817:          /// 
1818:          /// </summary>
1819:          public static List<Ia.Ngn.Cl.Model.Huawei.Seruattr> SeruattrList(List<string> serviceList)
1820:          {
1821:              List<Ia.Ngn.Cl.Model.Huawei.Seruattr> list;
1822:   
1823:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1824:              {
1825:                  list = (from s in db.Seruattrs join sid in serviceList on s.USRNUM equals sid select s).ToList();
1826:              }
1827:   
1828:              return list.Distinct().ToList();
1829:          }
1830:   
1831:          ////////////////////////////////////////////////////////////////////////////
1832:   
1833:          /// <summary>
1834:          /// 
1835:          /// </summary>
1836:          public static List<Ia.Ngn.Cl.Model.OntServiceVoip> OntServiceVoipList(List<string> ontServiceVoipIdList)
1837:          {
1838:              List<Ia.Ngn.Cl.Model.OntServiceVoip> list;
1839:   
1840:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1841:              {
1842:                  if (ontServiceVoipIdList.Count <= 32)
1843:                  {
1844:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList on ov.Id equals ovid select ov).ToList();
1845:                  }
1846:                  else
1847:                  {
1848:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList.GetRange(0, 32) on ov.Id equals ovid select ov).ToList();
1849:                      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();
1850:                  }
1851:              }
1852:   
1853:              return list.Distinct().ToList();
1854:          }
1855:   
1856:          ////////////////////////////////////////////////////////////////////////////
1857:   
1858:          /// <summary>
1859:          /// 
1860:          /// </summary>
1861:          public static List<Ia.Ngn.Cl.Model.Ui.Service2> ServiceList(List<string> serviceIdList)
1862:          {
1863:              List<Ia.Ngn.Cl.Model.Service2> list;
1864:              List<Ia.Ngn.Cl.Model.Ui.Service2> uiList;
1865:   
1866:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1867:              {
1868:                  if (serviceIdList.Count <= 32)
1869:                  {
1870:                      list = (from s in db.Service2s join sid in serviceIdList on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1871:                  }
1872:                  else if (serviceIdList.Count <= 64)
1873:                  {
1874:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1875:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1876:                  }
1877:                  else if (serviceIdList.Count <= 96)
1878:                  {
1879:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1880:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1881:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1882:                  }
1883:                  else if (serviceIdList.Count <= 128)
1884:                  {
1885:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1886:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1887:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1888:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1889:                  }
1890:                  else if (serviceIdList.Count <= 160)
1891:                  {
1892:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1893:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1894:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1895:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1896:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1897:                  }
1898:                  else if (serviceIdList.Count <= 192)
1899:                  {
1900:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1901:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1902:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1903:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1904:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1905:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1906:                  }
1907:                  else if (serviceIdList.Count <= 224)
1908:                  {
1909:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1910:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1911:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1912:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1913:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1914:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1915:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1916:                  }
1917:                  else if (serviceIdList.Count <= 256)
1918:                  {
1919:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1920:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1921:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1922:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1923:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1924:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1925:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1926:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1927:                  }
1928:                  else if (serviceIdList.Count <= 288)
1929:                  {
1930:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1931:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1932:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1933:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1934:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1935:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1936:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1937:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1938:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, serviceIdList.Count - 256 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1939:                  }
1940:                  else if (serviceIdList.Count <= 320)
1941:                  {
1942:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1943:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1944:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1945:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1946:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1947:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1948:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1949:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1950:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1951:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, serviceIdList.Count - 288 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1952:                  }
1953:                  else if (serviceIdList.Count <= 352)
1954:                  {
1955:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1956:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1957:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1958:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1959:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1960:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1961:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1962:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1963:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1964:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1965:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, serviceIdList.Count - 320 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1966:                  }
1967:                  else if (serviceIdList.Count <= 384)
1968:                  {
1969:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1970:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1971:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1972:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1973:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1974:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1975:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1976:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1977:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1978:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1979:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1980:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, serviceIdList.Count - 352 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1981:                  }
1982:                  else if (serviceIdList.Count <= 416)
1983:                  {
1984:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1985:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1986:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1987:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1988:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1989:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1990:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1991:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1992:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1993:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1994:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1995:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1996:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, serviceIdList.Count - 384 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
1997:                  }
1998:                  else if (serviceIdList.Count <= 448)
1999:                  {
2000:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2001:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2002:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2003:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2004:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2005:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2006:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2007:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2008:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2009:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2010:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2011:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2012:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2013:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, serviceIdList.Count - 416 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2014:                  }
2015:                  else if (serviceIdList.Count <= 480)
2016:                  {
2017:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2018:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2019:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2020:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2021:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2022:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2023:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2024:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2025:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2026:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2027:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2028:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2029:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2030:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2031:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, serviceIdList.Count - 448 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2032:                  }
2033:                  else if (serviceIdList.Count <= 512)
2034:                  {
2035:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2036:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2037:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2038:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2039:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2040:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2041:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2042:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2043:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2044:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2045:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2046:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2047:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2048:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2049:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2050:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, serviceIdList.Count - 480 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2051:                  }
2052:                  else if (serviceIdList.Count <= 544)
2053:                  {
2054:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2055:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2056:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2057:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2058:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2059:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2060:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2061:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2062:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2063:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2064:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2065:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2066:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2067:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2068:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2069:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2070:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, serviceIdList.Count - 512 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2071:                  }
2072:                  else //if (serviceIdList.Count <= ??)
2073:                  {
2074:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2075:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2076:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2077:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2078:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2079:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2080:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2081:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2082:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2083:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2084:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2085:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2086:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2087:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2088:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2089:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2090:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, 32) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2091:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(544, serviceIdList.Count - 544 - 1) on s.Id equals sid /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s).ToList();
2092:                  }
2093:   
2094:                  uiList = (from s in list
2095:                            select new Ia.Ngn.Cl.Model.Ui.Service2()
2096:                            {
2097:                                Id = s.Id,
2098:                                AbbriviatedCalling = s.AbbriviatedCalling,
2099:                                AlarmCall = s.AlarmCall,
2100:                                CallBarring = s.CallBarring,
2101:                                CallerId = s.CallerId,
2102:                                CallForwarding = s.CallForwarding,
2103:                                CallWaiting = s.CallWaiting,
2104:                                ConferenceCall = s.ConferenceCall,
2105:                                Created = s.Created,
2106:                                InternationalCalling = s.InternationalCalling,
2107:                                InternationalCallingUserControlled = s.InternationalCallingUserControlled,
2108:                                Port = s.Port,
2109:                                Pin = s.Pin,
2110:                                Service = s.Service,
2111:                                ServiceType = s.ServiceType,
2112:                                ServiceSuspension = s.ServiceSuspension,
2113:                                ServiceTypeName = s.ServiceType.ToString(),
2114:                                Updated = s.Updated,
2115:                                AccessId = (s.Access != null) ? s.Access.Id : string.Empty
2116:                            }).ToList();
2117:              }
2118:   
2119:              return uiList.Distinct().ToList();
2120:          }
2121:   
2122:          ////////////////////////////////////////////////////////////////////////////
2123:   
2124:          /// <summary>
2125:          /// 
2126:          /// </summary>
2127:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> SubscriberList(List<string> subscriberIdList)
2128:          {
2129:              List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> list;
2130:   
2131:              // below: db.Subscribers contains XML fields which can not be evaluated in a Union() function.
2132:   
2133:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2134:              {
2135:                  list = (from s in db.Subscribers
2136:                          join sid in subscriberIdList on s.Id equals sid
2137:                          select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
2138:                          {
2139:                              Id = s.Id,
2140:                              AlternateOtasRealm = s.AlternateOtasRealm,
2141:                              PartyId = s.PartyId,
2142:                              AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
2143:                              AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
2144:                              CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
2145:                              CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
2146:                              CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
2147:                              ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
2148:                              InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
2149:                              InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
2150:                              //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
2151:                              Created = s.Created,
2152:                              Updated = s.Updated,
2153:                          }).ToList();
2154:              }
2155:   
2156:              return list.Distinct().ToList();
2157:          }
2158:   
2159:          ////////////////////////////////////////////////////////////////////////////
2160:   
2161:          /// <summary>
2162:          /// 
2163:          /// </summary>
2164:          public static List<string> AccessIdList(int oltId, int ponNumber, int ontInternalNumber)
2165:          {
2166:              List<string> list;
2167:   
2168:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2169:              {
2170:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber && a.Ont == ontInternalNumber select a.Id).ToList();
2171:              }
2172:   
2173:              return list.Distinct().ToList();
2174:          }
2175:   
2176:          ////////////////////////////////////////////////////////////////////////////
2177:   
2178:          /// <summary>
2179:          /// 
2180:          /// </summary>
2181:          public static List<string> AccessIdList(int oltId, int ponNumber)
2182:          {
2183:              List<string> list;
2184:   
2185:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2186:              {
2187:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber select a.Id).ToList();
2188:              }
2189:   
2190:              return list.Distinct().ToList();
2191:          }
2192:   
2193:          ////////////////////////////////////////////////////////////////////////////
2194:   
2195:          /// <summary>
2196:          /// 
2197:          /// </summary>
2198:          public static List<int> EmsDevIdListFromEmsBoardIdList(List<string> emsBoardIdList)
2199:          {
2200:              List<int> list;
2201:   
2202:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2203:              {
2204:                  list = (from ed in db.EmsDevs
2205:                          join eb in db.EmsBoards on ed.Id equals eb.EmsDev.Id
2206:                          join ebid in emsBoardIdList on eb.Id equals ebid
2207:                          select ed.Id).ToList();
2208:              }
2209:   
2210:              return list.Distinct().ToList();
2211:          }
2212:   
2213:          ////////////////////////////////////////////////////////////////////////////
2214:   
2215:          /// <summary>
2216:          /// 
2217:          /// </summary>
2218:          public static List<int> EmsDevIdListFromAccessIdList(List<string> accessIdList)
2219:          {
2220:              List<int> list;
2221:   
2222:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2223:              {
2224:                  list = (from ed in db.EmsDevs
2225:                          join aid in accessIdList on ed.Access.Id equals aid
2226:                          select ed.Id).ToList();
2227:              }
2228:   
2229:              return list.Distinct().ToList();
2230:          }
2231:   
2232:          ////////////////////////////////////////////////////////////////////////////
2233:   
2234:          /// <summary>
2235:          /// 
2236:          /// </summary>
2237:          public static List<string> EmsBoardIdListFromEmsPortIdList(List<string> emsPortIdList)
2238:          {
2239:              List<string> list;
2240:   
2241:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2242:              {
2243:                  list = (from eb in db.EmsBoards
2244:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
2245:                          join epid in emsPortIdList on ep.Id equals epid
2246:                          select eb.Id).ToList();
2247:              }
2248:   
2249:              return list.Distinct().ToList();
2250:          }
2251:   
2252:          ////////////////////////////////////////////////////////////////////////////
2253:   
2254:          /// <summary>
2255:          /// 
2256:          /// </summary>
2257:          public static List<string> EmsPortIdListFromEmsOntIdList(List<string> emsOntIdList)
2258:          {
2259:              List<string> list;
2260:   
2261:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2262:              {
2263:                  list = (from ep in db.EmsPorts
2264:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
2265:                          join eoid in emsOntIdList on eo.Id equals eoid
2266:                          select ep.Id).ToList();
2267:              }
2268:   
2269:              return list.Distinct().ToList();
2270:          }
2271:   
2272:          ////////////////////////////////////////////////////////////////////////////
2273:   
2274:          /// <summary>
2275:          /// 
2276:          /// </summary>
2277:          public static List<string> EmsOntIdListFromNddOntIdList(List<string> nddOntIdList)
2278:          {
2279:              List<string> list;
2280:   
2281:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2282:              {
2283:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.Id).ToList();
2284:              }
2285:   
2286:              return list.Distinct().ToList();
2287:          }
2288:   
2289:          ////////////////////////////////////////////////////////////////////////////
2290:   
2291:          /// <summary>
2292:          /// 
2293:          /// </summary>
2294:          public static List<string> EmsOntIpListFromNddOntIdList(List<string> nddOntIdList)
2295:          {
2296:              List<string> list;
2297:   
2298:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2299:              {
2300:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.IP).ToList();
2301:              }
2302:   
2303:              return list.Distinct().ToList();
2304:          }
2305:   
2306:          ////////////////////////////////////////////////////////////////////////////
2307:   
2308:          /// <summary>
2309:          /// 
2310:          /// </summary>
2311:          public static List<string> SbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
2312:          {
2313:              List<string> list;
2314:   
2315:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2316:              {
2317:                  list = (from s in db.HuSbrs join isd in impuSipDomainList on s.IMPU equals isd select s.IMPU).ToList();
2318:              }
2319:   
2320:              return list.Distinct().ToList();
2321:          }
2322:   
2323:          ////////////////////////////////////////////////////////////////////////////
2324:   
2325:          /// <summary>
2326:          /// 
2327:          /// </summary>
2328:          public static List<string> OwSbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
2329:          {
2330:              List<string> list;
2331:   
2332:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2333:              {
2334:                  list = (from o in db.Owsbrs join i in impuSipDomainList on o.IMPU equals i select o.IMPU).ToList();
2335:              }
2336:   
2337:              return list.Distinct().ToList();
2338:          }
2339:   
2340:          ////////////////////////////////////////////////////////////////////////////
2341:   
2342:          /// <summary>
2343:          /// 
2344:          /// </summary>
2345:          public static List<string> ServiceRequestServiceIdListFromAccessIdList(List<string> accessIdList)
2346:          {
2347:              List<string> list;
2348:   
2349:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2350:              {
2351:                  list = (from srs in db.ServiceRequestServices join aid in accessIdList on srs.Access.Id equals aid select srs.Id).ToList();
2352:              }
2353:   
2354:              return list.Distinct().ToList();
2355:          }
2356:   
2357:          ////////////////////////////////////////////////////////////////////////////
2358:   
2359:          /// <summary>
2360:          /// 
2361:          /// </summary>
2362:          public static List<string> ServiceRequestServiceIdListFromServiceList(List<string> serviceList)
2363:          {
2364:              List<string> list;
2365:   
2366:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2367:              {
2368:                  list = (from srs in db.ServiceRequestServices join si in serviceList on srs.Service equals si select srs.Id).ToList();
2369:              }
2370:   
2371:              return list.Distinct().ToList();
2372:          }
2373:   
2374:          ////////////////////////////////////////////////////////////////////////////
2375:   
2376:          /// <summary>
2377:          /// 
2378:          /// </summary>
2379:          public static List<string> ServiceIdListFromServiceList(List<string> serviceList)
2380:          {
2381:              List<string> list;
2382:   
2383:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2384:              {
2385:                  if (serviceList.Count <= 32)
2386:                  {
2387:                      list = (from s in db.Service2s join si in serviceList on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2388:                  }
2389:                  else if (serviceList.Count <= 64)
2390:                  {
2391:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2392:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, serviceList.Count - 32 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2393:                  }
2394:                  else if (serviceList.Count <= 96)
2395:                  {
2396:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2397:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2398:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, serviceList.Count - 64 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2399:                  }
2400:                  else if (serviceList.Count <= 128)
2401:                  {
2402:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2403:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2404:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2405:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, serviceList.Count - 96 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2406:                  }
2407:                  else if (serviceList.Count <= 160)
2408:                  {
2409:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2410:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2411:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2412:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2413:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, serviceList.Count - 128 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2414:                  }
2415:                  else if (serviceList.Count <= 192)
2416:                  {
2417:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2418:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2419:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2420:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2421:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2422:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, serviceList.Count - 160 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2423:                  }
2424:                  else if (serviceList.Count <= 224)
2425:                  {
2426:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2427:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2428:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2429:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2430:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2431:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2432:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, serviceList.Count - 192 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2433:                  }
2434:                  else //if (serviceList.Count <= 256)
2435:                  {
2436:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2437:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2438:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2439:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2440:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2441:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2442:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, 32) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2443:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(224, serviceList.Count - 224 - 1) on s.Service equals si /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/ select s.Id).ToList();
2444:                  }
2445:              }
2446:   
2447:              return list.Distinct().ToList();
2448:          }
2449:   
2450:          ////////////////////////////////////////////////////////////////////////////
2451:   
2452:          /// <summary>
2453:          /// 
2454:          /// </summary>
2455:          public static List<int> ReportIdListFromServiceList(List<string> serviceList)
2456:          {
2457:              List<int> list;
2458:   
2459:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
2460:              // <type id="2" name="Ont Name" arabicName=""/>
2461:   
2462:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2463:              {
2464:                  if (serviceList.Count <= 32)
2465:                  {
2466:                      list = (from r in db.Reports join s in serviceList on r.Service equals s select r.Id).ToList();
2467:                  }
2468:                  else if (serviceList.Count <= 64)
2469:                  {
2470:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2471:                      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();
2472:                  }
2473:                  else if (serviceList.Count <= 96)
2474:                  {
2475:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2476:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2477:                      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();
2478:                  }
2479:                  else if (serviceList.Count <= 128)
2480:                  {
2481:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2482:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2483:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2484:                      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();
2485:                  }
2486:                  else if (serviceList.Count <= 160)
2487:                  {
2488:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2489:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2490:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2491:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2492:                      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();
2493:                  }
2494:                  else if (serviceList.Count <= 192)
2495:                  {
2496:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2497:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2498:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2499:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2500:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2501:                      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();
2502:                  }
2503:                  else if (serviceList.Count <= 224)
2504:                  {
2505:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2506:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2507:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2508:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2509:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2510:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
2511:                      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();
2512:                  }
2513:                  else //if (serviceList.Count <= 256)
2514:                  {
2515:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
2516:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
2517:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
2518:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
2519:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
2520:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
2521:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
2522:                      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();
2523:                  }
2524:              }
2525:   
2526:              return list.Distinct().ToList();
2527:          }
2528:   
2529:          ////////////////////////////////////////////////////////////////////////////
2530:   
2531:          /// <summary>
2532:          /// 
2533:          /// </summary>
2534:          public static List<string> ServiceIdListFromAccessIdList(List<string> accessIdList)
2535:          {
2536:              List<string> list;
2537:   
2538:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2539:              {
2540:                  list = (from s in db.Service2s
2541:                          join aid in accessIdList on s.Access.Id equals aid
2542:                          /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
2543:                          select new Ia.Ngn.Cl.Model.Ui.Service2() { Id = s.Id }.Id).ToList();
2544:              }
2545:   
2546:              return list.Distinct().ToList();
2547:          }
2548:   
2549:          ////////////////////////////////////////////////////////////////////////////
2550:   
2551:          /// <summary>
2552:          /// 
2553:          /// </summary>
2554:          public static List<string> AccessIdListFromServiceList(List<string> serviceList)
2555:          {
2556:              List<string> list;
2557:   
2558:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2559:              {
2560:                  list = (from s in db.Service2s
2561:                          join si in serviceList on s.Service equals si
2562:                          /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
2563:                          where s.Access != null
2564:                          select s.Access.Id).ToList();
2565:              }
2566:   
2567:              return list.Distinct().ToList();
2568:          }
2569:   
2570:          ////////////////////////////////////////////////////////////////////////////
2571:   
2572:          /// <summary>
2573:          /// 
2574:          /// </summary>
2575:          public static List<string> AccessIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
2576:          {
2577:              List<string> list;
2578:   
2579:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2580:              {
2581:                  list = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList on srs.Id equals srsid where srs.Access != null select srs.Access.Id).ToList();
2582:              }
2583:   
2584:              return list.Distinct().ToList();
2585:          }
2586:   
2587:          ////////////////////////////////////////////////////////////////////////////
2588:   
2589:          /// <summary>
2590:          /// 
2591:          /// </summary>
2592:          public static List<string> ServiceRequestOntIdListFromAccessIdList(List<string> accessIdList)
2593:          {
2594:              List<string> list;
2595:   
2596:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2597:              {
2598:                  list = (from sro in db.ServiceRequestOnts join aid in accessIdList on sro.Access.Id equals aid select sro.Id).ToList();
2599:              }
2600:   
2601:              return list.Distinct().ToList();
2602:          }
2603:   
2604:          ////////////////////////////////////////////////////////////////////////////
2605:   
2606:          /// <summary>
2607:          /// 
2608:          /// </summary>
2609:          public static List<int> ServiceRequestIdListFromServiceList(List<string> serviceList)
2610:          {
2611:              List<int> list, numberList;
2612:   
2613:              if (serviceList.Count > 0)
2614:              {
2615:                  numberList = new List<int>();
2616:   
2617:                  foreach (string s in serviceList)
2618:                  {
2619:                      if (int.TryParse(s, out int i)) numberList.Add(i);
2620:                  }
2621:   
2622:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2623:                  {
2624:                      if (serviceList.Count <= 32)
2625:                      {
2626:                          list = (from sr in db.ServiceRequests join srsid in numberList on sr.Number equals srsid select sr.Id).ToList();
2627:                      }
2628:                      else if (serviceList.Count <= 64)
2629:                      {
2630:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2631:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, serviceList.Count - 32 - 1) on sr.Number equals srsid select sr.Id).ToList();
2632:                      }
2633:                      else if (serviceList.Count <= 96)
2634:                      {
2635:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2636:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
2637:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, serviceList.Count - 64 - 1) on sr.Number equals srsid select sr.Id).ToList();
2638:                      }
2639:                      else if (serviceList.Count <= 128)
2640:                      {
2641:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2642:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
2643:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
2644:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, serviceList.Count - 96 - 1) on sr.Number equals srsid select sr.Id).ToList();
2645:                      }
2646:                      else if (serviceList.Count <= 160)
2647:                      {
2648:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2649:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
2650:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
2651:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
2652:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, serviceList.Count - 128 - 1) on sr.Number equals srsid select sr.Id).ToList();
2653:                      }
2654:                      else if (serviceList.Count <= 192)
2655:                      {
2656:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2657:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
2658:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
2659:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
2660:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
2661:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, serviceList.Count - 160 - 1) on sr.Number equals srsid select sr.Id).ToList();
2662:                      }
2663:                      else if (serviceList.Count <= 224)
2664:                      {
2665:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2666:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
2667:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
2668:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
2669:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
2670:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, 32) on sr.Number equals srsid select sr.Id).ToList();
2671:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(192, serviceList.Count - 192 - 1) on sr.Number equals srsid select sr.Id).ToList();
2672:                      }
2673:                      else //if (serviceList.Count <= 256)
2674:                      {
2675:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
2676:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
2677:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
2678:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
2679:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
2680:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, 32) on sr.Number equals srsid select sr.Id).ToList();
2681:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(192, 32) on sr.Number equals srsid select sr.Id).ToList();
2682:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(224, serviceList.Count - 224 - 1) on sr.Number equals srsid select sr.Id).ToList();
2683:                      }
2684:                  }
2685:              }
2686:              else
2687:              {
2688:                  list = new List<int>();
2689:              }
2690:   
2691:              return list.Distinct().ToList();
2692:          }
2693:   
2694:          ////////////////////////////////////////////////////////////////////////////
2695:   
2696:          /// <summary>
2697:          /// 
2698:          /// </summary>
2699:          public static List<int> ServiceRequestIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
2700:          {
2701:              List<int> list;
2702:   
2703:              if (serviceRequestServiceIdList.Count > 0)
2704:              {
2705:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2706:                  {
2707:                      if (serviceRequestServiceIdList.Count <= 32)
2708:                      {
2709:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2710:                      }
2711:                      else if (serviceRequestServiceIdList.Count <= 64)
2712:                      {
2713:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2714:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, serviceRequestServiceIdList.Count - 32 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2715:                      }
2716:                      else if (serviceRequestServiceIdList.Count <= 96)
2717:                      {
2718:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2719:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2720:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, serviceRequestServiceIdList.Count - 64 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2721:                      }
2722:                      else if (serviceRequestServiceIdList.Count <= 128)
2723:                      {
2724:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2725:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2726:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2727:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, serviceRequestServiceIdList.Count - 96 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2728:                      }
2729:                      else if (serviceRequestServiceIdList.Count <= 160)
2730:                      {
2731:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2732:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2733:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2734:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2735:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, serviceRequestServiceIdList.Count - 128 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2736:                      }
2737:                      else if (serviceRequestServiceIdList.Count <= 192)
2738:                      {
2739:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2740:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2741:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2742:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2743:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2744:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(160, serviceRequestServiceIdList.Count - 160 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2745:                      }
2746:                      else if (serviceRequestServiceIdList.Count <= 224)
2747:                      {
2748:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2749:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2750:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2751:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2752:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2753:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(160, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2754:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(192, serviceRequestServiceIdList.Count - 192 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2755:                      }
2756:                      else //if (serviceList.Count <= 256)
2757:                      {
2758:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2759:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2760:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2761:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(96, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2762:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(128, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2763:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(160, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2764:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(192, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2765:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(224, serviceRequestServiceIdList.Count - 224 - 1) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
2766:                      }
2767:                  }
2768:              }
2769:              else
2770:              {
2771:                  list = new List<int>();
2772:              }
2773:   
2774:              return list.Distinct().ToList();
2775:          }
2776:   
2777:          ////////////////////////////////////////////////////////////////////////////
2778:   
2779:          /// <summary>
2780:          /// 
2781:          /// </summary>
2782:          public static List<string> ServiceRequestHistoryIdListFromServiceList(List<string> serviceList)
2783:          {
2784:              List<int> numberList;
2785:              List<string> list;
2786:   
2787:              if (serviceList.Count > 0)
2788:              {
2789:                  numberList = new List<int>();
2790:   
2791:                  foreach (string s in serviceList)
2792:                  {
2793:                      if (int.TryParse(s, out int i)) numberList.Add(i);
2794:                  }
2795:   
2796:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
2797:                  {
2798:                      if (serviceList.Count <= 32)
2799:                      {
2800:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList on srh.Number equals srsid select srh.Id).ToList();
2801:                      }
2802:                      else if (serviceList.Count <= 64)
2803:                      {
2804:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2805:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, serviceList.Count - 32 - 1) on srh.Number equals srsid select srh.Id).ToList();
2806:                      }
2807:                      else if (serviceList.Count <= 96)
2808:                      {
2809:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2810:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
2811:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, serviceList.Count - 64 - 1) on srh.Number equals srsid select srh.Id).ToList();
2812:                      }
2813:                      else if (serviceList.Count <= 128)
2814:                      {
2815:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2816:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
2817:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
2818:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, serviceList.Count - 96 - 1) on srh.Number equals srsid select srh.Id).ToList();
2819:                      }
2820:                      else if (serviceList.Count <= 160)
2821:                      {
2822:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2823:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
2824:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
2825:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
2826:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, serviceList.Count - 128 - 1) on srh.Number equals srsid select srh.Id).ToList();
2827:                      }
2828:                      else if (serviceList.Count <= 192)
2829:                      {
2830:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2831:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
2832:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
2833:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
2834:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
2835:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, serviceList.Count - 160 - 1) on srh.Number equals srsid select srh.Id).ToList();
2836:                      }
2837:                      else if (serviceList.Count <= 224)
2838:                      {
2839:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2840:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
2841:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
2842:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
2843:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
2844:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, 32) on srh.Number equals srsid select srh.Id).ToList();
2845:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(192, serviceList.Count - 192 - 1) on srh.Number equals srsid select srh.Id).ToList();
2846:                      }
2847:                      else //if (serviceList.Count <= 256)
2848:                      {
2849:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
2850:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
2851:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
2852:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
2853:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
2854:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, 32) on srh.Number equals srsid select srh.Id).ToList();
2855:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(192, 32) on srh.Number equals srsid select srh.Id).ToList();
2856:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(224, serviceList.Count - 224 - 1) on srh.Number equals srsid select srh.Id).ToList();
2857:                      }
2858:                  }
2859:              }
2860:              else
2861:              {
2862:                  list = new List<string>();
2863:              }
2864:   
2865:              return list.Distinct().ToList();
2866:          }
2867:   
2868:          ////////////////////////////////////////////////////////////////////////////
2869:   
2870:          /// <summary>
2871:          /// 
2872:          /// </summary>
2873:          public static List<int> ServiceRequestTypeIdListFromServiceRequestIdList(List<int> serviceRequestIdList)
2874:          {
2875:              List<int> list;
2876:   
2877:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2878:              {
2879:                  if (serviceRequestIdList.Count <= 32)
2880:                  {
2881:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2882:                  }
2883:                  else if (serviceRequestIdList.Count <= 64)
2884:                  {
2885:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2886:                      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();
2887:                  }
2888:                  else if (serviceRequestIdList.Count <= 96)
2889:                  {
2890:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2891:                      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();
2892:                      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();
2893:                  }
2894:                  else if (serviceRequestIdList.Count <= 128)
2895:                  {
2896:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2897:                      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();
2898:                      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();
2899:                      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();
2900:                  }
2901:                  else if (serviceRequestIdList.Count <= 160)
2902:                  {
2903:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2904:                      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();
2905:                      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();
2906:                      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();
2907:                      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();
2908:                  }
2909:                  else if (serviceRequestIdList.Count <= 192)
2910:                  {
2911:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2912:                      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();
2913:                      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();
2914:                      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();
2915:                      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();
2916:                      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();
2917:                  }
2918:                  else if (serviceRequestIdList.Count <= 224)
2919:                  {
2920:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2921:                      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();
2922:                      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();
2923:                      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();
2924:                      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();
2925:                      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();
2926:                      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();
2927:                  }
2928:                  else if (serviceRequestIdList.Count <= 256)
2929:                  {
2930:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2931:                      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();
2932:                      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();
2933:                      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();
2934:                      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();
2935:                      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();
2936:                      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();
2937:                      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();
2938:                  }
2939:                  else if (serviceRequestIdList.Count <= 288)
2940:                  {
2941:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2942:                      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();
2943:                      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();
2944:                      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();
2945:                      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();
2946:                      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();
2947:                      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();
2948:                      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();
2949:                      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();
2950:                  }
2951:                  else if (serviceRequestIdList.Count <= 320)
2952:                  {
2953:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2954:                      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();
2955:                      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();
2956:                      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();
2957:                      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();
2958:                      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();
2959:                      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();
2960:                      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();
2961:                      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();
2962:                      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();
2963:                  }
2964:                  else if (serviceRequestIdList.Count <= 352)
2965:                  {
2966:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2967:                      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();
2968:                      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();
2969:                      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();
2970:                      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();
2971:                      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();
2972:                      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();
2973:                      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();
2974:                      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();
2975:                      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();
2976:                      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();
2977:                  }
2978:                  else if (serviceRequestIdList.Count <= 384)
2979:                  {
2980:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2981:                      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();
2982:                      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();
2983:                      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();
2984:                      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();
2985:                      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();
2986:                      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();
2987:                      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();
2988:                      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();
2989:                      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();
2990:                      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();
2991:                      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();
2992:                  }
2993:                  else if (serviceRequestIdList.Count <= 416)
2994:                  {
2995:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
2996:                      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();
2997:                      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();
2998:                      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();
2999:                      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();
3000:                      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();
3001:                      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();
3002:                      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();
3003:                      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();
3004:                      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();
3005:                      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();
3006:                      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();
3007:                      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();
3008:                  }
3009:                  else if (serviceRequestIdList.Count <= 448)
3010:                  {
3011:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3012:                      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();
3013:                      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();
3014:                      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();
3015:                      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();
3016:                      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();
3017:                      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();
3018:                      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();
3019:                      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();
3020:                      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();
3021:                      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();
3022:                      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();
3023:                      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();
3024:                      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();
3025:                  }
3026:                  else if (serviceRequestIdList.Count <= 480)
3027:                  {
3028:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3029:                      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();
3030:                      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();
3031:                      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();
3032:                      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();
3033:                      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();
3034:                      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();
3035:                      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();
3036:                      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();
3037:                      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();
3038:                      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();
3039:                      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();
3040:                      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();
3041:                      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();
3042:                      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();
3043:                  }
3044:                  else if (serviceRequestIdList.Count <= 512)
3045:                  {
3046:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3047:                      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();
3048:                      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();
3049:                      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();
3050:                      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();
3051:                      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();
3052:                      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();
3053:                      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();
3054:                      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();
3055:                      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();
3056:                      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();
3057:                      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();
3058:                      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();
3059:                      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();
3060:                      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();
3061:                      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();
3062:                  }
3063:                  else if (serviceRequestIdList.Count <= 544)
3064:                  {
3065:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3066:                      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();
3067:                      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();
3068:                      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();
3069:                      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();
3070:                      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();
3071:                      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();
3072:                      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();
3073:                      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();
3074:                      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();
3075:                      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();
3076:                      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();
3077:                      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();
3078:                      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();
3079:                      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();
3080:                      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();
3081:                      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();
3082:                  }
3083:                  else //if (serviceRequestIdList.Count <= ??)
3084:                  {
3085:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3086:                      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();
3087:                      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();
3088:                      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();
3089:                      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();
3090:                      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();
3091:                      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();
3092:                      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();
3093:                      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();
3094:                      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();
3095:                      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();
3096:                      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();
3097:                      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();
3098:                      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();
3099:                      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();
3100:                      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();
3101:                      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();
3102:                      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();
3103:                  }
3104:              }
3105:   
3106:              return list.Distinct().ToList();
3107:          }
3108:   
3109:          ////////////////////////////////////////////////////////////////////////////
3110:   
3111:          /// <summary>
3112:          /// 
3113:          /// </summary>
3114:          public static List<string> NddOntIdList(int oltId, int ponNumber, int ontInternalNumber)
3115:          {
3116:              List<string> list;
3117:   
3118:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where srsid.Pon.PonGroup.Olt.Id == oltId && srsid.Pon.Number == ponNumber && srsid.Number == ontInternalNumber select srsid.Id).ToList();
3119:   
3120:              return list.Distinct().ToList();
3121:          }
3122:   
3123:          ////////////////////////////////////////////////////////////////////////////
3124:   
3125:          /// <summary>
3126:          /// 
3127:          /// </summary>
3128:          public static List<string> NddOntIdList(int oltId, int ponNumber)
3129:          {
3130:              List<string> list;
3131:   
3132:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where srsid.Pon.PonGroup.Olt.Id == oltId && srsid.Pon.Number == ponNumber select srsid.Id).ToList();
3133:   
3134:              return list.Distinct().ToList();
3135:          }
3136:   
3137:          ////////////////////////////////////////////////////////////////////////////
3138:   
3139:          /// <summary>
3140:          /// 
3141:          /// </summary>
3142:          public static List<string> NddOntIdListFromAccessIdList(List<string> accessIdList)
3143:          {
3144:              List<string> list;
3145:   
3146:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join aid in accessIdList on srsid.Access.Id equals aid select srsid.Id).ToList();
3147:   
3148:              return list.Distinct().ToList();
3149:          }
3150:   
3151:          ////////////////////////////////////////////////////////////////////////////   
3152:   
3153:          /// <summary>
3154:          /// 
3155:          /// </summary>
3156:          public static List<string> NddOntIdListFromEmsOntSipInfoListAndEmsVoipPstnUserListByServiceList(List<string> serviceList)
3157:          {
3158:              string sipUserName, serviceWithCountryCode;
3159:              List<string> list, emsOntSipInfoSipUserNameList, emsVoipPstnUserDnList, emsOntSipInfoEmsOntIdList, emsVoipPstnUserEmsOntIdList;
3160:   
3161:              emsOntSipInfoSipUserNameList = new List<string>();
3162:              emsVoipPstnUserDnList = new List<string>();
3163:   
3164:              foreach (var service in serviceList)
3165:              {
3166:                  sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
3167:                  emsOntSipInfoSipUserNameList.Add(sipUserName);
3168:   
3169:                  serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
3170:                  emsVoipPstnUserDnList.Add(serviceWithCountryCode);
3171:              }
3172:   
3173:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3174:              {
3175:                  emsOntSipInfoEmsOntIdList = (from eosi in db.EmsOntSipInfos
3176:                                               join eo in db.EmsOnts on eosi.EmsOnt.Id equals eo.Id
3177:                                               join eosisun in emsOntSipInfoSipUserNameList on eosi.SIPUSERNAME equals eosisun
3178:                                               select eo.Id).Distinct().ToList();
3179:   
3180:                  emsVoipPstnUserEmsOntIdList = (from evpu in db.EmsVoipPstnUsers
3181:                                                 join eo in db.EmsOnts on evpu.EmsOnt.Id equals eo.Id
3182:                                                 join evpud in emsVoipPstnUserDnList on evpu.DN equals evpud
3183:                                                 select eo.Id).Distinct().ToList();
3184:   
3185:                  list = emsOntSipInfoEmsOntIdList.Concat(emsVoipPstnUserEmsOntIdList).ToList();
3186:              }
3187:   
3188:              return list.Distinct().ToList();
3189:          }
3190:   
3191:          ////////////////////////////////////////////////////////////////////////////
3192:   
3193:          /// <summary>
3194:          /// 
3195:          /// </summary>
3196:          public static List<string> OntServiceVoipIpList(List<string> ontServiceVoipIdList)
3197:          {
3198:              List<string> list;
3199:   
3200:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3201:              {
3202:                  if (ontServiceVoipIdList.Count <= 32)
3203:                  {
3204:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList on osv.Id equals osvid select osv.Ip).ToList();
3205:                  }
3206:                  else
3207:                  {
3208:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList.GetRange(0, 32) on osv.Id equals osvid select osv.Ip).ToList();
3209:                      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();
3210:                  }
3211:              }
3212:   
3213:              return list.Distinct().ToList();
3214:          }
3215:   
3216:          ////////////////////////////////////////////////////////////////////////////
3217:   
3218:          /// <summary>
3219:          /// 
3220:          /// </summary>
3221:          public static List<string> NddPonIpList(int oltId, int ponNumber)
3222:          {
3223:              List<string> list;
3224:   
3225:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where srsid.Pon.PonGroup.Olt.Id == oltId && srsid.Pon.Number == ponNumber select srsid.Ip).ToList();
3226:   
3227:              return list.Distinct().ToList();
3228:          }
3229:   
3230:          ////////////////////////////////////////////////////////////////////////////
3231:   
3232:          /// <summary>
3233:          /// 
3234:          /// </summary>
3235:          public static List<string> OntIdListFromNddOntIdList(List<string> nddOntIdList)
3236:          {
3237:              List<string> list;
3238:   
3239:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3240:              {
3241:                  list = (from o in db.Onts join nid in nddOntIdList on o.Id equals nid select o.Id).ToList();
3242:              }
3243:   
3244:              return list.Distinct().ToList();
3245:          }
3246:   
3247:          ////////////////////////////////////////////////////////////////////////////
3248:   
3249:          /// <summary>
3250:          /// 
3251:          /// </summary>
3252:          public static List<string> OntOntPotsIdListFromOntIdList(List<string> ontIdList)
3253:          {
3254:              List<string> list;
3255:   
3256:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3257:              {
3258:                  list = (from oop in db.OntOntPotses join oid in ontIdList on oop.Ont.Id equals oid select oop.Id).ToList();
3259:              }
3260:   
3261:              return list.Distinct().ToList();
3262:          }
3263:   
3264:          ////////////////////////////////////////////////////////////////////////////
3265:   
3266:          /// <summary>
3267:          /// 
3268:          /// </summary>
3269:          public static List<string> OntServiceVoipsIdListFromOntIdList(List<string> ontIdList)
3270:          {
3271:              List<string> list;
3272:   
3273:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3274:              {
3275:                  list = (from ov in db.OntServiceVoips join oid in ontIdList on ov.Ont.Id equals oid select ov.Id).ToList();
3276:              }
3277:   
3278:              return list.Distinct().ToList();
3279:          }
3280:   
3281:          ////////////////////////////////////////////////////////////////////////////
3282:   
3283:          /// <summary>
3284:          /// 
3285:          /// </summary>
3286:          public static List<string> OntServiceVoipsIdListFromIpList(List<string> ipList)
3287:          {
3288:              List<string> list;
3289:   
3290:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3291:              {
3292:                  list = (from ov in db.OntServiceVoips join npi in ipList on ov.Ip equals npi select ov.Id).ToList();
3293:              }
3294:   
3295:              return list.Distinct().ToList();
3296:          }
3297:   
3298:          ////////////////////////////////////////////////////////////////////////////
3299:   
3300:          /// <summary>
3301:          /// 
3302:          /// </summary>
3303:          public static List<long> EventIdListFromOntIdList(List<string> ontIdList)
3304:          {
3305:              List<long> list;
3306:   
3307:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3308:              {
3309:                  list = (from e in db.Events join oid in ontIdList on e.Ont.Id equals oid where e.Ont != null select e.Id).ToList();
3310:              }
3311:   
3312:              return list.Distinct().ToList();
3313:          }
3314:   
3315:          ////////////////////////////////////////////////////////////////////////////
3316:   
3317:          /// <summary>
3318:          /// 
3319:          /// </summary>
3320:          public static List<int> AgcfGatewayRecordIdListFromIpList(List<string> ipList)
3321:          {
3322:              List<int> list;
3323:   
3324:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3325:              {
3326:                  if (ipList.Count <= 32)
3327:                  {
3328:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList on gr.IP1 equals ip select gr.Id).ToList();
3329:                  }
3330:                  else
3331:                  {
3332:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
3333:                      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();
3334:                  }
3335:              }
3336:   
3337:              return list.Distinct().ToList();
3338:          }
3339:   
3340:          ////////////////////////////////////////////////////////////////////////////
3341:   
3342:          /// <summary>
3343:          /// 
3344:          /// </summary>
3345:          public static List<int> AgcfGatewayRecordIdListFromNddOntIdList(List<string> nddOntIdlist)
3346:          {
3347:              List<int> list;
3348:              List<string> nddIpList;
3349:   
3350:              nddIpList = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdlist on srsid.Id equals nid select srsid.Ip).ToList();
3351:   
3352:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3353:              {
3354:                  if (nddOntIdlist.Count <= 32)
3355:                  {
3356:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList on gr.IP1 equals ip select gr.Id).ToList();
3357:                  }
3358:                  else
3359:                  {
3360:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
3361:                      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();
3362:                  }
3363:              }
3364:   
3365:              return list.Distinct().ToList();
3366:          }
3367:   
3368:          ////////////////////////////////////////////////////////////////////////////
3369:   
3370:          /// <summary>
3371:          /// 
3372:          /// </summary>
3373:          public static List<int> AgcfGatewayRecordIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
3374:          {
3375:              List<int> list;
3376:   
3377:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3378:              {
3379:                  if (agcfEndpointIdList.Count <= 32)
3380:                  {
3381:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
3382:                  }
3383:                  else
3384:                  {
3385:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList.GetRange(0, 32) on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
3386:                      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();
3387:                  }
3388:              }
3389:   
3390:              return list.Distinct().ToList();
3391:          }
3392:   
3393:          ////////////////////////////////////////////////////////////////////////////
3394:   
3395:          /// <summary>
3396:          /// 
3397:          /// </summary>
3398:          public static List<string> AgcfEndpointIdListFromAgcfGatewayRecordIdList(List<int> agcfGatewayRecordIdList)
3399:          {
3400:              List<string> list;
3401:   
3402:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3403:              {
3404:                  list = (from e in db.AgcfEndpoints join grid in agcfGatewayRecordIdList on e.AgcfGatewayRecord.Id equals grid where e.AgcfGatewayRecord != null select e.Id).ToList();
3405:              }
3406:   
3407:              return list.Distinct().ToList();
3408:          }
3409:   
3410:          ////////////////////////////////////////////////////////////////////////////
3411:   
3412:          /// <summary>
3413:          /// 
3414:          /// </summary>
3415:          public static List<string> AgcfEndpointIdListFromSubPartyIdList(List<string> subPartyIdList)
3416:          {
3417:              List<string> list;
3418:   
3419:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3420:              {
3421:                  list = (from sp in db.SubParties join spid in subPartyIdList on sp.Id equals spid select sp.AgcfEndpoint.Id).ToList();
3422:              }
3423:   
3424:              return list.Distinct().ToList();
3425:          }
3426:   
3427:          ////////////////////////////////////////////////////////////////////////////
3428:   
3429:          /// <summary>
3430:          /// 
3431:          /// </summary>
3432:          public static List<string> AgcfEndpointIdListFromPrividUserList(List<string> prividUserList)
3433:          {
3434:              List<string> list;
3435:   
3436:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3437:              {
3438:                  list = (from ep in db.AgcfEndpoints join pu in prividUserList on ep.PrividUser equals pu select ep.Id).ToList();
3439:              }
3440:   
3441:              return list.Distinct().ToList();
3442:          }
3443:   
3444:          ////////////////////////////////////////////////////////////////////////////
3445:   
3446:          /// <summary>
3447:          /// 
3448:          /// </summary>
3449:          public static List<string> SubPartyIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
3450:          {
3451:              List<string> list;
3452:   
3453:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3454:              {
3455:                  if (agcfEndpointIdList.Count <= 32)
3456:                  {
3457:                      list = (from sp in db.SubParties join e in agcfEndpointIdList on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
3458:                  }
3459:                  else if (agcfEndpointIdList.Count <= 64)
3460:                  {
3461:                      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();
3462:                      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();
3463:                  }
3464:                  else if (agcfEndpointIdList.Count <= 96)
3465:                  {
3466:                      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();
3467:                      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();
3468:                      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();
3469:                  }
3470:                  else //if (agcfEndpointIdList.Count <= 128)
3471:                  {
3472:                      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();
3473:                      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();
3474:                      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();
3475:                      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();
3476:                  }
3477:              }
3478:   
3479:              return list.Distinct().ToList();
3480:          }
3481:   
3482:          ////////////////////////////////////////////////////////////////////////////
3483:   
3484:          /// <summary>
3485:          /// 
3486:          /// </summary>
3487:          public static List<string> SubPartyIdListFromPartyIdList(List<string> partyIdList)
3488:          {
3489:              List<string> list;
3490:   
3491:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3492:              {
3493:                  if (partyIdList.Count <= 32)
3494:                  {
3495:                      list = (from sp in db.SubParties join pid in partyIdList on sp.PartyId equals pid select sp.Id).ToList();
3496:                  }
3497:                  else if (partyIdList.Count <= 64)
3498:                  {
3499:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
3500:                      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();
3501:                  }
3502:                  else if (partyIdList.Count <= 96)
3503:                  {
3504:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
3505:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
3506:                      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();
3507:                  }
3508:                  else //if (agcfEndpointIdList.Count <= 128)
3509:                  {
3510:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
3511:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
3512:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(64, 32) on sp.PartyId equals pid select sp.Id).ToList();
3513:                      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();
3514:                  }
3515:              }
3516:   
3517:              return list.Distinct().ToList();
3518:          }
3519:   
3520:          ////////////////////////////////////////////////////////////////////////////
3521:   
3522:          /// <summary>
3523:          /// 
3524:          /// </summary>
3525:          public static List<string> SubscriberIdListFromSubPartyIdList(List<string> subPartyIdList)
3526:          {
3527:              List<string> list;
3528:   
3529:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3530:              {
3531:                  if (subPartyIdList.Count <= 32)
3532:                  {
3533:                      list = (from s in db.Subscribers join spid in subPartyIdList on s.SubParty.Id equals spid select s.Id).ToList();
3534:                  }
3535:                  else if (subPartyIdList.Count <= 64)
3536:                  {
3537:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
3538:                      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();
3539:                  }
3540:                  else if (subPartyIdList.Count <= 96)
3541:                  {
3542:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
3543:                      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();
3544:                      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();
3545:                  }
3546:                  else //if (subPartyIdList.Count <= 128)
3547:                  {
3548:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
3549:                      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();
3550:                      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();
3551:                      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();
3552:                  }
3553:              }
3554:   
3555:              return list.Distinct().ToList();
3556:          }
3557:   
3558:          ////////////////////////////////////////////////////////////////////////////
3559:   
3560:          /// <summary>
3561:          /// 
3562:          /// </summary>
3563:          public static List<string> SubscriberIdListFromPartyIdList(List<string> partyIdList)
3564:          {
3565:              List<string> list;
3566:   
3567:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3568:              {
3569:                  if (partyIdList.Count <= 32)
3570:                  {
3571:                      list = (from s in db.Subscribers join pid in partyIdList on s.PartyId equals pid select s.Id).ToList();
3572:                  }
3573:                  else if (partyIdList.Count <= 64)
3574:                  {
3575:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3576:                      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();
3577:                  }
3578:                  else if (partyIdList.Count <= 96)
3579:                  {
3580:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3581:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
3582:                      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();
3583:                  }
3584:                  else //if (subPartyIdList.Count <= 128)
3585:                  {
3586:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
3587:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
3588:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(64, 32) on s.PartyId equals pid select s.Id).ToList();
3589:                      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();
3590:                  }
3591:              }
3592:   
3593:              return list.Distinct().ToList();
3594:          }
3595:   
3596:          ////////////////////////////////////////////////////////////////////////////
3597:          ////////////////////////////////////////////////////////////////////////////   
3598:   
3599:          /// <summary>
3600:          /// 
3601:          /// </summary>
3602:          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)
3603:          {
3604:              int number;
3605:              long numberWithCountryCode;
3606:              string service, impuSipDomain, partyId, prividUser;
3607:   
3608:              foreach (var pi in partyIdList)
3609:              {
3610:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(pi);
3611:   
3612:                  if (!string.IsNullOrEmpty(service))
3613:                  {
3614:                      number = int.Parse(service);
3615:                      numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3616:                      impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3617:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3618:                      prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
3619:   
3620:                      serviceList.Add(service);
3621:                      numberList.Add(number);
3622:                      serviceLongList.Add(numberWithCountryCode);
3623:                      impuSipDomainList.Add(impuSipDomain);
3624:                      //partyIdList.Add(partyId);
3625:                      prividUserList.Add(prividUser);
3626:                  }
3627:              }
3628:   
3629:              foreach (var s in serviceList)
3630:              {
3631:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s);
3632:   
3633:                  if (!string.IsNullOrEmpty(service))
3634:                  {
3635:                      number = int.Parse(service);
3636:                      numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
3637:                      impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
3638:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
3639:                      prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
3640:   
3641:                      //serviceList.Add(service);
3642:                      numberList.Add(number);
3643:                      serviceLongList.Add(numberWithCountryCode);
3644:                      impuSipDomainList.Add(impuSipDomain);
3645:                      partyIdList.Add(partyId);
3646:                      prividUserList.Add(prividUser);
3647:                  }
3648:              }
3649:   
3650:              serviceList = serviceList.Distinct().ToList();
3651:              numberList = numberList.Distinct().ToList();
3652:              serviceLongList = serviceLongList.Distinct().ToList();
3653:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
3654:              partyIdList = partyIdList.Distinct().ToList();
3655:              prividUserList = prividUserList.Distinct().ToList();
3656:          }
3657:   
3658:          ////////////////////////////////////////////////////////////////////////////   
3659:   
3660:          /// <summary>
3661:          /// 
3662:          /// </summary>
3663:          public static void CollectServiceListFromServiceRequestServiceIdOrService2IdList(List<string> serviceRequestServiceIdListOrService2IdList, ref List<string> serviceList)
3664:          {
3665:              string service;
3666:   
3667:              foreach (var si in serviceRequestServiceIdListOrService2IdList)
3668:              {
3669:                  service = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceIdToService(si);
3670:                  serviceList.Add(service);
3671:              }
3672:   
3673:              serviceList = serviceList.Distinct().ToList();
3674:          }
3675:   
3676:          ////////////////////////////////////////////////////////////////////////////   
3677:   
3678:          /// <summary>
3679:          /// 
3680:          /// </summary>
3681:          public static void CollectServiceListFromEmsOntSipInfoListAndEmsVoipPstnUserListByEmsOntIdList(List<string> emsOntIdList, ref List<string> serviceList)
3682:          {
3683:              string service;
3684:              List<string> EmsOntSipInfoSipUserNameList, EmsVoipPstnUserDnList;
3685:   
3686:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3687:              {
3688:                  EmsOntSipInfoSipUserNameList = (from eosi in db.EmsOntSipInfos join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid select eosi.SIPUSERNAME).Distinct().ToList();
3689:   
3690:                  EmsVoipPstnUserDnList = (from evpu in db.EmsVoipPstnUsers join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid select evpu.DN).Distinct().ToList();
3691:              }
3692:   
3693:              foreach (var eosisun in EmsOntSipInfoSipUserNameList)
3694:              {
3695:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(eosisun);
3696:                  serviceList.Add(service);
3697:              }
3698:   
3699:              foreach (var evpud in EmsVoipPstnUserDnList)
3700:              {
3701:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(evpud);
3702:                  serviceList.Add(service);
3703:              }
3704:   
3705:              serviceList = serviceList.Distinct().ToList();
3706:          }
3707:   
3708:          ////////////////////////////////////////////////////////////////////////////   
3709:   
3710:          /// <summary>
3711:          /// 
3712:          /// </summary>
3713:          public static void CollectServiceListFromAgcfEndpointList(List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList, ref List<string> serviceList)
3714:          {
3715:              string service;
3716:   
3717:              foreach (var ep in agcfEndpointList)
3718:              {
3719:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(ep.PrividUser);
3720:                  serviceList.Add(service);
3721:              }
3722:   
3723:              serviceList = serviceList.Distinct().ToList();
3724:          }
3725:   
3726:          ////////////////////////////////////////////////////////////////////////////   
3727:   
3728:          /// <summary>
3729:          /// 
3730:          /// </summary>
3731:          public static void CollectServiceListFromSubscriberList(List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList, ref List<string> serviceList)
3732:          {
3733:              string service;
3734:   
3735:              foreach (var s in subscriberList)
3736:              {
3737:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s.PartyId);
3738:                  serviceList.Add(service);
3739:              }
3740:   
3741:              serviceList = serviceList.Distinct().ToList();
3742:          }
3743:   
3744:          ////////////////////////////////////////////////////////////////////////////
3745:          ////////////////////////////////////////////////////////////////////////////   
3746:      }
3747:   
3748:      ////////////////////////////////////////////////////////////////////////////
3749:      ////////////////////////////////////////////////////////////////////////////   
3750:  }