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

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