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

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-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      public class Find
  28:      {
  29:          ////////////////////////////////////////////////////////////////////////////
  30:   
  31:          /// <summary>
  32:          ///
  33:          /// </summary>
  34:          public Find() { }
  35:   
  36:          ////////////////////////////////////////////////////////////////////////////
  37:   
  38:          /// <summary>
  39:          /// 
  40:          /// </summary>
  41:          public static List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> ServiceRequestServiceList(List<string> serviceRequestServiceIdList)
  42:          {
  43:              List<Ia.Ngn.Cl.Model.ServiceRequestService> inList;
  44:              List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> list;
  45:   
  46:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  47:              {
  48:                  if (serviceRequestServiceIdList.Count == 1)
  49:                  {
  50:                      var serviceRequestServiceId = serviceRequestServiceIdList[0];
  51:                      inList = (from srs in db.ServiceRequestServices where srs.Id == serviceRequestServiceId select srs).ToList();
  52:                  }
  53:                  else if (serviceRequestServiceIdList.Count <= 32)
  54:                  {
  55:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList on srs.Id equals srsid select srs).ToList();
  56:                  }
  57:                  else if (serviceRequestServiceIdList.Count <= 64)
  58:                  {
  59:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  60:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, serviceRequestServiceIdList.Count - 32 - 1) on srs.Id equals srsid select srs).ToList();
  61:                  }
  62:                  else if (serviceRequestServiceIdList.Count <= 96)
  63:                  {
  64:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  65:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  66:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, serviceRequestServiceIdList.Count - 64 - 1) on srs.Id equals srsid select srs).ToList();
  67:                  }
  68:                  else if (serviceRequestServiceIdList.Count <= 128)
  69:                  {
  70:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  71:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  72:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  73:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, serviceRequestServiceIdList.Count - 96 - 1) on srs.Id equals srsid select srs).ToList();
  74:                  }
  75:                  else if (serviceRequestServiceIdList.Count <= 160)
  76:                  {
  77:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  78:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  79:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  80:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  81:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, serviceRequestServiceIdList.Count - 128 - 1) on srs.Id equals srsid select srs).ToList();
  82:                  }
  83:                  else if (serviceRequestServiceIdList.Count <= 192)
  84:                  {
  85:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  86:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  87:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  88:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  89:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
  90:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, serviceRequestServiceIdList.Count - 160 - 1) on srs.Id equals srsid select srs).ToList();
  91:                  }
  92:                  else if (serviceRequestServiceIdList.Count <= 224)
  93:                  {
  94:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
  95:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
  96:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
  97:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
  98:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
  99:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, 32) on srs.Id equals srsid select srs).ToList();
 100:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(192, serviceRequestServiceIdList.Count - 192 - 1) on srs.Id equals srsid select srs).ToList();
 101:                  }
 102:                  else //if (serviceRequestServiceIdList.Count <= 256)
 103:                  {
 104:                      inList = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(0, 32) on srs.Id equals srsid select srs).ToList();
 105:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(32, 32) on srs.Id equals srsid select srs).ToList();
 106:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(64, 32) on srs.Id equals srsid select srs).ToList();
 107:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(96, 32) on srs.Id equals srsid select srs).ToList();
 108:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(128, 32) on srs.Id equals srsid select srs).ToList();
 109:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(160, 32) on srs.Id equals srsid select srs).ToList();
 110:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(192, 32) on srs.Id equals srsid select srs).ToList();
 111:                      inList = inList.Union(from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList.GetRange(224, serviceRequestServiceIdList.Count - 224 - 1) on srs.Id equals srsid select srs).ToList();
 112:                  }
 113:   
 114:                  list = (from srs in inList
 115:                          select new Ia.Ngn.Cl.Model.Ui.ServiceRequestService()
 116:                          {
 117:                              Id = srs.Id,
 118:                              AbbriviatedCalling = srs.AbbriviatedCalling,
 119:                              Access = srs.Access,
 120:                              AlarmCall = srs.AlarmCall,
 121:                              CallBarring = srs.CallBarring,
 122:                              CallerId = srs.CallerId,
 123:                              CallForwarding = srs.CallForwarding,
 124:                              CallWaiting = srs.CallWaiting,
 125:                              ConferenceCall = srs.ConferenceCall,
 126:                              Created = srs.Created,
 127:                              InternationalCalling = srs.InternationalCalling,
 128:                              InternationalCallingUserControlled = srs.InternationalCallingUserControlled,
 129:                              LastRequestDateTime = srs.LastRequestDateTime,
 130:                              Provisioned = srs.Provisioned,
 131:                              Service = srs.Service,
 132:                              Serial = srs.Serial,
 133:                              ServiceType = srs.ServiceType,
 134:                              ServiceSuspension = srs.ServiceSuspension,
 135:                              Type = srs.Type,
 136:                              Updated = srs.Updated
 137:                          }).ToList();
 138:   
 139:                  return list.Distinct().ToList();
 140:              }
 141:          }
 142:   
 143:          ////////////////////////////////////////////////////////////////////////////
 144:   
 145:          /// <summary>
 146:          /// 
 147:          /// </summary>
 148:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestList(List<int> serviceRequestIdList)
 149:          {
 150:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 151:   
 152:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 153:              {
 154:                  if (serviceRequestIdList.Count == 1)
 155:                  {
 156:                      var serviceRequestId = serviceRequestIdList[0];
 157:                      list = (from sr in db.ServiceRequests where sr.Id == serviceRequestId select sr).ToList();
 158:                  }
 159:                  else if (serviceRequestIdList.Count <= 32)
 160:                  {
 161:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList on sr.Id equals srid select sr).ToList();
 162:                  }
 163:                  else if (serviceRequestIdList.Count <= 64)
 164:                  {
 165:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 166:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, serviceRequestIdList.Count - 32 - 1) on sr.Id equals srid select sr).ToList();
 167:                  }
 168:                  else if (serviceRequestIdList.Count <= 96)
 169:                  {
 170:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 171:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 172:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, serviceRequestIdList.Count - 64 - 1) on sr.Id equals srid select sr).ToList();
 173:                  }
 174:                  else if (serviceRequestIdList.Count <= 128)
 175:                  {
 176:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 177:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 178:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 179:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, serviceRequestIdList.Count - 96 - 1) on sr.Id equals srid select sr).ToList();
 180:                  }
 181:                  else if (serviceRequestIdList.Count <= 160)
 182:                  {
 183:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 184:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 185:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 186:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 187:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, serviceRequestIdList.Count - 128 - 1) on sr.Id equals srid select sr).ToList();
 188:                  }
 189:                  else if (serviceRequestIdList.Count <= 192)
 190:                  {
 191:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 192:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 193:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 194:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 195:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 196:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, serviceRequestIdList.Count - 160 - 1) on sr.Id equals srid select sr).ToList();
 197:                  }
 198:                  else if (serviceRequestIdList.Count <= 224)
 199:                  {
 200:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 201:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 202:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 203:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 204:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 205:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 206:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, serviceRequestIdList.Count - 192 - 1) on sr.Id equals srid select sr).ToList();
 207:                  }
 208:                  else if (serviceRequestIdList.Count <= 256)
 209:                  {
 210:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 211:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 212:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 213:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 214:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 215:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 216:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 217:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, serviceRequestIdList.Count - 224 - 1) on sr.Id equals srid select sr).ToList();
 218:                  }
 219:                  else if (serviceRequestIdList.Count <= 288)
 220:                  {
 221:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 222:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 223:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 224:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 225:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 226:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 227:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 228:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 229:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, serviceRequestIdList.Count - 256 - 1) on sr.Id equals srid select sr).ToList();
 230:                  }
 231:                  else if (serviceRequestIdList.Count <= 320)
 232:                  {
 233:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 234:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 235:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 236:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 237:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 238:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 239:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 240:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 241:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 242:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, serviceRequestIdList.Count - 288 - 1) on sr.Id equals srid select sr).ToList();
 243:                  }
 244:                  else if (serviceRequestIdList.Count <= 352)
 245:                  {
 246:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 247:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 248:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 249:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 250:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 251:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 252:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 253:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 254:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 255:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 256:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, serviceRequestIdList.Count - 320 - 1) on sr.Id equals srid select sr).ToList();
 257:                  }
 258:                  else if (serviceRequestIdList.Count <= 384)
 259:                  {
 260:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 261:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 262:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 263:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 264:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 265:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 266:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 267:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 268:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 269:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 270:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 271:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, serviceRequestIdList.Count - 352 - 1) on sr.Id equals srid select sr).ToList();
 272:                  }
 273:                  else if (serviceRequestIdList.Count <= 416)
 274:                  {
 275:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 276:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 277:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 278:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 279:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 280:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 281:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 282:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 283:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 284:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 285:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 286:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 287:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, serviceRequestIdList.Count - 384 - 1) on sr.Id equals srid select sr).ToList();
 288:                  }
 289:                  else if (serviceRequestIdList.Count <= 448)
 290:                  {
 291:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 292:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 293:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 294:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 295:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 296:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 297:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 298:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 299:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 300:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 301:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 302:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 303:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 304:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, serviceRequestIdList.Count - 416 - 1) on sr.Id equals srid select sr).ToList();
 305:                  }
 306:                  else if (serviceRequestIdList.Count <= 480)
 307:                  {
 308:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 309:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 310:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 311:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 312:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 313:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 314:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 315:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 316:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 317:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 318:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 319:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 320:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 321:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 322:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, serviceRequestIdList.Count - 448 - 1) on sr.Id equals srid select sr).ToList();
 323:                  }
 324:                  else if (serviceRequestIdList.Count <= 512)
 325:                  {
 326:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 327:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 328:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 329:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 330:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 331:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 332:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 333:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 334:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 335:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 336:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 337:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 338:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 339:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 340:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 341:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, serviceRequestIdList.Count - 480 - 1) on sr.Id equals srid select sr).ToList();
 342:                  }
 343:                  else if (serviceRequestIdList.Count <= 544)
 344:                  {
 345:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 346:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 347:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 348:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 349:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 350:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 351:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 352:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 353:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 354:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 355:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 356:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 357:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 358:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 359:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 360:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 361:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(512, serviceRequestIdList.Count - 512 - 1) on sr.Id equals srid select sr).ToList();
 362:                  }
 363:                  else //if (serviceIdList.Count <= ??)
 364:                  {
 365:                      list = (from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(0, 32) on sr.Id equals srid select sr).ToList();
 366:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(32, 32) on sr.Id equals srid select sr).ToList();
 367:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(64, 32) on sr.Id equals srid select sr).ToList();
 368:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(96, 32) on sr.Id equals srid select sr).ToList();
 369:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(128, 32) on sr.Id equals srid select sr).ToList();
 370:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(160, 32) on sr.Id equals srid select sr).ToList();
 371:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(192, 32) on sr.Id equals srid select sr).ToList();
 372:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(224, 32) on sr.Id equals srid select sr).ToList();
 373:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(256, 32) on sr.Id equals srid select sr).ToList();
 374:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(288, 32) on sr.Id equals srid select sr).ToList();
 375:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(320, 32) on sr.Id equals srid select sr).ToList();
 376:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(352, 32) on sr.Id equals srid select sr).ToList();
 377:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(384, 32) on sr.Id equals srid select sr).ToList();
 378:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(416, 32) on sr.Id equals srid select sr).ToList();
 379:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(448, 32) on sr.Id equals srid select sr).ToList();
 380:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(480, 32) on sr.Id equals srid select sr).ToList();
 381:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(512, 32) on sr.Id equals srid select sr).ToList();
 382:                      list = list.Union(from sr in db.ServiceRequests join srid in serviceRequestIdList.GetRange(544, serviceRequestIdList.Count - 544 - 1) on sr.Id equals srid select sr).ToList();
 383:                  }
 384:              }
 385:   
 386:              return list.Distinct().ToList();
 387:          }
 388:   
 389:          ////////////////////////////////////////////////////////////////////////////
 390:   
 391:          /// <summary>
 392:          /// 
 393:          /// </summary>
 394:          public static List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> ServiceRequestAdministrativeIssueList(List<string> serviceRequestAdministrativeIssueIdList)
 395:          {
 396:              List<Ia.Ngn.Cl.Model.ServiceRequestAdministrativeIssue> list;
 397:   
 398:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 399:              {
 400:                  if (serviceRequestAdministrativeIssueIdList.Count == 1)
 401:                  {
 402:                      var serviceRequestAdministrativeIssueId = serviceRequestAdministrativeIssueIdList[0];
 403:                      list = (from srai in db.ServiceRequestAdministrativeIssues where srai.Id == serviceRequestAdministrativeIssueId select srai).ToList();
 404:                  }
 405:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 32)
 406:                  {
 407:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList on srai.Id equals sraiid select srai).ToList();
 408:                  }
 409:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 64)
 410:                  {
 411:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 412:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, serviceRequestAdministrativeIssueIdList.Count - 32 - 1) on srai.Id equals sraiid select srai).ToList();
 413:                  }
 414:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 96)
 415:                  {
 416:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 417:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 418:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, serviceRequestAdministrativeIssueIdList.Count - 64 - 1) on srai.Id equals sraiid select srai).ToList();
 419:                  }
 420:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 128)
 421:                  {
 422:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 423:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 424:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 425:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, serviceRequestAdministrativeIssueIdList.Count - 96 - 1) on srai.Id equals sraiid select srai).ToList();
 426:                  }
 427:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 160)
 428:                  {
 429:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 430:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 431:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 432:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 433:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, serviceRequestAdministrativeIssueIdList.Count - 128 - 1) on srai.Id equals sraiid select srai).ToList();
 434:                  }
 435:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 192)
 436:                  {
 437:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 438:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 439:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 440:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 441:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 442:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, serviceRequestAdministrativeIssueIdList.Count - 160 - 1) on srai.Id equals sraiid select srai).ToList();
 443:                  }
 444:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 224)
 445:                  {
 446:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 447:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 448:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 449:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 450:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 451:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 452:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, serviceRequestAdministrativeIssueIdList.Count - 192 - 1) on srai.Id equals sraiid select srai).ToList();
 453:                  }
 454:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 256)
 455:                  {
 456:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 457:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 458:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 459:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 460:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 461:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 462:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 463:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, serviceRequestAdministrativeIssueIdList.Count - 224 - 1) on srai.Id equals sraiid select srai).ToList();
 464:                  }
 465:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 288)
 466:                  {
 467:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 468:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 469:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 470:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 471:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 472:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 473:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 474:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 475:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, serviceRequestAdministrativeIssueIdList.Count - 256 - 1) on srai.Id equals sraiid select srai).ToList();
 476:                  }
 477:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 320)
 478:                  {
 479:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 480:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 481:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 482:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 483:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 484:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 485:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 486:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 487:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 488:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, serviceRequestAdministrativeIssueIdList.Count - 288 - 1) on srai.Id equals sraiid select srai).ToList();
 489:                  }
 490:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 352)
 491:                  {
 492:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 493:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 494:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 495:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 496:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 497:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 498:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 499:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 500:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 501:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 502:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, serviceRequestAdministrativeIssueIdList.Count - 320 - 1) on srai.Id equals sraiid select srai).ToList();
 503:                  }
 504:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 384)
 505:                  {
 506:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 507:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 508:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 509:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 510:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 511:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 512:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 513:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 514:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 515:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 516:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 517:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, serviceRequestAdministrativeIssueIdList.Count - 352 - 1) on srai.Id equals sraiid select srai).ToList();
 518:                  }
 519:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 416)
 520:                  {
 521:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 522:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 523:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 524:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 525:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 526:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 527:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 528:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 529:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 530:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 531:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 532:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 533:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, serviceRequestAdministrativeIssueIdList.Count - 384 - 1) on srai.Id equals sraiid select srai).ToList();
 534:                  }
 535:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 448)
 536:                  {
 537:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 538:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 539:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 540:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 541:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 542:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 543:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 544:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 545:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 546:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 547:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 548:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 549:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 550:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, serviceRequestAdministrativeIssueIdList.Count - 416 - 1) on srai.Id equals sraiid select srai).ToList();
 551:                  }
 552:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 480)
 553:                  {
 554:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 555:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 556:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 557:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 558:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 559:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 560:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 561:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 562:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 563:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 564:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 565:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 566:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 567:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 568:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, serviceRequestAdministrativeIssueIdList.Count - 448 - 1) on srai.Id equals sraiid select srai).ToList();
 569:                  }
 570:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 512)
 571:                  {
 572:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 573:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 574:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 575:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 576:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 577:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 578:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 579:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 580:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 581:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 582:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 583:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 584:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 585:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 586:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, 32) on srai.Id equals sraiid select srai).ToList();
 587:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(480, serviceRequestAdministrativeIssueIdList.Count - 480 - 1) on srai.Id equals sraiid select srai).ToList();
 588:                  }
 589:                  else if (serviceRequestAdministrativeIssueIdList.Count <= 544)
 590:                  {
 591:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 592:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 593:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 594:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 595:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 596:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 597:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 598:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 599:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 600:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 601:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 602:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 603:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 604:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 605:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, 32) on srai.Id equals sraiid select srai).ToList();
 606:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(480, 32) on srai.Id equals sraiid select srai).ToList();
 607:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(512, serviceRequestAdministrativeIssueIdList.Count - 512 - 1) on srai.Id equals sraiid select srai).ToList();
 608:                  }
 609:                  else //if (serviceIdList.Count <= ??)
 610:                  {
 611:                      list = (from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(0, 32) on srai.Id equals sraiid select srai).ToList();
 612:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(32, 32) on srai.Id equals sraiid select srai).ToList();
 613:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(64, 32) on srai.Id equals sraiid select srai).ToList();
 614:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(96, 32) on srai.Id equals sraiid select srai).ToList();
 615:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(128, 32) on srai.Id equals sraiid select srai).ToList();
 616:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(160, 32) on srai.Id equals sraiid select srai).ToList();
 617:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(192, 32) on srai.Id equals sraiid select srai).ToList();
 618:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(224, 32) on srai.Id equals sraiid select srai).ToList();
 619:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(256, 32) on srai.Id equals sraiid select srai).ToList();
 620:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(288, 32) on srai.Id equals sraiid select srai).ToList();
 621:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(320, 32) on srai.Id equals sraiid select srai).ToList();
 622:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(352, 32) on srai.Id equals sraiid select srai).ToList();
 623:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(384, 32) on srai.Id equals sraiid select srai).ToList();
 624:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(416, 32) on srai.Id equals sraiid select srai).ToList();
 625:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(448, 32) on srai.Id equals sraiid select srai).ToList();
 626:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(480, 32) on srai.Id equals sraiid select srai).ToList();
 627:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(512, 32) on srai.Id equals sraiid select srai).ToList();
 628:                      list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sraiid in serviceRequestAdministrativeIssueIdList.GetRange(544, serviceRequestAdministrativeIssueIdList.Count - 544 - 1) on srai.Id equals sraiid select srai).ToList();
 629:                  }
 630:              }
 631:   
 632:              return list.Distinct().ToList();
 633:          }
 634:   
 635:          ////////////////////////////////////////////////////////////////////////////
 636:   
 637:          /// <summary>
 638:          /// 
 639:          /// </summary>
 640:          public static List<Ia.Ngn.Cl.Model.ServiceRequestHistory> ServiceRequestHistoryList(List<string> serviceRequestHistoryIdList)
 641:          {
 642:              List<Ia.Ngn.Cl.Model.ServiceRequestHistory> list;
 643:   
 644:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 645:              {
 646:                  if (serviceRequestHistoryIdList.Count == 1)
 647:                  {
 648:                      var serviceRequestHistoryId = serviceRequestHistoryIdList[0];
 649:                      list = (from srh in db.ServiceRequestHistories where srh.Id == serviceRequestHistoryId select srh).ToList();
 650:                  }
 651:                  else if (serviceRequestHistoryIdList.Count <= 32)
 652:                  {
 653:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList on srh.Id equals srhid select srh).ToList();
 654:                  }
 655:                  else if (serviceRequestHistoryIdList.Count <= 64)
 656:                  {
 657:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 658:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, serviceRequestHistoryIdList.Count - 32 - 1) on srh.Id equals srhid select srh).ToList();
 659:                  }
 660:                  else if (serviceRequestHistoryIdList.Count <= 96)
 661:                  {
 662:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 663:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 664:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, serviceRequestHistoryIdList.Count - 64 - 1) on srh.Id equals srhid select srh).ToList();
 665:                  }
 666:                  else if (serviceRequestHistoryIdList.Count <= 128)
 667:                  {
 668:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 669:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 670:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 671:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, serviceRequestHistoryIdList.Count - 96 - 1) on srh.Id equals srhid select srh).ToList();
 672:                  }
 673:                  else if (serviceRequestHistoryIdList.Count <= 160)
 674:                  {
 675:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 676:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 677:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 678:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 679:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, serviceRequestHistoryIdList.Count - 128 - 1) on srh.Id equals srhid select srh).ToList();
 680:                  }
 681:                  else if (serviceRequestHistoryIdList.Count <= 192)
 682:                  {
 683:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 684:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 685:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 686:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 687:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 688:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, serviceRequestHistoryIdList.Count - 160 - 1) on srh.Id equals srhid select srh).ToList();
 689:                  }
 690:                  else if (serviceRequestHistoryIdList.Count <= 224)
 691:                  {
 692:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 693:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 694:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 695:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 696:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 697:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 698:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, serviceRequestHistoryIdList.Count - 192 - 1) on srh.Id equals srhid select srh).ToList();
 699:                  }
 700:                  else if (serviceRequestHistoryIdList.Count <= 256)
 701:                  {
 702:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 703:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 704:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 705:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 706:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 707:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 708:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 709:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, serviceRequestHistoryIdList.Count - 224 - 1) on srh.Id equals srhid select srh).ToList();
 710:                  }
 711:                  else if (serviceRequestHistoryIdList.Count <= 288)
 712:                  {
 713:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 714:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 715:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 716:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 717:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 718:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 719:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 720:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 721:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, serviceRequestHistoryIdList.Count - 256 - 1) on srh.Id equals srhid select srh).ToList();
 722:                  }
 723:                  else if (serviceRequestHistoryIdList.Count <= 320)
 724:                  {
 725:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 726:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 727:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 728:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 729:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 730:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 731:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 732:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 733:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 734:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, serviceRequestHistoryIdList.Count - 288 - 1) on srh.Id equals srhid select srh).ToList();
 735:                  }
 736:                  else if (serviceRequestHistoryIdList.Count <= 352)
 737:                  {
 738:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 739:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 740:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 741:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 742:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 743:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 744:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 745:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 746:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 747:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 748:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, serviceRequestHistoryIdList.Count - 320 - 1) on srh.Id equals srhid select srh).ToList();
 749:                  }
 750:                  else if (serviceRequestHistoryIdList.Count <= 384)
 751:                  {
 752:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 753:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 754:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 755:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 756:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 757:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 758:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 759:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 760:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 761:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 762:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 763:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, serviceRequestHistoryIdList.Count - 352 - 1) on srh.Id equals srhid select srh).ToList();
 764:                  }
 765:                  else if (serviceRequestHistoryIdList.Count <= 416)
 766:                  {
 767:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 768:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 769:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 770:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 771:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 772:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 773:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 774:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 775:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 776:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 777:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 778:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 779:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, serviceRequestHistoryIdList.Count - 384 - 1) on srh.Id equals srhid select srh).ToList();
 780:                  }
 781:                  else if (serviceRequestHistoryIdList.Count <= 448)
 782:                  {
 783:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 784:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 785:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 786:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 787:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 788:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 789:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 790:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 791:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 792:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 793:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 794:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 795:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 796:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, serviceRequestHistoryIdList.Count - 416 - 1) on srh.Id equals srhid select srh).ToList();
 797:                  }
 798:                  else if (serviceRequestHistoryIdList.Count <= 480)
 799:                  {
 800:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 801:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 802:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 803:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 804:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 805:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 806:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 807:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 808:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 809:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 810:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 811:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 812:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 813:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 814:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, serviceRequestHistoryIdList.Count - 448 - 1) on srh.Id equals srhid select srh).ToList();
 815:                  }
 816:                  else if (serviceRequestHistoryIdList.Count <= 512)
 817:                  {
 818:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 819:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 820:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 821:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 822:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 823:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 824:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 825:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 826:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 827:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 828:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 829:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 830:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 831:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 832:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 833:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, serviceRequestHistoryIdList.Count - 480 - 1) on srh.Id equals srhid select srh).ToList();
 834:                  }
 835:                  else if (serviceRequestHistoryIdList.Count <= 544)
 836:                  {
 837:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 838:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 839:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 840:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 841:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 842:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 843:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 844:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 845:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 846:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 847:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 848:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 849:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 850:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 851:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 852:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, 32) on srh.Id equals srhid select srh).ToList();
 853:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(512, serviceRequestHistoryIdList.Count - 512 - 1) on srh.Id equals srhid select srh).ToList();
 854:                  }
 855:                  else //if (serviceIdList.Count <= ??)
 856:                  {
 857:                      list = (from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(0, 32) on srh.Id equals srhid select srh).ToList();
 858:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(32, 32) on srh.Id equals srhid select srh).ToList();
 859:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(64, 32) on srh.Id equals srhid select srh).ToList();
 860:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(96, 32) on srh.Id equals srhid select srh).ToList();
 861:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(128, 32) on srh.Id equals srhid select srh).ToList();
 862:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(160, 32) on srh.Id equals srhid select srh).ToList();
 863:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(192, 32) on srh.Id equals srhid select srh).ToList();
 864:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(224, 32) on srh.Id equals srhid select srh).ToList();
 865:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(256, 32) on srh.Id equals srhid select srh).ToList();
 866:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(288, 32) on srh.Id equals srhid select srh).ToList();
 867:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(320, 32) on srh.Id equals srhid select srh).ToList();
 868:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(352, 32) on srh.Id equals srhid select srh).ToList();
 869:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(384, 32) on srh.Id equals srhid select srh).ToList();
 870:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(416, 32) on srh.Id equals srhid select srh).ToList();
 871:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(448, 32) on srh.Id equals srhid select srh).ToList();
 872:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(480, 32) on srh.Id equals srhid select srh).ToList();
 873:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(512, 32) on srh.Id equals srhid select srh).ToList();
 874:                      list = list.Union(from srh in db.ServiceRequestHistories join srhid in serviceRequestHistoryIdList.GetRange(544, serviceRequestHistoryIdList.Count - 544 - 1) on srh.Id equals srhid select srh).ToList();
 875:                  }
 876:              }
 877:   
 878:              return list.Distinct().ToList();
 879:          }
 880:   
 881:          ////////////////////////////////////////////////////////////////////////////
 882:   
 883:          /// <summary>
 884:          /// 
 885:          /// </summary>
 886:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerId(int customerId, int maxNumberOfResults)
 887:          {
 888:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 889:   
 890:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 891:              {
 892:                  list = (from sr in db.ServiceRequests where sr.CustomerId == customerId select sr).Take(maxNumberOfResults).ToList();
 893:              }
 894:   
 895:              return list.Distinct().ToList();
 896:          }
 897:   
 898:          ////////////////////////////////////////////////////////////////////////////
 899:   
 900:          /// <summary>
 901:          /// 
 902:          /// </summary>
 903:          public static List<Ia.Ngn.Cl.Model.ServiceRequest> ServiceRequestListForCustomerName(string customerName, int maxNumberOfResults)
 904:          {
 905:              List<Ia.Ngn.Cl.Model.ServiceRequest> list;
 906:   
 907:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 908:              {
 909:                  list = (from sr in db.ServiceRequests where sr.CustomerName == customerName || sr.CustomerName.Contains(customerName) select sr).Take(maxNumberOfResults).ToList();
 910:              }
 911:   
 912:              return list.Distinct().ToList();
 913:          }
 914:   
 915:          ////////////////////////////////////////////////////////////////////////////
 916:   
 917:          /// <summary>
 918:          /// 
 919:          /// </summary>
 920:          public static List<Ia.Ngn.Cl.Model.ServiceRequestType> ServiceRequestTypeList(List<int> serviceRequestTypeIdList)
 921:          {
 922:              List<Ia.Ngn.Cl.Model.ServiceRequestType> list;
 923:   
 924:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 925:              {
 926:                  if (serviceRequestTypeIdList.Count == 1)
 927:                  {
 928:                      var serviceRequestTypeId = serviceRequestTypeIdList[0];
 929:                      list = (from srt in db.ServiceRequestTypes where srt.Id == serviceRequestTypeId select srt).ToList();
 930:                  }
 931:                  else if (serviceRequestTypeIdList.Count <= 32)
 932:                  {
 933:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList on srt.Id equals srtid select srt).ToList();
 934:                  }
 935:                  else if (serviceRequestTypeIdList.Count <= 64)
 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, serviceRequestTypeIdList.Count - 32 - 1) on srt.Id equals srtid select srt).ToList();
 939:                  }
 940:                  else if (serviceRequestTypeIdList.Count <= 96)
 941:                  {
 942:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 943:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 944:                      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();
 945:                  }
 946:                  else if (serviceRequestTypeIdList.Count <= 128)
 947:                  {
 948:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 949:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 950:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 951:                      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();
 952:                  }
 953:                  else if (serviceRequestTypeIdList.Count <= 160)
 954:                  {
 955:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 956:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 957:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 958:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 959:                      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();
 960:                  }
 961:                  else if (serviceRequestTypeIdList.Count <= 192)
 962:                  {
 963:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 964:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 965:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 966:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 967:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 968:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, serviceRequestTypeIdList.Count - 160 - 1) on srt.Id equals srtid select srt).ToList();
 969:                  }
 970:                  else if (serviceRequestTypeIdList.Count <= 224)
 971:                  {
 972:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 973:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 974:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 975:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 976:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 977:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 978:                      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();
 979:                  }
 980:                  else if (serviceRequestTypeIdList.Count <= 256)
 981:                  {
 982:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 983:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 984:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 985:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 986:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 987:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 988:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
 989:                      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();
 990:                  }
 991:                  else if (serviceRequestTypeIdList.Count <= 288)
 992:                  {
 993:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
 994:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
 995:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
 996:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
 997:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
 998:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
 999:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1000:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1001:                      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();
1002:                  }
1003:                  else if (serviceRequestTypeIdList.Count <= 320)
1004:                  {
1005:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1006:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1007:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1008:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1009:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1010:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1011:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1012:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1013:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1014:                      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();
1015:                  }
1016:                  else if (serviceRequestTypeIdList.Count <= 352)
1017:                  {
1018:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1019:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1020:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1021:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1022:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1023:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1024:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1025:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1026:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1027:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1028:                      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();
1029:                  }
1030:                  else if (serviceRequestTypeIdList.Count <= 384)
1031:                  {
1032:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1033:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1034:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1035:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1036:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1037:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1038:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1039:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1040:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1041:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1042:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1043:                      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();
1044:                  }
1045:                  else if (serviceRequestTypeIdList.Count <= 416)
1046:                  {
1047:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1048:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1049:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1050:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1051:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1052:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1053:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1054:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1055:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1056:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1057:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1058:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1059:                      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();
1060:                  }
1061:                  else if (serviceRequestTypeIdList.Count <= 448)
1062:                  {
1063:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1064:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1065:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1066:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1067:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1068:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1069:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1070:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1071:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1072:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1073:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1074:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1075:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1076:                      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();
1077:                  }
1078:                  else if (serviceRequestTypeIdList.Count <= 480)
1079:                  {
1080:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1081:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1082:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1083:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1084:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1085:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1086:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1087:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1088:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1089:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1090:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1091:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1092:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1093:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1094:                      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();
1095:                  }
1096:                  else if (serviceRequestTypeIdList.Count <= 512)
1097:                  {
1098:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1099:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1100:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1101:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1102:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1103:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1104:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1105:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1106:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1107:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1108:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1109:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1110:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1111:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1112:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1113:                      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();
1114:                  }
1115:                  else if (serviceRequestTypeIdList.Count <= 544)
1116:                  {
1117:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1118:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1119:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1120:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1121:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1122:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1123:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1124:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1125:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1126:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1127:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1128:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1129:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1130:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1131:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1132:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1133:                      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();
1134:                  }
1135:                  else if (serviceRequestTypeIdList.Count <= 576)
1136:                  {
1137:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1138:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1139:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1140:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1141:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1142:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1143:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1144:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1145:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1146:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1147:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1148:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1149:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1150:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1151:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1152:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1153:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1154:                      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();
1155:                  }
1156:                  else if (serviceRequestTypeIdList.Count <= 608)
1157:                  {
1158:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1159:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1160:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1161:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1162:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1163:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1164:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1165:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1166:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1167:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1168:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1169:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1170:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1171:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1172:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1173:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1174:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1175:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1176:                      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();
1177:                  }
1178:                  else if (serviceRequestTypeIdList.Count <= 640)
1179:                  {
1180:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1181:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1182:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1183:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1184:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1185:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1186:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1187:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1188:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1189:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1190:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1191:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1192:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1193:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1194:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1195:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1196:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1197:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1198:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1199:                      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();
1200:                  }
1201:                  else if (serviceRequestTypeIdList.Count <= 672)
1202:                  {
1203:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1204:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1205:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1206:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1207:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1208:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1209:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1210:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1211:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1212:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1213:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1214:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1215:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1216:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1217:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1218:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1219:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1220:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1221:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1222:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1223:                      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();
1224:                  }
1225:                  else if (serviceRequestTypeIdList.Count <= 704)
1226:                  {
1227:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1228:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1229:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1230:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1231:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1232:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1233:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1234:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1235:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1236:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1237:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1238:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1239:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1240:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1241:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1242:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1243:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1244:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1245:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1246:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1247:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1248:                      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();
1249:                  }
1250:                  else if (serviceRequestTypeIdList.Count <= 736)
1251:                  {
1252:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1253:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1254:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1255:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1256:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1257:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1258:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1259:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1260:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1261:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1262:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1263:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1264:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1265:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1266:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1267:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1268:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1269:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1270:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1271:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1272:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1273:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1274:                      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();
1275:                  }
1276:                  else if (serviceRequestTypeIdList.Count <= 768)
1277:                  {
1278:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1279:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1280:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1281:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1282:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1283:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1284:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1285:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1286:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1287:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1288:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1289:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1290:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1291:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1292:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1293:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1294:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1295:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1296:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1297:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1298:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1299:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1300:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1301:                      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();
1302:                  }
1303:                  else if (serviceRequestTypeIdList.Count <= 800)
1304:                  {
1305:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1306:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1307:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1308:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1309:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1310:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1311:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1312:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1313:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1314:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1315:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1316:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1317:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1318:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1319:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1320:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1321:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1322:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1323:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1324:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1325:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1326:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1327:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1328:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
1329:                      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();
1330:                  }
1331:                  else //if (serviceRequestTypeIdList.Count <= 832)
1332:                  {
1333:                      list = (from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(0, 32) on srt.Id equals srtid select srt).ToList();
1334:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(32, 32) on srt.Id equals srtid select srt).ToList();
1335:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(64, 32) on srt.Id equals srtid select srt).ToList();
1336:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(96, 32) on srt.Id equals srtid select srt).ToList();
1337:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(128, 32) on srt.Id equals srtid select srt).ToList();
1338:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(160, 32) on srt.Id equals srtid select srt).ToList();
1339:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(192, 32) on srt.Id equals srtid select srt).ToList();
1340:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(224, 32) on srt.Id equals srtid select srt).ToList();
1341:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(256, 32) on srt.Id equals srtid select srt).ToList();
1342:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(288, 32) on srt.Id equals srtid select srt).ToList();
1343:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(320, 32) on srt.Id equals srtid select srt).ToList();
1344:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(352, 32) on srt.Id equals srtid select srt).ToList();
1345:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(384, 32) on srt.Id equals srtid select srt).ToList();
1346:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(416, 32) on srt.Id equals srtid select srt).ToList();
1347:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(448, 32) on srt.Id equals srtid select srt).ToList();
1348:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(480, 32) on srt.Id equals srtid select srt).ToList();
1349:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(512, 32) on srt.Id equals srtid select srt).ToList();
1350:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(544, 32) on srt.Id equals srtid select srt).ToList();
1351:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(576, 32) on srt.Id equals srtid select srt).ToList();
1352:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(608, 32) on srt.Id equals srtid select srt).ToList();
1353:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(640, 32) on srt.Id equals srtid select srt).ToList();
1354:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(672, 32) on srt.Id equals srtid select srt).ToList();
1355:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(704, 32) on srt.Id equals srtid select srt).ToList();
1356:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(736, 32) on srt.Id equals srtid select srt).ToList();
1357:                      list = list.Union(from srt in db.ServiceRequestTypes join srtid in serviceRequestTypeIdList.GetRange(768, 32) on srt.Id equals srtid select srt).ToList();
1358:                      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();
1359:                  }
1360:              }
1361:   
1362:              return list.Distinct().ToList();
1363:          }
1364:   
1365:          ////////////////////////////////////////////////////////////////////////////
1366:   
1367:          /// <summary>
1368:          /// 
1369:          /// </summary>
1370:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> AgcfGatewayRecordList(List<int> agcfGatewayRecordIdList)
1371:          {
1372:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> list;
1373:   
1374:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1375:              {
1376:                  if (agcfGatewayRecordIdList.Count <= 32)
1377:                  {
1378:                      list = (from gr in db.AgcfGatewayRecords
1379:                              join grid in agcfGatewayRecordIdList on gr.Id equals grid
1380:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1381:                              {
1382:                                  Id = gr.Id,
1383:                                  GwId = gr.GwId,
1384:                                  GwUserId = gr.GwUserId,
1385:                                  GwDomain = gr.GwDomain,
1386:                                  GwName = gr.GwName,
1387:                                  IP1 = gr.IP1,
1388:                                  IP2 = gr.IP2,
1389:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
1390:                                  IsPrimary = gr.IsPrimary,
1391:                                  Created = gr.Created,
1392:                                  Updated = gr.Updated
1393:                              }).ToList();
1394:                  }
1395:                  else
1396:                  {
1397:                      list = (from gr in db.AgcfGatewayRecords
1398:                              join grid in agcfGatewayRecordIdList.GetRange(0, 32) on gr.Id equals grid
1399:                              select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1400:                              {
1401:                                  Id = gr.Id,
1402:                                  GwId = gr.GwId,
1403:                                  GwUserId = gr.GwUserId,
1404:                                  GwDomain = gr.GwDomain,
1405:                                  GwName = gr.GwName,
1406:                                  IP1 = gr.IP1,
1407:                                  IP2 = gr.IP2,
1408:                                  MateExternalIPAddr = gr.MateExternalIPAddr,
1409:                                  IsPrimary = gr.IsPrimary,
1410:                                  Created = gr.Created,
1411:                                  Updated = gr.Updated
1412:                              }).ToList();
1413:   
1414:                      list = list.Union(from gr in db.AgcfGatewayRecords
1415:                                        join grid in agcfGatewayRecordIdList.GetRange(32, agcfGatewayRecordIdList.Count - 32 - 1) on gr.Id equals grid
1416:                                        select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord()
1417:                                        {
1418:                                            Id = gr.Id,
1419:                                            GwId = gr.GwId,
1420:                                            GwUserId = gr.GwUserId,
1421:                                            GwDomain = gr.GwDomain,
1422:                                            GwName = gr.GwName,
1423:                                            IP1 = gr.IP1,
1424:                                            IP2 = gr.IP2,
1425:                                            MateExternalIPAddr = gr.MateExternalIPAddr,
1426:                                            IsPrimary = gr.IsPrimary,
1427:                                            Created = gr.Created,
1428:                                            Updated = gr.Updated
1429:                                        }).ToList();
1430:                  }
1431:              }
1432:   
1433:              return list.Distinct().ToList();
1434:          }
1435:   
1436:          ////////////////////////////////////////////////////////////////////////////
1437:   
1438:          /// <summary>
1439:          /// 
1440:          /// </summary>
1441:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> AgcfEndpointList(List<string> agcfEndpointIdList)
1442:          {
1443:              List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> list;
1444:   
1445:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1446:              {
1447:                  list = (from e in db.AgcfEndpoints
1448:                          join eid in agcfEndpointIdList on e.Id equals eid
1449:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint()
1450:                          {
1451:                              Id = e.Id,
1452:                              PrividUser = e.PrividUser,
1453:                              GwId = e.GwId,
1454:                              Dn = e.Dn,
1455:                              FlatTermID = e.FlatTermID,
1456:                              CallHoldLc = e.CallHoldLc,
1457:                              CallWaitingLc = e.CallWaitingLc,
1458:                              CallToggleLc = e.CallToggleLc,
1459:                              ThreeWayCallLc = e.ThreeWayCallLc,
1460:                              McidLc = e.McidLc,
1461:                              Password = e.Password,
1462:                              CallTransferLc = e.CallTransferLc,
1463:                              Created = e.Created,
1464:                              Updated = e.Updated
1465:                          }).ToList();
1466:              }
1467:   
1468:              return list.Distinct().ToList();
1469:          }
1470:   
1471:          ////////////////////////////////////////////////////////////////////////////
1472:   
1473:          /// <summary>
1474:          /// 
1475:          /// </summary>
1476:          public static List<Ia.Ngn.Cl.Model.Huawei.Mgw> MgwList(List<string> mgwIdList)
1477:          {
1478:              List<Ia.Ngn.Cl.Model.Huawei.Mgw> list;
1479:   
1480:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1481:              {
1482:                  if (mgwIdList.Count <= 32)
1483:                  {
1484:                      list = (from m in db.Mgws
1485:                              join mid in mgwIdList on m.Id equals mid
1486:                              select m).ToList();
1487:                  }
1488:                  else
1489:                  {
1490:                      list = (from m in db.Mgws
1491:                              join mid in mgwIdList.GetRange(0, 32) on m.Id equals mid
1492:                              select m).ToList();
1493:   
1494:                      list = list.Union(from m in db.Mgws
1495:                                        join mid in mgwIdList.GetRange(32, mgwIdList.Count - 32 - 1) on m.Id equals mid
1496:                                        select m).ToList();
1497:                  }
1498:              }
1499:   
1500:              return list.Distinct().ToList();
1501:          }
1502:   
1503:          ////////////////////////////////////////////////////////////////////////////
1504:   
1505:          /// <summary>
1506:          /// 
1507:          /// </summary>
1508:          public static List<Ia.Ngn.Cl.Model.Huawei.Asbr> AsbrList(List<string> asbrIdList)
1509:          {
1510:              List<Ia.Ngn.Cl.Model.Huawei.Asbr> list;
1511:   
1512:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1513:              {
1514:                  list = (from a in db.Asbrs
1515:                          join aid in asbrIdList on a.Id equals aid
1516:                          select a).ToList();
1517:              }
1518:   
1519:              return list.Distinct().ToList();
1520:          }
1521:   
1522:          ////////////////////////////////////////////////////////////////////////////
1523:   
1524:          /// <summary>
1525:          /// 
1526:          /// </summary>
1527:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevList(List<int> emsDevIdList)
1528:          {
1529:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
1530:   
1531:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1532:              {
1533:                  list = (from ed in db.EmsDevs
1534:                          join edid in emsDevIdList on ed.Id equals edid
1535:                          select ed).ToList();
1536:              }
1537:   
1538:              return list.Distinct().ToList();
1539:          }
1540:   
1541:          ////////////////////////////////////////////////////////////////////////////
1542:   
1543:          /// <summary>
1544:          /// 
1545:          /// </summary>
1546:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevListFromEmsOntIdList(List<string> emsOntIdList)
1547:          {
1548:              List<Ia.Ngn.Cl.Model.Huawei.EmsDev> list;
1549:   
1550:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1551:              {
1552:                  list = (from ed in db.EmsDevs
1553:                          join eb in db.EmsBoards on ed.Id equals eb.EmsDev.Id
1554:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
1555:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1556:                          join eoid in emsOntIdList on eo.Id equals eoid
1557:                          select ed).ToList();
1558:              }
1559:   
1560:              return list.Distinct().ToList();
1561:          }
1562:   
1563:          ////////////////////////////////////////////////////////////////////////////
1564:   
1565:          /// <summary>
1566:          /// 
1567:          /// </summary>
1568:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> EmsBoardList(List<string> emsBoardIdList)
1569:          {
1570:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
1571:   
1572:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1573:              {
1574:                  list = (from eb in db.EmsBoards
1575:                          join ebid in emsBoardIdList on eb.Id equals ebid
1576:                          select eb).ToList();
1577:              }
1578:   
1579:              return list.Distinct().ToList();
1580:          }
1581:   
1582:          ////////////////////////////////////////////////////////////////////////////
1583:   
1584:          /// <summary>
1585:          /// 
1586:          /// </summary>
1587:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> EmsBoardListFromEmsOntIdList(List<string> emsOntIdList)
1588:          {
1589:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
1590:   
1591:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1592:              {
1593:                  list = (from eb in db.EmsBoards
1594:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
1595:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1596:                          join eoid in emsOntIdList on eo.Id equals eoid
1597:                          select eb).ToList();
1598:              }
1599:   
1600:              return list.Distinct().ToList();
1601:          }
1602:   
1603:          ////////////////////////////////////////////////////////////////////////////
1604:   
1605:          /// <summary>
1606:          /// 
1607:          /// </summary>
1608:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsPort> EmsPortList(List<string> emsPortIdList)
1609:          {
1610:              List<Ia.Ngn.Cl.Model.Huawei.EmsPort> list;
1611:   
1612:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1613:              {
1614:                  list = (from ep in db.EmsPorts
1615:                          join epid in emsPortIdList on ep.Id equals epid
1616:                          select ep).ToList();
1617:              }
1618:   
1619:              return list.Distinct().ToList();
1620:          }
1621:   
1622:          ////////////////////////////////////////////////////////////////////////////
1623:   
1624:          /// <summary>
1625:          /// 
1626:          /// </summary>
1627:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsPort> EmsPortListFromEmsOntIdList(List<string> emsOntIdList)
1628:          {
1629:              List<Ia.Ngn.Cl.Model.Huawei.EmsPort> list;
1630:   
1631:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1632:              {
1633:                  list = (from ep in db.EmsPorts
1634:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
1635:                          join eoid in emsOntIdList on eo.Id equals eoid
1636:                          select ep).ToList();
1637:              }
1638:   
1639:              return list.Distinct().ToList();
1640:          }
1641:   
1642:          ////////////////////////////////////////////////////////////////////////////
1643:   
1644:          /// <summary>
1645:          /// 
1646:          /// </summary>
1647:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> EmsOntList(List<string> emsOntIdList)
1648:          {
1649:              List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> list;
1650:   
1651:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1652:              {
1653:                  list = (from eo in db.EmsOnts
1654:                          join oid in emsOntIdList on eo.Id equals oid
1655:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt()
1656:                          {
1657:                              Id = eo.Id,
1658:                              ResultCode = eo.ResultCode,
1659:                              StateId = eo.StateId,
1660:                              Access = eo.Access,
1661:                              ALIAS = eo.ALIAS,
1662:                              AUTH = eo.AUTH,
1663:                              CAPABPROF = eo.CAPABPROF,
1664:                              Created = eo.Created,
1665:                              DEV = eo.DEV,
1666:                              DID = eo.DID,
1667:                              EQUIPMENTID = eo.EQUIPMENTID,
1668:                              FN = eo.FN,
1669:                              GATE = eo.GATE,
1670:                              IP = eo.IP,
1671:                              MAINSOFTVERSION = eo.MAINSOFTVERSION,
1672:                              NAME = eo.NAME,
1673:                              ONTID = eo.ONTID,
1674:                              PN = eo.PN,
1675:                              ROUTEIP = eo.ROUTEIP,
1676:                              SERIALNUM = eo.SERIALNUM,
1677:                              SN = eo.SN,
1678:                              VAPROF = eo.VAPROF,
1679:                              Updated = eo.Updated,
1680:                              VENDORID = eo.VENDORID,
1681:                              VLAN = eo.VLAN
1682:                          }).ToList();
1683:              }
1684:   
1685:              return list.Distinct().ToList();
1686:          }
1687:   
1688:          ////////////////////////////////////////////////////////////////////////////
1689:   
1690:          /// <summary>
1691:          /// 
1692:          /// </summary>
1693:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdList(List<string> emsOntIdList)
1694:          {
1695:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1696:   
1697:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1698:              {
1699:                  list = (from eosi in db.EmsOntSipInfos join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid select eosi).Include(o => o.EmsOnt).ToList();
1700:              }
1701:   
1702:              return list.Distinct().ToList();
1703:          }
1704:   
1705:          ////////////////////////////////////////////////////////////////////////////
1706:   
1707:          /// <summary>
1708:          /// 
1709:          /// </summary>
1710:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdListAndService(List<string> emsOntIdList, List<string> emsVoipPstnUserDnList)
1711:          {
1712:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1713:   
1714:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1715:              {
1716:                  list = (from evpu in db.EmsVoipPstnUsers
1717:                          join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid
1718:                          where emsVoipPstnUserDnList.Contains(evpu.DN)
1719:                          select evpu).Include(o => o.EmsOnt).ToList();
1720:              }
1721:   
1722:              return list.Distinct().ToList();
1723:          }
1724:   
1725:          ////////////////////////////////////////////////////////////////////////////
1726:   
1727:          /// <summary>
1728:          /// 
1729:          /// </summary>
1730:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdList(List<string> emsOntIdList)
1731:          {
1732:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1733:   
1734:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1735:              {
1736:                  list = (from evpu in db.EmsVoipPstnUsers join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid select evpu).Include(o => o.EmsOnt).ToList();
1737:              }
1738:   
1739:              return list.Distinct().ToList();
1740:          }
1741:   
1742:          ////////////////////////////////////////////////////////////////////////////
1743:   
1744:          /// <summary>
1745:          /// 
1746:          /// </summary>
1747:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVag> VagListFromEmsOntIdList(List<string> emsOntIdList)
1748:          {
1749:              List<Ia.Ngn.Cl.Model.Huawei.EmsVag> list;
1750:   
1751:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1752:              {
1753:                  list = (from v in db.EmsVags join eoid in emsOntIdList on v.EmsOnt.Id equals eoid select v).Include(o => o.EmsOnt).ToList();
1754:              }
1755:   
1756:              return list.Distinct().ToList();
1757:          }
1758:   
1759:          ////////////////////////////////////////////////////////////////////////////
1760:   
1761:          /// <summary>
1762:          /// 
1763:          /// </summary>
1764:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> EmsVoipPstnUserListFromEmsOntIdListAndServiceList(List<string> emsOntIdList, List<string> serviceList)
1765:          {
1766:              string serviceWithCountryCode;
1767:              List<string> emsVoipPstnUserDnList;
1768:              List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> list;
1769:   
1770:              emsVoipPstnUserDnList = new List<string>();
1771:   
1772:              foreach (var service in serviceList)
1773:              {
1774:                  serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
1775:                  emsVoipPstnUserDnList.Add(serviceWithCountryCode);
1776:              }
1777:   
1778:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1779:              {
1780:                  list = (from evpu in db.EmsVoipPstnUsers
1781:                          join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid
1782:                          join evpud in emsVoipPstnUserDnList on evpu.DN equals evpud
1783:                          select evpu).Include(o => o.EmsOnt).ToList();
1784:              }
1785:   
1786:              return list.Distinct().ToList();
1787:          }
1788:   
1789:          ////////////////////////////////////////////////////////////////////////////
1790:   
1791:          /// <summary>
1792:          /// 
1793:          /// </summary>
1794:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> EmsOntSipInfoListFromEmsOntIdListAndService(List<string> emsOntIdList, List<string> sipUserNameList)
1795:          {
1796:              List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> list;
1797:   
1798:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1799:              {
1800:                  list = (from eosi in db.EmsOntSipInfos
1801:                          join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid
1802:                          where sipUserNameList.Contains(eosi.SIPUSERNAME)
1803:                          select eosi).Include(o => o.EmsOnt).ToList();
1804:              }
1805:   
1806:              return list.Distinct().ToList();
1807:          }
1808:   
1809:          ////////////////////////////////////////////////////////////////////////////
1810:   
1811:          /// <summary>
1812:          /// 
1813:          /// </summary>
1814:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOnt> ServiceRequestOntList(List<string> serviceRequestOntIdList)
1815:          {
1816:              List<Ia.Ngn.Cl.Model.ServiceRequestOnt> list;
1817:   
1818:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1819:              {
1820:                  list = (from sro in db.ServiceRequestOnts join sroid in serviceRequestOntIdList on sro.Id equals sroid select sro).ToList();
1821:              }
1822:   
1823:              return list.Distinct().ToList();
1824:          }
1825:   
1826:          ////////////////////////////////////////////////////////////////////////////
1827:   
1828:          /// <summary>
1829:          /// 
1830:          /// </summary>
1831:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> ServiceRequestOntDetailList(List<string> serviceRequestOntIdList)
1832:          {
1833:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1834:   
1835:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1836:              {
1837:                  list = (from srod in db.ServiceRequestOntDetails join sroid in serviceRequestOntIdList on srod.ServiceRequestOnt.Id equals sroid select srod).ToList();
1838:              }
1839:   
1840:              return list.Distinct().ToList();
1841:          }
1842:   
1843:          ////////////////////////////////////////////////////////////////////////////
1844:   
1845:          /// <summary>
1846:          /// 
1847:          /// </summary>
1848:          public static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> ServiceRequestOntDetailFromServieListList(List<string> serviceList)
1849:          {
1850:              List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> list;
1851:   
1852:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1853:              {
1854:                  list = (from srod in db.ServiceRequestOntDetails join s in serviceList on srod.Service equals s select srod).ToList();
1855:              }
1856:   
1857:              return list.Distinct().ToList();
1858:          }
1859:   
1860:          ////////////////////////////////////////////////////////////////////////////
1861:   
1862:          /// <summary>
1863:          /// 
1864:          /// </summary>
1865:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntList(List<string> nddOntIdList)
1866:          {
1867:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
1868:   
1869:              list = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdList on srsid.Id equals nid select srsid).ToList();
1870:   
1871:              return list.Distinct().ToList();
1872:          }
1873:   
1874:          ////////////////////////////////////////////////////////////////////////////
1875:   
1876:          /// <summary>
1877:          /// 
1878:          /// </summary>
1879:          public static List<Ia.Ngn.Cl.Model.Access> AccessList(List<string> accessIdList)
1880:          {
1881:              List<Ia.Ngn.Cl.Model.Access> list;
1882:   
1883:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1884:              {
1885:                  list = (from a in db.Accesses join aid in accessIdList on a.Id equals aid select a).ToList();
1886:              }
1887:   
1888:              return list.Distinct().ToList();
1889:          }
1890:   
1891:          ////////////////////////////////////////////////////////////////////////////
1892:   
1893:          /// <summary>
1894:          /// 
1895:          /// </summary>
1896:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAddress(int kuwaitNgnAreaId, string block, int street, int premisesOld, int premisesNew)
1897:          {
1898:              string streetString, premisesOldString, premisesNewString;
1899:              List<Ia.Ngn.Cl.Model.Access> list;
1900:   
1901:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1902:              {
1903:                  //oltIdList = kuwaitNgnArea.Site.Routers.SelectMany(v => v.Odfs.SelectMany(u => u.Olts.Select(w => w.Id))).ToList();
1904:   
1905:                  streetString = street.ToString();
1906:                  premisesOldString = premisesOld.ToString();
1907:                  premisesNewString = premisesNew.ToString();
1908:   
1909:                  list = (from a in db.Accesses
1910:                              //join oid in oltIdList on a.Olt equals oid
1911:                          where
1912:                          a.AreaId == kuwaitNgnAreaId
1913:                          &&
1914:                          (
1915:                          a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString
1916:                          || a.Block == block && a.Street == streetString && a.PremisesOld == premisesOldString && premisesNew == 0
1917:                          || a.Block == block && a.Street == streetString && a.PremisesNew == premisesNewString && premisesOld == 0
1918:                          || a.Block == block && a.PremisesOld == premisesOldString && a.PremisesNew == premisesNewString && street == 0
1919:                          || a.Block == block && a.PremisesOld == premisesOldString && street == 0 && premisesNew == 0
1920:                          || a.Block == block && a.PremisesNew == premisesNewString && street == 0 && premisesOld == 0
1921:                          || a.Block == block && a.Street == streetString && premisesOld == 0 && premisesNew == 0
1922:                          || a.Block == block && street == 0 && premisesOld == 0 && premisesNew == 0
1923:                          )
1924:                          select a).ToList();
1925:              }
1926:   
1927:              return list.Distinct().ToList();
1928:          }
1929:   
1930:          ////////////////////////////////////////////////////////////////////////////
1931:   
1932:          /// <summary>
1933:          /// 
1934:          /// </summary>
1935:          public static List<Ia.Ngn.Cl.Model.Access> AccessListFromAreaAndBlock(int kuwaitNgnAreaId, string block)
1936:          {
1937:              List<Ia.Ngn.Cl.Model.Access> list;
1938:   
1939:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1940:              {
1941:                  list = (from a in db.Accesses where a.AreaId == kuwaitNgnAreaId && a.Block == block select a).ToList();
1942:              }
1943:   
1944:              return list.Distinct().ToList();
1945:          }
1946:   
1947:          ////////////////////////////////////////////////////////////////////////////
1948:   
1949:          /// <summary>
1950:          /// 
1951:          /// </summary>
1952:          public static List<Ia.Ngn.Cl.Model.Ont> OntList(List<string> ontIdList)
1953:          {
1954:              List<Ia.Ngn.Cl.Model.Ont> list;
1955:   
1956:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1957:              {
1958:                  list = (from o in db.Onts join oid in ontIdList on o.Id equals oid select o).ToList();
1959:              }
1960:   
1961:              return list.Distinct().ToList();
1962:          }
1963:   
1964:          ////////////////////////////////////////////////////////////////////////////
1965:   
1966:          /// <summary>
1967:          /// 
1968:          /// </summary>
1969:          public static List<Ia.Ngn.Cl.Model.OntOntPots> OntOntPotsListFromOntOntPotsIdList(List<string> ontOntPotsIdList)
1970:          {
1971:              List<Ia.Ngn.Cl.Model.OntOntPots> list;
1972:   
1973:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1974:              {
1975:                  list = (from oop in db.OntOntPotses join oid in ontOntPotsIdList on oop.Id equals oid select oop).ToList();
1976:              }
1977:   
1978:              return list.Distinct().ToList();
1979:          }
1980:   
1981:          ////////////////////////////////////////////////////////////////////////////
1982:   
1983:          /// <summary>
1984:          /// 
1985:          /// </summary>
1986:          public static List<Ia.Ngn.Cl.Model.Event> EventList(List<long> eventIdList)
1987:          {
1988:              List<Ia.Ngn.Cl.Model.Event> list;
1989:   
1990:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
1991:              {
1992:                  list = (from e in db.Events join eid in eventIdList on e.Id equals eid select e).ToList();
1993:              }
1994:   
1995:              return list.Distinct().ToList();
1996:          }
1997:   
1998:          ////////////////////////////////////////////////////////////////////////////
1999:   
2000:          /// <summary>
2001:          /// 
2002:          /// </summary>
2003:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> SubPartyList(List<string> subPartyIdList)
2004:          {
2005:              List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> list;
2006:   
2007:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2008:              {
2009:                  list = (from sp in db.SubParties
2010:                          join spid in subPartyIdList on sp.Id equals spid
2011:                          select new Ia.Ngn.Cl.Model.Ui.Nokia.SubParty()
2012:                          {
2013:                              Id = sp.Id,
2014:                              PartyId = sp.PartyId,
2015:                              PrimaryPUIDCPEProfileNumber = sp.PrimaryPUIDCPEProfileNumber,
2016:                              DisplayName = sp.DisplayName,
2017:                              Category = sp.Category,
2018:                              AssocOtasRealm = sp.AssocOtasRealm,
2019:                              ServiceSuspension = sp.ServiceSuspension,
2020:                              Created = sp.Created,
2021:                              Updated = sp.Updated
2022:                          }).ToList();
2023:              }
2024:   
2025:              return list.Distinct().ToList();
2026:          }
2027:   
2028:          ////////////////////////////////////////////////////////////////////////////
2029:   
2030:          /// <summary>
2031:          /// 
2032:          /// </summary>
2033:          public static List<Ia.Ngn.Cl.Model.Report> ReportList(List<int> reportIdList)
2034:          {
2035:              List<Ia.Ngn.Cl.Model.Report> list;
2036:   
2037:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2038:              {
2039:                  if (reportIdList.Count == 1)
2040:                  {
2041:                      var reportId = reportIdList[0];
2042:                      list = (from r in db.Reports where r.Id == reportId select r).Include(u => u.ReportHistories).ToList();
2043:                  }
2044:                  else if (reportIdList.Count <= 32)
2045:                  {
2046:                      list = (from r in db.Reports join rid in reportIdList on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2047:                  }
2048:                  else if (reportIdList.Count <= 64)
2049:                  {
2050:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2051:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, reportIdList.Count - 32 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2052:                  }
2053:                  else if (reportIdList.Count <= 96)
2054:                  {
2055:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2056:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2057:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, reportIdList.Count - 64 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2058:                  }
2059:                  else if (reportIdList.Count <= 128)
2060:                  {
2061:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2062:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2063:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2064:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, reportIdList.Count - 96 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2065:                  }
2066:                  else if (reportIdList.Count <= 160)
2067:                  {
2068:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2069:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2070:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2071:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2072:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, reportIdList.Count - 128 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2073:                  }
2074:                  else if (reportIdList.Count <= 192)
2075:                  {
2076:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2077:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2078:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2079:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2080:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2081:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(160, reportIdList.Count - 160 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2082:                  }
2083:                  else if (reportIdList.Count <= 224)
2084:                  {
2085:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2086:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2087:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2088:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2089:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2090:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2091:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(192, reportIdList.Count - 192 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2092:                  }
2093:                  else //if (reportIdList.Count <= 256)
2094:                  {
2095:                      list = (from r in db.Reports join rid in reportIdList.GetRange(0, 32) on r.Id equals rid select r).Include(u => u.ReportHistories).ToList();
2096:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(32, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2097:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(64, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2098:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(96, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2099:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(128, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2100:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(160, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2101:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(192, 32) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2102:                      list = list.Union((from r in db.Reports join rid in reportIdList.GetRange(224, reportIdList.Count - 224 - 1) on r.Id equals rid select r).Include(u => u.ReportHistories)).ToList();
2103:                  }
2104:              }
2105:   
2106:              return list.Distinct().ToList();
2107:          }
2108:   
2109:          ////////////////////////////////////////////////////////////////////////////
2110:   
2111:          /// <summary>
2112:          /// 
2113:          /// </summary>
2114:          public static List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> HuSbrList(List<string> huSbrImpuList)
2115:          {
2116:              List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> list;
2117:   
2118:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2119:              {
2120:                  list = (from h in db.HuSbrs
2121:                          join hid in huSbrImpuList on h.IMPU equals hid
2122:                          select new Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr()
2123:                          {
2124:                              COP = h.COP,
2125:                              CSC = h.CSC,
2126:                              Id = h.Id,
2127:                              IMPU = h.IMPU,
2128:                              ITT = h.ITT,
2129:                              LP = h.LP,
2130:                              NS3PTY = h.NS3PTY,
2131:                              NSABRC = h.NSABRC,
2132:                              NSCBA = h.NSCBA,
2133:                              NSCFU = h.NSCFU,
2134:                              NSCLIP = h.NSCLIP,
2135:                              NSCW = h.NSCW,
2136:                              NSFAX = h.NSFAX,
2137:                              NSHOLD = h.NSHOLD,
2138:                              NSNPTY = h.NSNPTY,
2139:                              NSWAKE_UP = h.NSWAKE_UP,
2140:                              Created = h.Created,
2141:                              Updated = h.Updated
2142:                          }).ToList();
2143:              }
2144:   
2145:              return list.Distinct().ToList();
2146:          }
2147:   
2148:          ////////////////////////////////////////////////////////////////////////////
2149:   
2150:          /// <summary>
2151:          /// 
2152:          /// </summary>
2153:          public static List<Ia.Ngn.Cl.Model.Huawei.Owsbr> OwsbrList(List<string> owsbrImpuList)
2154:          {
2155:              List<Ia.Ngn.Cl.Model.Huawei.Owsbr> list;
2156:   
2157:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2158:              {
2159:                  list = (from o in db.Owsbrs join oid in owsbrImpuList on o.IMPU equals oid select o).ToList();
2160:              }
2161:   
2162:              return list.Distinct().ToList();
2163:          }
2164:   
2165:          ////////////////////////////////////////////////////////////////////////////
2166:   
2167:          /// <summary>
2168:          /// 
2169:          /// </summary>
2170:          public static List<Ia.Ngn.Cl.Model.Huawei.Seruattr> SeruattrListFromServiceIdList(List<string> serviceIdList)
2171:          {
2172:              List<Ia.Ngn.Cl.Model.Huawei.Seruattr> list;
2173:   
2174:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2175:              {
2176:                  list = (from s in db.Seruattrs join sid in serviceIdList on s.Id equals sid select s).ToList();
2177:              }
2178:   
2179:              return list.Distinct().ToList();
2180:          }
2181:   
2182:          ////////////////////////////////////////////////////////////////////////////
2183:   
2184:          /// <summary>
2185:          /// 
2186:          /// </summary>
2187:          public static List<Ia.Ngn.Cl.Model.Huawei.Seruattr> SeruattrList(List<string> serviceList)
2188:          {
2189:              List<Ia.Ngn.Cl.Model.Huawei.Seruattr> list;
2190:   
2191:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2192:              {
2193:                  list = (from s in db.Seruattrs join sid in serviceList on s.USRNUM equals sid select s).ToList();
2194:              }
2195:   
2196:              return list.Distinct().ToList();
2197:          }
2198:   
2199:          ////////////////////////////////////////////////////////////////////////////
2200:   
2201:          /// <summary>
2202:          /// 
2203:          /// </summary>
2204:          public static List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> AxeSubscriberListFromServiceIdList(List<string> serviceIdList)
2205:          {
2206:              List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> list;
2207:   
2208:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2209:              {
2210:                  list = (from s in db.AxeSubscribers join sid in serviceIdList on s.Id equals sid select s).ToList();
2211:              }
2212:   
2213:              return list.Distinct().ToList();
2214:          }
2215:   
2216:          ////////////////////////////////////////////////////////////////////////////
2217:   
2218:          /// <summary>
2219:          /// 
2220:          /// </summary>
2221:          public static List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> AxeSubscriberList(List<int> numberList)
2222:          {
2223:              List<Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber> list;
2224:   
2225:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2226:              {
2227:                  list = (from s in db.AxeSubscribers join sid in numberList on s.SNB equals sid select s).ToList();
2228:              }
2229:   
2230:              return list.Distinct().ToList();
2231:          }
2232:   
2233:          ////////////////////////////////////////////////////////////////////////////
2234:   
2235:          /// <summary>
2236:          /// 
2237:          /// </summary>
2238:          public static List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> EwsdSubscriberListFromServiceIdList(List<string> serviceIdList)
2239:          {
2240:              List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> list;
2241:   
2242:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2243:              {
2244:                  list = (from s in db.EwsdSubscribers join sid in serviceIdList on s.Id equals sid select s).ToList();
2245:              }
2246:   
2247:              return list.Distinct().ToList();
2248:          }
2249:   
2250:          ////////////////////////////////////////////////////////////////////////////
2251:   
2252:          /// <summary>
2253:          /// 
2254:          /// </summary>
2255:          public static List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> EwsdSubscriberList(List<int> numberList)
2256:          {
2257:              List<Ia.Ngn.Cl.Model.Siemens.EwsdSubscriber> list;
2258:   
2259:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2260:              {
2261:                  list = (from s in db.EwsdSubscribers join sid in numberList on s.DN equals sid select s).ToList();
2262:              }
2263:   
2264:              return list.Distinct().ToList();
2265:          }
2266:   
2267:          ////////////////////////////////////////////////////////////////////////////
2268:   
2269:          /// <summary>
2270:          /// 
2271:          /// </summary>
2272:          public static List<Ia.Ngn.Cl.Model.OntServiceVoip> OntServiceVoipList(List<string> ontServiceVoipIdList)
2273:          {
2274:              List<Ia.Ngn.Cl.Model.OntServiceVoip> list;
2275:   
2276:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2277:              {
2278:                  if (ontServiceVoipIdList.Count == 1)
2279:                  {
2280:                      var ontServiceVoipId = ontServiceVoipIdList[0];
2281:                      list = (from ov in db.OntServiceVoips where ov.Id == ontServiceVoipId select ov).ToList();
2282:                  }
2283:                  else if (ontServiceVoipIdList.Count <= 32)
2284:                  {
2285:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList on ov.Id equals ovid select ov).ToList();
2286:                  }
2287:                  else
2288:                  {
2289:                      list = (from ov in db.OntServiceVoips join ovid in ontServiceVoipIdList.GetRange(0, 32) on ov.Id equals ovid select ov).ToList();
2290:                      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();
2291:                  }
2292:              }
2293:   
2294:              return list.Distinct().ToList();
2295:          }
2296:   
2297:          ////////////////////////////////////////////////////////////////////////////
2298:   
2299:          /// <summary>
2300:          /// 
2301:          /// </summary>
2302:          public static List<Ia.Ngn.Cl.Model.Ui.Service2> ServiceList(List<string> serviceIdList)
2303:          {
2304:              List<Ia.Ngn.Cl.Model.Service2> list;
2305:              List<Ia.Ngn.Cl.Model.Ui.Service2> uiList;
2306:   
2307:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2308:              {
2309:                  if (serviceIdList.Count == 1)
2310:                  {
2311:                      var serviceId = serviceIdList[0];
2312:                      list = (from s in db.Service2s where s.Id == serviceId select s).ToList();
2313:                  }
2314:                  else if (serviceIdList.Count <= 32)
2315:                  {
2316:                      list = (from s in db.Service2s join sid in serviceIdList on s.Id equals sid select s).ToList();
2317:                  }
2318:                  else if (serviceIdList.Count <= 64)
2319:                  {
2320:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2321:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on s.Id equals sid select s).ToList();
2322:                  }
2323:                  else if (serviceIdList.Count <= 96)
2324:                  {
2325:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2326:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2327:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on s.Id equals sid select s).ToList();
2328:                  }
2329:                  else if (serviceIdList.Count <= 128)
2330:                  {
2331:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2332:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2333:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2334:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on s.Id equals sid select s).ToList();
2335:                  }
2336:                  else if (serviceIdList.Count <= 160)
2337:                  {
2338:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2339:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2340:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2341:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2342:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on s.Id equals sid select s).ToList();
2343:                  }
2344:                  else if (serviceIdList.Count <= 192)
2345:                  {
2346:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2347:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2348:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2349:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2350:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2351:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on s.Id equals sid select s).ToList();
2352:                  }
2353:                  else if (serviceIdList.Count <= 224)
2354:                  {
2355:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2356:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2357:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2358:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2359:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2360:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2361:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on s.Id equals sid select s).ToList();
2362:                  }
2363:                  else if (serviceIdList.Count <= 256)
2364:                  {
2365:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2366:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2367:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2368:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2369:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2370:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2371:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2372:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on s.Id equals sid select s).ToList();
2373:                  }
2374:                  else if (serviceIdList.Count <= 288)
2375:                  {
2376:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2377:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2378:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2379:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2380:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2381:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2382:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2383:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2384:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, serviceIdList.Count - 256 - 1) on s.Id equals sid select s).ToList();
2385:                  }
2386:                  else if (serviceIdList.Count <= 320)
2387:                  {
2388:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2389:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2390:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2391:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2392:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2393:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2394:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2395:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2396:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2397:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, serviceIdList.Count - 288 - 1) on s.Id equals sid select s).ToList();
2398:                  }
2399:                  else if (serviceIdList.Count <= 352)
2400:                  {
2401:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2402:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2403:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2404:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2405:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2406:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2407:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2408:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2409:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2410:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2411:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, serviceIdList.Count - 320 - 1) on s.Id equals sid select s).ToList();
2412:                  }
2413:                  else if (serviceIdList.Count <= 384)
2414:                  {
2415:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2416:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2417:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2418:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2419:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2420:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2421:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2422:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2423:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2424:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2425:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2426:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, serviceIdList.Count - 352 - 1) on s.Id equals sid select s).ToList();
2427:                  }
2428:                  else if (serviceIdList.Count <= 416)
2429:                  {
2430:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2431:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2432:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2433:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2434:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2435:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2436:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2437:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2438:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2439:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2440:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2441:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
2442:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, serviceIdList.Count - 384 - 1) on s.Id equals sid select s).ToList();
2443:                  }
2444:                  else if (serviceIdList.Count <= 448)
2445:                  {
2446:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2447:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2448:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2449:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2450:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2451:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2452:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2453:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2454:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2455:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2456:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2457:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
2458:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
2459:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, serviceIdList.Count - 416 - 1) on s.Id equals sid select s).ToList();
2460:                  }
2461:                  else if (serviceIdList.Count <= 480)
2462:                  {
2463:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2464:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2465:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2466:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2467:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2468:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2469:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2470:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2471:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2472:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2473:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2474:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
2475:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
2476:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
2477:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, serviceIdList.Count - 448 - 1) on s.Id equals sid select s).ToList();
2478:                  }
2479:                  else if (serviceIdList.Count <= 512)
2480:                  {
2481:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2482:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2483:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2484:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2485:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2486:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2487:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2488:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2489:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2490:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2491:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2492:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
2493:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
2494:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
2495:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
2496:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, serviceIdList.Count - 480 - 1) on s.Id equals sid select s).ToList();
2497:                  }
2498:                  else if (serviceIdList.Count <= 544)
2499:                  {
2500:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2501:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2502:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2503:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2504:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2505:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2506:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2507:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2508:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2509:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2510:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2511:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
2512:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
2513:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
2514:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
2515:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).ToList();
2516:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, serviceIdList.Count - 512 - 1) on s.Id equals sid select s).ToList();
2517:                  }
2518:                  else //if (serviceIdList.Count <= ??)
2519:                  {
2520:                      list = (from s in db.Service2s join sid in serviceIdList.GetRange(0, 32) on s.Id equals sid select s).ToList();
2521:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(32, 32) on s.Id equals sid select s).ToList();
2522:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(64, 32) on s.Id equals sid select s).ToList();
2523:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(96, 32) on s.Id equals sid select s).ToList();
2524:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(128, 32) on s.Id equals sid select s).ToList();
2525:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(160, 32) on s.Id equals sid select s).ToList();
2526:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(192, 32) on s.Id equals sid select s).ToList();
2527:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(224, 32) on s.Id equals sid select s).ToList();
2528:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(256, 32) on s.Id equals sid select s).ToList();
2529:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(288, 32) on s.Id equals sid select s).ToList();
2530:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(320, 32) on s.Id equals sid select s).ToList();
2531:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(352, 32) on s.Id equals sid select s).ToList();
2532:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(384, 32) on s.Id equals sid select s).ToList();
2533:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(416, 32) on s.Id equals sid select s).ToList();
2534:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(448, 32) on s.Id equals sid select s).ToList();
2535:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(480, 32) on s.Id equals sid select s).ToList();
2536:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(512, 32) on s.Id equals sid select s).ToList();
2537:                      list = list.Union(from s in db.Service2s join sid in serviceIdList.GetRange(544, serviceIdList.Count - 544 - 1) on s.Id equals sid select s).ToList();
2538:                  }
2539:   
2540:                  uiList = (from s in list
2541:                            select new Ia.Ngn.Cl.Model.Ui.Service2()
2542:                            {
2543:                                Id = s.Id,
2544:                                AbbriviatedCalling = s.AbbriviatedCalling,
2545:                                AlarmCall = s.AlarmCall,
2546:                                CallBarring = s.CallBarring,
2547:                                CallerId = s.CallerId,
2548:                                CallForwarding = s.CallForwarding,
2549:                                CallWaiting = s.CallWaiting,
2550:                                ConferenceCall = s.ConferenceCall,
2551:                                Created = s.Created,
2552:                                InternationalCalling = s.InternationalCalling,
2553:                                InternationalCallingUserControlled = s.InternationalCallingUserControlled,
2554:                                Port = s.Port,
2555:                                Pin = s.Pin,
2556:                                Service = s.Service,
2557:                                ServiceType = s.ServiceType,
2558:                                ServiceSuspension = s.ServiceSuspension,
2559:                                ServiceTypeName = s.ServiceType.ToString(),
2560:                                Updated = s.Updated,
2561:                                AccessId = (s.Access != null) ? s.Access.Id : string.Empty
2562:                            }).ToList();
2563:              }
2564:   
2565:              return uiList.Distinct().ToList();
2566:          }
2567:   
2568:          ////////////////////////////////////////////////////////////////////////////
2569:   
2570:          /// <summary>
2571:          /// 
2572:          /// </summary>
2573:          public static List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> SubscriberList(List<string> subscriberIdList)
2574:          {
2575:              List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> list;
2576:   
2577:              // below: db.Subscribers contains XML fields which can not be evaluated in a Union() function.
2578:   
2579:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2580:              {
2581:                  list = (from s in db.Subscribers
2582:                          join sid in subscriberIdList on s.Id equals sid
2583:                          select s).AsEnumerable().Select(s => new Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber()
2584:                          {
2585:                              Id = s.Id,
2586:                              AlternateOtasRealm = s.AlternateOtasRealm,
2587:                              PartyId = s.PartyId,
2588:                              AbbriviatedCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.OneDigitSpeedDialIsAssigned(s._OneDigitSpeedDial),
2589:                              AlarmCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ReminderCallIsAssigned(s._ReminderCall),
2590:                              CallerId = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallingLineIdIsAssigned(s._CallingLineId),
2591:                              CallForwarding = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallForwardingIsAssigned(s._CallForwardingVari),
2592:                              CallWaiting = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.CallWaitingIsAssigned(s._CallWaiting, false),
2593:                              ConferenceCall = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ConferenceCallIsAssigned(s._ConferenceCalling),
2594:                              InternationalCalling = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingIsAssigned(s._CallBarring),
2595:                              InternationalCallingUserControlled = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.InternationalCallingUserControlledIsAssigned(s._OutgoingCallBarring),
2596:                              //ServiceSuspention = Ia.Ngn.Cl.Model.Business.Nokia.Subscriber.ServiceSuspentionIsAssigned(s._ServiceSuspention),
2597:                              Created = s.Created,
2598:                              Updated = s.Updated,
2599:                          }).ToList();
2600:              }
2601:   
2602:              return list.Distinct().ToList();
2603:          }
2604:   
2605:          ////////////////////////////////////////////////////////////////////////////
2606:   
2607:          /// <summary>
2608:          /// 
2609:          /// </summary>
2610:          public static List<string> AccessIdList(int oltId, int ponNumber, int ontInternalNumber)
2611:          {
2612:              List<string> list;
2613:   
2614:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2615:              {
2616:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber && a.Ont == ontInternalNumber select a.Id).ToList();
2617:              }
2618:   
2619:              return list.Distinct().ToList();
2620:          }
2621:   
2622:          ////////////////////////////////////////////////////////////////////////////
2623:   
2624:          /// <summary>
2625:          /// 
2626:          /// </summary>
2627:          public static List<string> AccessIdList(int oltId, int ponNumber)
2628:          {
2629:              List<string> list;
2630:   
2631:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2632:              {
2633:                  list = (from a in db.Accesses where a.Olt == oltId && a.Pon == ponNumber select a.Id).ToList();
2634:              }
2635:   
2636:              return list.Distinct().ToList();
2637:          }
2638:   
2639:          ////////////////////////////////////////////////////////////////////////////
2640:   
2641:          /// <summary>
2642:          /// 
2643:          /// </summary>
2644:          public static List<int> EmsDevIdListFromEmsBoardIdList(List<string> emsBoardIdList)
2645:          {
2646:              List<int> list;
2647:   
2648:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2649:              {
2650:                  list = (from ed in db.EmsDevs
2651:                          join eb in db.EmsBoards on ed.Id equals eb.EmsDev.Id
2652:                          join ebid in emsBoardIdList on eb.Id equals ebid
2653:                          select ed.Id).ToList();
2654:              }
2655:   
2656:              return list.Distinct().ToList();
2657:          }
2658:   
2659:          ////////////////////////////////////////////////////////////////////////////
2660:   
2661:          /// <summary>
2662:          /// 
2663:          /// </summary>
2664:          public static List<int> EmsDevIdListFromAccessIdList(List<string> accessIdList)
2665:          {
2666:              List<int> list;
2667:   
2668:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2669:              {
2670:                  list = (from ed in db.EmsDevs
2671:                          join aid in accessIdList on ed.Access.Id equals aid
2672:                          select ed.Id).ToList();
2673:              }
2674:   
2675:              return list.Distinct().ToList();
2676:          }
2677:   
2678:          ////////////////////////////////////////////////////////////////////////////
2679:   
2680:          /// <summary>
2681:          /// 
2682:          /// </summary>
2683:          public static List<string> EmsBoardIdListFromEmsPortIdList(List<string> emsPortIdList)
2684:          {
2685:              List<string> list;
2686:   
2687:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2688:              {
2689:                  list = (from eb in db.EmsBoards
2690:                          join ep in db.EmsPorts on eb.Id equals ep.EmsBoard.Id
2691:                          join epid in emsPortIdList on ep.Id equals epid
2692:                          select eb.Id).ToList();
2693:              }
2694:   
2695:              return list.Distinct().ToList();
2696:          }
2697:   
2698:          ////////////////////////////////////////////////////////////////////////////
2699:   
2700:          /// <summary>
2701:          /// 
2702:          /// </summary>
2703:          public static List<string> EmsBoardIdListFromAccessIdList(List<string> accessIdList)
2704:          {
2705:              List<string> list;
2706:   
2707:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2708:              {
2709:                  list = (from eb in db.EmsBoards
2710:                          join ed in db.EmsDevs on eb.EmsDev.Id equals ed.Id
2711:                          join aid in accessIdList on ed.Access.Id equals aid
2712:                          select eb.Id).ToList();
2713:              }
2714:   
2715:              return list.Distinct().ToList();
2716:          }
2717:   
2718:          ////////////////////////////////////////////////////////////////////////////
2719:   
2720:          /// <summary>
2721:          /// 
2722:          /// </summary>
2723:          public static List<string> EmsPortIdListFromEmsOntIdList(List<string> emsOntIdList)
2724:          {
2725:              List<string> list;
2726:   
2727:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2728:              {
2729:                  list = (from ep in db.EmsPorts
2730:                          join eo in db.EmsOnts on ep.Id equals eo.EmsPort.Id
2731:                          join eoid in emsOntIdList on eo.Id equals eoid
2732:                          select ep.Id).ToList();
2733:              }
2734:   
2735:              return list.Distinct().ToList();
2736:          }
2737:   
2738:          ////////////////////////////////////////////////////////////////////////////
2739:   
2740:          /// <summary>
2741:          /// 
2742:          /// </summary>
2743:          public static List<string> EmsOntIdListFromNddOntIdList(List<string> nddOntIdList)
2744:          {
2745:              List<string> list;
2746:   
2747:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2748:              {
2749:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.Id).ToList();
2750:              }
2751:   
2752:              return list.Distinct().ToList();
2753:          }
2754:   
2755:          ////////////////////////////////////////////////////////////////////////////
2756:   
2757:          /// <summary>
2758:          /// 
2759:          /// </summary>
2760:          public static List<string> EmsOntIpListFromNddOntIdList(List<string> nddOntIdList)
2761:          {
2762:              List<string> list;
2763:   
2764:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2765:              {
2766:                  list = (from eo in db.EmsOnts join nid in nddOntIdList on eo.Id equals nid select eo.IP).ToList();
2767:              }
2768:   
2769:              return list.Distinct().ToList();
2770:          }
2771:   
2772:          ////////////////////////////////////////////////////////////////////////////
2773:   
2774:          /// <summary>
2775:          /// 
2776:          /// </summary>
2777:          public static List<string> SbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
2778:          {
2779:              List<string> list;
2780:   
2781:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2782:              {
2783:                  list = (from s in db.HuSbrs join isd in impuSipDomainList on s.IMPU equals isd select s.IMPU).ToList();
2784:              }
2785:   
2786:              return list.Distinct().ToList();
2787:          }
2788:   
2789:          ////////////////////////////////////////////////////////////////////////////
2790:   
2791:          /// <summary>
2792:          /// 
2793:          /// </summary>
2794:          public static List<string> OwSbrImpuListFromImpuSipDomainList(List<string> impuSipDomainList)
2795:          {
2796:              List<string> list;
2797:   
2798:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2799:              {
2800:                  list = (from o in db.Owsbrs join i in impuSipDomainList on o.IMPU equals i select o.IMPU).ToList();
2801:              }
2802:   
2803:              return list.Distinct().ToList();
2804:          }
2805:   
2806:          ////////////////////////////////////////////////////////////////////////////
2807:   
2808:          /// <summary>
2809:          /// 
2810:          /// </summary>
2811:          public static List<string> ServiceRequestServiceIdListFromAccessIdList(List<string> accessIdList)
2812:          {
2813:              List<string> list;
2814:   
2815:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2816:              {
2817:                  list = (from srs in db.ServiceRequestServices join aid in accessIdList on srs.Access.Id equals aid select srs.Id).ToList();
2818:              }
2819:   
2820:              return list.Distinct().ToList();
2821:          }
2822:   
2823:          ////////////////////////////////////////////////////////////////////////////
2824:   
2825:          /// <summary>
2826:          /// 
2827:          /// </summary>
2828:          public static List<string> ServiceRequestServiceIdListFromServiceIdList(List<string> serviceIdList)
2829:          {
2830:              List<string> list;
2831:   
2832:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2833:              {
2834:                  list = (from srs in db.ServiceRequestServices join si in serviceIdList on srs.Id equals si select srs.Id).ToList();
2835:              }
2836:   
2837:              return list.Distinct().ToList();
2838:          }
2839:   
2840:          ////////////////////////////////////////////////////////////////////////////
2841:   
2842:          /// <summary>
2843:          /// 
2844:          /// </summary>
2845:          public static List<string> ServiceRequestServiceIdListFromServiceList(List<string> serviceList)
2846:          {
2847:              List<string> list;
2848:   
2849:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2850:              {
2851:                  list = (from srs in db.ServiceRequestServices join s in serviceList on srs.Service equals s select srs.Id).ToList();
2852:              }
2853:   
2854:              return list.Distinct().ToList();
2855:          }
2856:   
2857:          ////////////////////////////////////////////////////////////////////////////
2858:   
2859:          /// <summary>
2860:          /// 
2861:          /// </summary>
2862:          public static List<string> ServiceIdListFromServiceIdList(List<string> serviceIdList)
2863:          {
2864:              List<string> list;
2865:   
2866:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2867:              {
2868:                  if (serviceIdList.Count == 1)
2869:                  {
2870:                      var serviceId = serviceIdList[0];
2871:                      list = (from s in db.Service2s where s.Id == serviceId select s.Id).ToList();
2872:                  }
2873:                  else if (serviceIdList.Count <= 32)
2874:                  {
2875:                      list = (from s in db.Service2s join si in serviceIdList on s.Id equals si select s.Id).ToList();
2876:                  }
2877:                  else if (serviceIdList.Count <= 64)
2878:                  {
2879:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2880:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on s.Id equals si select s.Id).ToList();
2881:                  }
2882:                  else if (serviceIdList.Count <= 96)
2883:                  {
2884:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2885:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2886:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on s.Id equals si select s.Id).ToList();
2887:                  }
2888:                  else if (serviceIdList.Count <= 128)
2889:                  {
2890:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2891:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2892:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2893:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on s.Id equals si select s.Id).ToList();
2894:                  }
2895:                  else if (serviceIdList.Count <= 160)
2896:                  {
2897:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2898:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2899:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2900:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2901:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on s.Id equals si select s.Id).ToList();
2902:                  }
2903:                  else if (serviceIdList.Count <= 192)
2904:                  {
2905:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2906:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2907:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2908:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2909:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(128, 32) on s.Id equals si select s.Id).ToList();
2910:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on s.Id equals si select s.Id).ToList();
2911:                  }
2912:                  else if (serviceIdList.Count <= 224)
2913:                  {
2914:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2915:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2916:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2917:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2918:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(128, 32) on s.Id equals si select s.Id).ToList();
2919:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(160, 32) on s.Id equals si select s.Id).ToList();
2920:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on s.Id equals si select s.Id).ToList();
2921:                  }
2922:                  else //if (serviceList.Count <= 256)
2923:                  {
2924:                      list = (from s in db.Service2s join si in serviceIdList.GetRange(0, 32) on s.Id equals si select s.Id).ToList();
2925:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(32, 32) on s.Id equals si select s.Id).ToList();
2926:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(64, 32) on s.Id equals si select s.Id).ToList();
2927:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(96, 32) on s.Id equals si select s.Id).ToList();
2928:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(128, 32) on s.Id equals si select s.Id).ToList();
2929:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(160, 32) on s.Id equals si select s.Id).ToList();
2930:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(192, 32) on s.Id equals si select s.Id).ToList();
2931:                      list = list.Union(from s in db.Service2s join si in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on s.Id equals si select s.Id).ToList();
2932:                  }
2933:              }
2934:   
2935:              return list.Distinct().ToList();
2936:          }
2937:   
2938:          ////////////////////////////////////////////////////////////////////////////
2939:   
2940:          /// <summary>
2941:          /// 
2942:          /// </summary>
2943:          public static List<string> ServiceIdListFromServiceList(List<string> serviceList)
2944:          {
2945:              List<string> list;
2946:   
2947:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
2948:              {
2949:                  if (serviceList.Count == 1)
2950:                  {
2951:                      var service = serviceList[0];
2952:                      list = (from s in db.Service2s where s.Service == service select s.Id).ToList();
2953:                  }
2954:                  else if (serviceList.Count <= 32)
2955:                  {
2956:                      list = (from s in db.Service2s join si in serviceList on s.Service equals si select s.Id).ToList();
2957:                  }
2958:                  else if (serviceList.Count <= 64)
2959:                  {
2960:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2961:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, serviceList.Count - 32 - 1) on s.Service equals si select s.Id).ToList();
2962:                  }
2963:                  else if (serviceList.Count <= 96)
2964:                  {
2965:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2966:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2967:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, serviceList.Count - 64 - 1) on s.Service equals si select s.Id).ToList();
2968:                  }
2969:                  else if (serviceList.Count <= 128)
2970:                  {
2971:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2972:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2973:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2974:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, serviceList.Count - 96 - 1) on s.Service equals si select s.Id).ToList();
2975:                  }
2976:                  else if (serviceList.Count <= 160)
2977:                  {
2978:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2979:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2980:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2981:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2982:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, serviceList.Count - 128 - 1) on s.Service equals si select s.Id).ToList();
2983:                  }
2984:                  else if (serviceList.Count <= 192)
2985:                  {
2986:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2987:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2988:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2989:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2990:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
2991:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, serviceList.Count - 160 - 1) on s.Service equals si select s.Id).ToList();
2992:                  }
2993:                  else if (serviceList.Count <= 224)
2994:                  {
2995:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
2996:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
2997:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
2998:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
2999:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
3000:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
3001:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, serviceList.Count - 192 - 1) on s.Service equals si select s.Id).ToList();
3002:                  }
3003:                  else //if (serviceList.Count <= 256)
3004:                  {
3005:                      list = (from s in db.Service2s join si in serviceList.GetRange(0, 32) on s.Service equals si select s.Id).ToList();
3006:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(32, 32) on s.Service equals si select s.Id).ToList();
3007:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(64, 32) on s.Service equals si select s.Id).ToList();
3008:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(96, 32) on s.Service equals si select s.Id).ToList();
3009:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(128, 32) on s.Service equals si select s.Id).ToList();
3010:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(160, 32) on s.Service equals si select s.Id).ToList();
3011:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(192, 32) on s.Service equals si select s.Id).ToList();
3012:                      list = list.Union(from s in db.Service2s join si in serviceList.GetRange(224, serviceList.Count - 224 - 1) on s.Service equals si select s.Id).ToList();
3013:                  }
3014:              }
3015:   
3016:              return list.Distinct().ToList();
3017:          }
3018:   
3019:          ////////////////////////////////////////////////////////////////////////////
3020:   
3021:          /// <summary>
3022:          /// 
3023:          /// </summary>
3024:          public static List<int> ReportIdListFromServiceList(List<string> serviceList)
3025:          {
3026:              List<int> list;
3027:   
3028:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
3029:              // <type id="2" name="Ont Name" arabicName=""/>
3030:   
3031:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3032:              {
3033:                  if (serviceList.Count == 1)
3034:                  {
3035:                      var service = serviceList[0];
3036:                      list = (from r in db.Reports where r.Service == service select r.Id).ToList();
3037:                  }
3038:                  else if (serviceList.Count <= 32)
3039:                  {
3040:                      list = (from r in db.Reports join s in serviceList on r.Service equals s select r.Id).ToList();
3041:                  }
3042:                  else if (serviceList.Count <= 64)
3043:                  {
3044:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3045:                      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();
3046:                  }
3047:                  else if (serviceList.Count <= 96)
3048:                  {
3049:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3050:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3051:                      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();
3052:                  }
3053:                  else if (serviceList.Count <= 128)
3054:                  {
3055:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3056:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3057:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3058:                      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();
3059:                  }
3060:                  else if (serviceList.Count <= 160)
3061:                  {
3062:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3063:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3064:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3065:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3066:                      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();
3067:                  }
3068:                  else if (serviceList.Count <= 192)
3069:                  {
3070:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3071:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3072:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3073:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3074:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3075:                      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();
3076:                  }
3077:                  else if (serviceList.Count <= 224)
3078:                  {
3079:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3080:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3081:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3082:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3083:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3084:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3085:                      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();
3086:                  }
3087:                  else //if (serviceList.Count <= 256)
3088:                  {
3089:                      list = (from r in db.Reports join s in serviceList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3090:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3091:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3092:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3093:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3094:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3095:                      list = list.Union(from r in db.Reports join s in serviceList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
3096:                      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();
3097:                  }
3098:              }
3099:   
3100:              return list.Distinct().ToList();
3101:          }
3102:   
3103:          ////////////////////////////////////////////////////////////////////////////
3104:   
3105:          /// <summary>
3106:          /// 
3107:          /// </summary>
3108:          public static List<int> ReportIdListFromAccessIdList(List<string> accessIdList)
3109:          {
3110:              string accessName;
3111:              List<string> accessNameList;
3112:              List<int> list;
3113:   
3114:              //reportIdList = (from r in db.Reports where r.Service == accessName && r.ServiceType == 2 select r.Id).Distinct().ToList();
3115:              // <type id="2" name="Ont Name" arabicName=""/>
3116:   
3117:              var ontAccessIdToOntAccessNameDictionary = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary;
3118:   
3119:              accessNameList = new List<string>();
3120:   
3121:              foreach (var id in accessIdList)
3122:              {
3123:                  if (ontAccessIdToOntAccessNameDictionary.ContainsKey(id))
3124:                  {
3125:                      accessName = ontAccessIdToOntAccessNameDictionary[id];
3126:   
3127:                      accessNameList.Add(accessName);
3128:                  }
3129:              }
3130:   
3131:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3132:              {
3133:                  if (accessNameList.Count == 1)
3134:                  {
3135:                      var accessName2 = accessNameList[0];
3136:                      list = (from r in db.Reports where r.Service == accessName2 select r.Id).ToList();
3137:                  }
3138:                  else if (accessNameList.Count <= 32)
3139:                  {
3140:                      list = (from r in db.Reports join s in accessNameList on r.Service equals s select r.Id).ToList();
3141:                  }
3142:                  else if (accessNameList.Count <= 64)
3143:                  {
3144:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3145:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, accessNameList.Count - 32 - 1) on r.Service equals s select r.Id).ToList();
3146:                  }
3147:                  else if (accessNameList.Count <= 96)
3148:                  {
3149:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3150:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3151:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, accessNameList.Count - 64 - 1) on r.Service equals s select r.Id).ToList();
3152:                  }
3153:                  else if (accessNameList.Count <= 128)
3154:                  {
3155:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3156:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3157:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3158:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, accessNameList.Count - 96 - 1) on r.Service equals s select r.Id).ToList();
3159:                  }
3160:                  else if (accessNameList.Count <= 160)
3161:                  {
3162:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3163:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3164:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3165:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3166:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, accessNameList.Count - 128 - 1) on r.Service equals s select r.Id).ToList();
3167:                  }
3168:                  else if (accessNameList.Count <= 192)
3169:                  {
3170:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3171:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3172:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3173:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3174:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3175:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(160, accessNameList.Count - 160 - 1) on r.Service equals s select r.Id).ToList();
3176:                  }
3177:                  else if (accessNameList.Count <= 224)
3178:                  {
3179:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3180:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3181:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3182:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3183:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3184:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3185:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(192, accessNameList.Count - 192 - 1) on r.Service equals s select r.Id).ToList();
3186:                  }
3187:                  else //if (serviceList.Count <= 256)
3188:                  {
3189:                      list = (from r in db.Reports join s in accessNameList.GetRange(0, 32) on r.Service equals s select r.Id).ToList();
3190:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(32, 32) on r.Service equals s select r.Id).ToList();
3191:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(64, 32) on r.Service equals s select r.Id).ToList();
3192:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(96, 32) on r.Service equals s select r.Id).ToList();
3193:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(128, 32) on r.Service equals s select r.Id).ToList();
3194:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(160, 32) on r.Service equals s select r.Id).ToList();
3195:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(192, 32) on r.Service equals s select r.Id).ToList();
3196:                      list = list.Union(from r in db.Reports join s in accessNameList.GetRange(224, accessNameList.Count - 224 - 1) on r.Service equals s select r.Id).ToList();
3197:                  }
3198:              }
3199:   
3200:              return list.Distinct().ToList();
3201:          }
3202:   
3203:          ////////////////////////////////////////////////////////////////////////////
3204:   
3205:          /// <summary>
3206:          /// 
3207:          /// </summary>
3208:          public static List<string> ServiceIdListFromAccessIdList(List<string> accessIdList)
3209:          {
3210:              List<string> list;
3211:   
3212:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3213:              {
3214:                  list = (from s in db.Service2s
3215:                          join aid in accessIdList on s.Access.Id equals aid
3216:                          /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
3217:                          select new Ia.Ngn.Cl.Model.Ui.Service2() { Id = s.Id }.Id).ToList();
3218:              }
3219:   
3220:              return list.Distinct().ToList();
3221:          }
3222:   
3223:          ////////////////////////////////////////////////////////////////////////////
3224:   
3225:          /// <summary>
3226:          /// 
3227:          /// </summary>
3228:          public static List<string> AccessIdListFromServiceIdList(List<string> serviceIdList)
3229:          {
3230:              List<string> list;
3231:   
3232:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3233:              {
3234:                  list = (from s in db.Service2s
3235:                          join si in serviceIdList on s.Id equals si
3236:                          /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
3237:                          where s.Access != null
3238:                          select s.Access.Id).ToList();
3239:              }
3240:   
3241:              return list.Distinct().ToList();
3242:          }
3243:   
3244:          ////////////////////////////////////////////////////////////////////////////
3245:   
3246:          /// <summary>
3247:          /// 
3248:          /// </summary>
3249:          public static List<string> AccessIdListFromServiceList(List<string> serviceList)
3250:          {
3251:              List<string> list;
3252:   
3253:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3254:              {
3255:                  list = (from s in db.Service2s
3256:                          join si in serviceList on s.Service equals si
3257:                          /*where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService*/
3258:                          where s.Access != null
3259:                          select s.Access.Id).ToList();
3260:              }
3261:   
3262:              return list.Distinct().ToList();
3263:          }
3264:   
3265:          ////////////////////////////////////////////////////////////////////////////
3266:   
3267:          /// <summary>
3268:          /// 
3269:          /// </summary>
3270:          public static List<string> AccessIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
3271:          {
3272:              List<string> list;
3273:   
3274:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3275:              {
3276:                  list = (from srs in db.ServiceRequestServices join srsid in serviceRequestServiceIdList on srs.Id equals srsid where srs.Access != null select srs.Access.Id).ToList();
3277:              }
3278:   
3279:              return list.Distinct().ToList();
3280:          }
3281:   
3282:          ////////////////////////////////////////////////////////////////////////////
3283:   
3284:          /// <summary>
3285:          /// 
3286:          /// </summary>
3287:          public static List<string> ServiceRequestOntIdListFromAccessIdList(List<string> accessIdList)
3288:          {
3289:              List<string> list;
3290:   
3291:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3292:              {
3293:                  list = (from sro in db.ServiceRequestOnts join aid in accessIdList on sro.Access.Id equals aid select sro.Id).ToList();
3294:              }
3295:   
3296:              return list.Distinct().ToList();
3297:          }
3298:   
3299:          ////////////////////////////////////////////////////////////////////////////
3300:   
3301:          /// <summary>
3302:          /// 
3303:          /// </summary>
3304:          public static List<int> ServiceRequestIdListFromServiceList(List<string> serviceList)
3305:          {
3306:              List<int> list, numberList;
3307:   
3308:              if (serviceList.Count > 0)
3309:              {
3310:                  numberList = new List<int>();
3311:   
3312:                  foreach (string s in serviceList)
3313:                  {
3314:                      if (int.TryParse(s, out int i)) numberList.Add(i);
3315:                  }
3316:   
3317:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3318:                  {
3319:                      if (numberList.Count == 1)
3320:                      {
3321:                          var number = numberList[0];
3322:                          list = (from sr in db.ServiceRequests where sr.Number == number select sr.Id).ToList();
3323:                      }
3324:                      else if (numberList.Count <= 32)
3325:                      {
3326:                          list = (from sr in db.ServiceRequests join srsid in numberList on sr.Number equals srsid select sr.Id).ToList();
3327:                      }
3328:                      else if (numberList.Count <= 64)
3329:                      {
3330:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3331:                          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();
3332:                      }
3333:                      else if (numberList.Count <= 96)
3334:                      {
3335:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3336:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3337:                          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();
3338:                      }
3339:                      else if (numberList.Count <= 128)
3340:                      {
3341:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3342:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3343:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3344:                          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();
3345:                      }
3346:                      else if (numberList.Count <= 160)
3347:                      {
3348:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3349:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3350:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3351:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3352:                          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();
3353:                      }
3354:                      else if (numberList.Count <= 192)
3355:                      {
3356:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3357:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3358:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3359:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3360:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
3361:                          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();
3362:                      }
3363:                      else if (numberList.Count <= 224)
3364:                      {
3365:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3366:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3367:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3368:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3369:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
3370:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, 32) on sr.Number equals srsid select sr.Id).ToList();
3371:                          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();
3372:                      }
3373:                      else //if (numberList.Count <= 256)
3374:                      {
3375:                          list = (from sr in db.ServiceRequests join srsid in numberList.GetRange(0, 32) on sr.Number equals srsid select sr.Id).ToList();
3376:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(32, 32) on sr.Number equals srsid select sr.Id).ToList();
3377:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(64, 32) on sr.Number equals srsid select sr.Id).ToList();
3378:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(96, 32) on sr.Number equals srsid select sr.Id).ToList();
3379:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(128, 32) on sr.Number equals srsid select sr.Id).ToList();
3380:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(160, 32) on sr.Number equals srsid select sr.Id).ToList();
3381:                          list = list.Union(from sr in db.ServiceRequests join srsid in numberList.GetRange(192, 32) on sr.Number equals srsid select sr.Id).ToList();
3382:                          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();
3383:                      }
3384:                  }
3385:              }
3386:              else
3387:              {
3388:                  list = new List<int>();
3389:              }
3390:   
3391:              return list.Distinct().ToList();
3392:          }
3393:   
3394:          ////////////////////////////////////////////////////////////////////////////
3395:   
3396:          /// <summary>
3397:          /// 
3398:          /// </summary>
3399:          public static List<int> ServiceRequestIdListFromServiceAndChangedAndChangedToList(List<string> serviceList)
3400:          {
3401:              List<int> list, numberList, changedList;
3402:   
3403:              if (serviceList.Count > 0)
3404:              {
3405:                  numberList = new List<int>();
3406:   
3407:                  foreach (string s in serviceList)
3408:                  {
3409:                      if (int.TryParse(s, out int i)) numberList.Add(i);
3410:                  }
3411:   
3412:                  changedList = Ia.Ngn.Cl.Model.Data.ServiceRequest.NumberAndChangedAndChangedToList(numberList);
3413:   
3414:                  if (changedList.Count != numberList.Count)
3415:                  {
3416:                      serviceList = (from n in changedList select n.ToString()).ToList();
3417:   
3418:                      list = Ia.Ngn.Cl.Model.Data.Maintenance.Find.ServiceRequestIdListFromServiceList(serviceList);
3419:                  }
3420:                  else
3421:                  {
3422:                      list = new List<int>();
3423:                  }
3424:              }
3425:              else
3426:              {
3427:                  list = new List<int>();
3428:              }
3429:   
3430:              return list.Distinct().ToList();
3431:          }
3432:   
3433:          ////////////////////////////////////////////////////////////////////////////
3434:   
3435:          /// <summary>
3436:          /// 
3437:          /// </summary>
3438:          public static List<int> ServiceRequestIdListFromServiceRequestServiceIdList(List<string> serviceRequestServiceIdList)
3439:          {
3440:              List<int> list;
3441:   
3442:              if (serviceRequestServiceIdList.Count > 0)
3443:              {
3444:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3445:                  {
3446:                      if (serviceRequestServiceIdList.Count == 1)
3447:                      {
3448:                          var serviceRequestServiceId = serviceRequestServiceIdList[0];
3449:                          list = (from sr in db.ServiceRequests where sr.ServiceRequestService.Id == serviceRequestServiceId select sr.Id).ToList();
3450:                      }
3451:                      else if (serviceRequestServiceIdList.Count <= 32)
3452:                      {
3453:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3454:                      }
3455:                      else if (serviceRequestServiceIdList.Count <= 64)
3456:                      {
3457:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3458:                          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();
3459:                      }
3460:                      else if (serviceRequestServiceIdList.Count <= 96)
3461:                      {
3462:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3463:                          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();
3464:                          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();
3465:                      }
3466:                      else if (serviceRequestServiceIdList.Count <= 128)
3467:                      {
3468:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3469:                          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();
3470:                          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();
3471:                          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();
3472:                      }
3473:                      else if (serviceRequestServiceIdList.Count <= 160)
3474:                      {
3475:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3476:                          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();
3477:                          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();
3478:                          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();
3479:                          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();
3480:                      }
3481:                      else if (serviceRequestServiceIdList.Count <= 192)
3482:                      {
3483:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3484:                          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();
3485:                          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();
3486:                          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();
3487:                          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();
3488:                          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();
3489:                      }
3490:                      else if (serviceRequestServiceIdList.Count <= 224)
3491:                      {
3492:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3493:                          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();
3494:                          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();
3495:                          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();
3496:                          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();
3497:                          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();
3498:                          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();
3499:                      }
3500:                      else //if (serviceList.Count <= 256)
3501:                      {
3502:                          list = (from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(0, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3503:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(32, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3504:                          list = list.Union(from sr in db.ServiceRequests join srsid in serviceRequestServiceIdList.GetRange(64, 32) on sr.ServiceRequestService.Id equals srsid select sr.Id).ToList();
3505:                          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();
3506:                          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();
3507:                          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();
3508:                          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();
3509:                          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();
3510:                      }
3511:                  }
3512:              }
3513:              else
3514:              {
3515:                  list = new List<int>();
3516:              }
3517:   
3518:              return list.Distinct().ToList();
3519:          }
3520:   
3521:          ////////////////////////////////////////////////////////////////////////////
3522:   
3523:          /// <summary>
3524:          /// 
3525:          /// </summary>
3526:          public static List<string> ServiceRequestAdministrativeIssueIdListFromServiceIdList(List<string> serviceIdList)
3527:          {
3528:              List<string> list;
3529:   
3530:              if (serviceIdList.Count > 0)
3531:              {
3532:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3533:                  {
3534:                      if (serviceIdList.Count == 1)
3535:                      {
3536:                          var serviceId = serviceIdList[0];
3537:                          list = (from srai in db.ServiceRequestAdministrativeIssues where srai.Id == serviceId select srai.Id).ToList();
3538:                      }
3539:                      else if (serviceIdList.Count <= 32)
3540:                      {
3541:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList on srai.Id equals sid select srai.Id).ToList();
3542:                      }
3543:                      else if (serviceIdList.Count <= 64)
3544:                      {
3545:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3546:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, serviceIdList.Count - 32 - 1) on srai.Id equals sid select srai.Id).ToList();
3547:                      }
3548:                      else if (serviceIdList.Count <= 96)
3549:                      {
3550:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3551:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3552:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, serviceIdList.Count - 64 - 1) on srai.Id equals sid select srai.Id).ToList();
3553:                      }
3554:                      else if (serviceIdList.Count <= 128)
3555:                      {
3556:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3557:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3558:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3559:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, serviceIdList.Count - 96 - 1) on srai.Id equals sid select srai.Id).ToList();
3560:                      }
3561:                      else if (serviceIdList.Count <= 160)
3562:                      {
3563:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3564:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3565:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3566:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3567:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, serviceIdList.Count - 128 - 1) on srai.Id equals sid select srai.Id).ToList();
3568:                      }
3569:                      else if (serviceIdList.Count <= 192)
3570:                      {
3571:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3572:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3573:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3574:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3575:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, 32) on srai.Id equals sid select srai.Id).ToList();
3576:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(160, serviceIdList.Count - 160 - 1) on srai.Id equals sid select srai.Id).ToList();
3577:                      }
3578:                      else if (serviceIdList.Count <= 224)
3579:                      {
3580:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3581:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3582:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3583:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3584:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, 32) on srai.Id equals sid select srai.Id).ToList();
3585:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(160, 32) on srai.Id equals sid select srai.Id).ToList();
3586:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(192, serviceIdList.Count - 192 - 1) on srai.Id equals sid select srai.Id).ToList();
3587:                      }
3588:                      else //if (serviceList.Count <= 256)
3589:                      {
3590:                          list = (from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(0, 32) on srai.Id equals sid select srai.Id).ToList();
3591:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(32, 32) on srai.Id equals sid select srai.Id).ToList();
3592:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(64, 32) on srai.Id equals sid select srai.Id).ToList();
3593:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(96, 32) on srai.Id equals sid select srai.Id).ToList();
3594:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(128, 32) on srai.Id equals sid select srai.Id).ToList();
3595:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(160, 32) on srai.Id equals sid select srai.Id).ToList();
3596:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(192, 32) on srai.Id equals sid select srai.Id).ToList();
3597:                          list = list.Union(from srai in db.ServiceRequestAdministrativeIssues join sid in serviceIdList.GetRange(224, serviceIdList.Count - 224 - 1) on srai.Id equals sid select srai.Id).ToList();
3598:                      }
3599:                  }
3600:              }
3601:              else
3602:              {
3603:                  list = new List<string>();
3604:              }
3605:   
3606:              return list.Distinct().ToList();
3607:          }
3608:   
3609:          ////////////////////////////////////////////////////////////////////////////
3610:   
3611:          /// <summary>
3612:          /// 
3613:          /// </summary>
3614:          public static List<string> ServiceRequestHistoryIdListFromServiceList(List<string> serviceList)
3615:          {
3616:              List<int> numberList;
3617:              List<string> list;
3618:   
3619:              if (serviceList.Count > 0)
3620:              {
3621:                  numberList = new List<int>();
3622:   
3623:                  foreach (string s in serviceList)
3624:                  {
3625:                      if (int.TryParse(s, out int i)) numberList.Add(i);
3626:                  }
3627:   
3628:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
3629:                  {
3630:                      if (serviceList.Count == 1)
3631:                      {
3632:                          var number = numberList[0];
3633:                          list = (from srh in db.ServiceRequestHistories where srh.Number == number select srh.Id).ToList();
3634:                      }
3635:                      else if (serviceList.Count <= 32)
3636:                      {
3637:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList on srh.Number equals srsid select srh.Id).ToList();
3638:                      }
3639:                      else if (serviceList.Count <= 64)
3640:                      {
3641:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3642:                          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();
3643:                      }
3644:                      else if (serviceList.Count <= 96)
3645:                      {
3646:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3647:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3648:                          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();
3649:                      }
3650:                      else if (serviceList.Count <= 128)
3651:                      {
3652:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3653:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3654:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3655:                          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();
3656:                      }
3657:                      else if (serviceList.Count <= 160)
3658:                      {
3659:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3660:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3661:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3662:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3663:                          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();
3664:                      }
3665:                      else if (serviceList.Count <= 192)
3666:                      {
3667:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3668:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3669:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3670:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3671:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
3672:                          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();
3673:                      }
3674:                      else if (serviceList.Count <= 224)
3675:                      {
3676:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3677:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3678:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3679:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3680:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
3681:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, 32) on srh.Number equals srsid select srh.Id).ToList();
3682:                          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();
3683:                      }
3684:                      else //if (serviceList.Count <= 256)
3685:                      {
3686:                          list = (from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(0, 32) on srh.Number equals srsid select srh.Id).ToList();
3687:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(32, 32) on srh.Number equals srsid select srh.Id).ToList();
3688:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(64, 32) on srh.Number equals srsid select srh.Id).ToList();
3689:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(96, 32) on srh.Number equals srsid select srh.Id).ToList();
3690:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(128, 32) on srh.Number equals srsid select srh.Id).ToList();
3691:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(160, 32) on srh.Number equals srsid select srh.Id).ToList();
3692:                          list = list.Union(from srh in db.ServiceRequestHistories join srsid in numberList.GetRange(192, 32) on srh.Number equals srsid select srh.Id).ToList();
3693:                          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();
3694:                      }
3695:                  }
3696:              }
3697:              else
3698:              {
3699:                  list = new List<string>();
3700:              }
3701:   
3702:              return list.Distinct().ToList();
3703:          }
3704:   
3705:          ////////////////////////////////////////////////////////////////////////////
3706:   
3707:          /// <summary>
3708:          /// 
3709:          /// </summary>
3710:          public static List<int> ServiceRequestTypeIdListFromServiceRequestIdList(List<int> serviceRequestIdList)
3711:          {
3712:              List<int> list;
3713:   
3714:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
3715:              {
3716:                  if (serviceRequestIdList.Count == 1)
3717:                  {
3718:                      var serviceRequestId = serviceRequestIdList[0];
3719:                      list = (from srt in db.ServiceRequestTypes where srt.ServiceRequest.Id == serviceRequestId select srt.Id).ToList();
3720:                  }
3721:                  else if (serviceRequestIdList.Count <= 32)
3722:                  {
3723:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3724:                  }
3725:                  else if (serviceRequestIdList.Count <= 64)
3726:                  {
3727:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3728:                      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();
3729:                  }
3730:                  else if (serviceRequestIdList.Count <= 96)
3731:                  {
3732:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3733:                      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();
3734:                      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();
3735:                  }
3736:                  else if (serviceRequestIdList.Count <= 128)
3737:                  {
3738:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3739:                      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();
3740:                      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();
3741:                      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();
3742:                  }
3743:                  else if (serviceRequestIdList.Count <= 160)
3744:                  {
3745:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3746:                      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();
3747:                      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();
3748:                      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();
3749:                      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();
3750:                  }
3751:                  else if (serviceRequestIdList.Count <= 192)
3752:                  {
3753:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3754:                      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();
3755:                      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();
3756:                      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();
3757:                      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();
3758:                      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();
3759:                  }
3760:                  else if (serviceRequestIdList.Count <= 224)
3761:                  {
3762:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3763:                      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();
3764:                      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();
3765:                      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();
3766:                      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();
3767:                      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();
3768:                      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();
3769:                  }
3770:                  else if (serviceRequestIdList.Count <= 256)
3771:                  {
3772:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3773:                      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();
3774:                      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();
3775:                      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();
3776:                      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();
3777:                      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();
3778:                      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();
3779:                      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();
3780:                  }
3781:                  else if (serviceRequestIdList.Count <= 288)
3782:                  {
3783:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3784:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3785:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3786:                      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();
3787:                      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();
3788:                      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();
3789:                      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();
3790:                      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();
3791:                      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();
3792:                  }
3793:                  else if (serviceRequestIdList.Count <= 320)
3794:                  {
3795:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3796:                      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();
3797:                      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();
3798:                      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();
3799:                      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();
3800:                      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();
3801:                      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();
3802:                      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();
3803:                      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();
3804:                      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();
3805:                  }
3806:                  else if (serviceRequestIdList.Count <= 352)
3807:                  {
3808:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3809:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3810:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3811:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3812:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3813:                      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();
3814:                      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();
3815:                      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();
3816:                      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();
3817:                      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();
3818:                      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();
3819:                  }
3820:                  else if (serviceRequestIdList.Count <= 384)
3821:                  {
3822:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3823:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3824:                      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();
3825:                      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();
3826:                      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();
3827:                      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();
3828:                      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();
3829:                      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();
3830:                      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();
3831:                      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();
3832:                      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();
3833:                      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();
3834:                  }
3835:                  else if (serviceRequestIdList.Count <= 416)
3836:                  {
3837:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3838:                      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();
3839:                      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();
3840:                      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();
3841:                      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();
3842:                      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();
3843:                      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();
3844:                      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();
3845:                      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();
3846:                      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();
3847:                      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();
3848:                      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();
3849:                      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();
3850:                  }
3851:                  else if (serviceRequestIdList.Count <= 448)
3852:                  {
3853:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3854:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3855:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3856:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3857:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3858:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3859:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3860:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3861:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(256, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3862:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(288, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3863:                      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();
3864:                      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();
3865:                      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();
3866:                      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();
3867:                  }
3868:                  else if (serviceRequestIdList.Count <= 480)
3869:                  {
3870:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3871:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3872:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3873:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3874:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3875:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3876:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(192, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3877:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(224, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3878:                      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();
3879:                      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();
3880:                      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();
3881:                      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();
3882:                      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();
3883:                      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();
3884:                      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();
3885:                  }
3886:                  else if (serviceRequestIdList.Count <= 512)
3887:                  {
3888:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3889:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3890:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3891:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3892:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(128, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3893:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(160, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3894:                      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();
3895:                      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();
3896:                      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();
3897:                      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();
3898:                      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();
3899:                      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();
3900:                      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();
3901:                      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();
3902:                      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();
3903:                      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();
3904:                  }
3905:                  else if (serviceRequestIdList.Count <= 544)
3906:                  {
3907:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3908:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3909:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(64, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3910:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(96, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3911:                      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();
3912:                      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();
3913:                      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();
3914:                      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();
3915:                      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();
3916:                      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();
3917:                      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();
3918:                      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();
3919:                      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();
3920:                      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();
3921:                      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();
3922:                      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();
3923:                      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();
3924:                  }
3925:                  else //if (serviceRequestIdList.Count <= ??)
3926:                  {
3927:                      list = (from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(0, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3928:                      list = list.Union(from srt in db.ServiceRequestTypes join srid in serviceRequestIdList.GetRange(32, 32) on srt.ServiceRequest.Id equals srid select srt.Id).ToList();
3929:                      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();
3930:                      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();
3931:                      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();
3932:                      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();
3933:                      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();
3934:                      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();
3935:                      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();
3936:                      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();
3937:                      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();
3938:                      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();
3939:                      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();
3940:                      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();
3941:                      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();
3942:                      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();
3943:                      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();
3944:                      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();
3945:                  }
3946:              }
3947:   
3948:              return list.Distinct().ToList();
3949:          }
3950:   
3951:          ////////////////////////////////////////////////////////////////////////////
3952:   
3953:          /// <summary>
3954:          /// 
3955:          /// </summary>
3956:          public static List<string> NddOntIdList(int oltId, int ponNumber, int ontInternalNumber)
3957:          {
3958:              List<string> list;
3959:   
3960:              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();
3961:   
3962:              return list.Distinct().ToList();
3963:          }
3964:   
3965:          ////////////////////////////////////////////////////////////////////////////
3966:   
3967:          /// <summary>
3968:          /// 
3969:          /// </summary>
3970:          public static List<string> NddOntIdList(int oltId, int ponNumber)
3971:          {
3972:              List<string> list;
3973:   
3974:              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();
3975:   
3976:              return list.Distinct().ToList();
3977:          }
3978:   
3979:          ////////////////////////////////////////////////////////////////////////////
3980:   
3981:          /// <summary>
3982:          /// 
3983:          /// </summary>
3984:          public static List<string> NddOntIdListFromAccessIdList(List<string> accessIdList)
3985:          {
3986:              List<string> list;
3987:   
3988:              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();
3989:   
3990:              return list.Distinct().ToList();
3991:          }
3992:   
3993:          ////////////////////////////////////////////////////////////////////////////   
3994:   
3995:          /// <summary>
3996:          /// 
3997:          /// </summary>
3998:          public static List<string> NddOntIdListFromEmsOntSipInfoListAndEmsVoipPstnUserListByServiceList(List<string> serviceList)
3999:          {
4000:              string sipUserName, serviceWithCountryCode;
4001:              List<string> list, emsOntSipInfoEmsOntIdList, emsVoipPstnUserEmsOntIdList;
4002:              List<string> emsOntSipInfoSipUserNameList, emsVoipPstnUserDnList;
4003:   
4004:              emsOntSipInfoSipUserNameList = new List<string>();
4005:              emsVoipPstnUserDnList = new List<string>();
4006:   
4007:              foreach (var service in serviceList)
4008:              {
4009:                  sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
4010:                  emsOntSipInfoSipUserNameList.Add(sipUserName);
4011:   
4012:                  serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
4013:                  emsVoipPstnUserDnList.Add(serviceWithCountryCode);
4014:              }
4015:   
4016:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4017:              {
4018:                  emsOntSipInfoEmsOntIdList = (from eosi in db.EmsOntSipInfos
4019:                                               join eo in db.EmsOnts on eosi.EmsOnt.Id equals eo.Id
4020:                                               join eosisun in emsOntSipInfoSipUserNameList on eosi.SIPUSERNAME equals eosisun
4021:                                               select eo.Id).Distinct().ToList();
4022:   
4023:                  emsVoipPstnUserEmsOntIdList = (from evpu in db.EmsVoipPstnUsers
4024:                                                 join eo in db.EmsOnts on evpu.EmsOnt.Id equals eo.Id
4025:                                                 join evpud in emsVoipPstnUserDnList on evpu.DN equals evpud
4026:                                                 select eo.Id).Distinct().ToList();
4027:   
4028:                  list = emsOntSipInfoEmsOntIdList.Concat(emsVoipPstnUserEmsOntIdList).ToList();
4029:              }
4030:   
4031:              return list.Distinct().ToList();
4032:          }
4033:   
4034:          ////////////////////////////////////////////////////////////////////////////
4035:   
4036:          /// <summary>
4037:          /// 
4038:          /// </summary>
4039:          public static List<string> OntServiceVoipIpList(List<string> ontServiceVoipIdList)
4040:          {
4041:              List<string> list;
4042:   
4043:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4044:              {
4045:                  if (ontServiceVoipIdList.Count <= 32)
4046:                  {
4047:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList on osv.Id equals osvid select osv.Ip).ToList();
4048:                  }
4049:                  else
4050:                  {
4051:                      list = (from osv in db.OntServiceVoips join osvid in ontServiceVoipIdList.GetRange(0, 32) on osv.Id equals osvid select osv.Ip).ToList();
4052:                      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();
4053:                  }
4054:              }
4055:   
4056:              return list.Distinct().ToList();
4057:          }
4058:   
4059:          ////////////////////////////////////////////////////////////////////////////
4060:   
4061:          /// <summary>
4062:          /// 
4063:          /// </summary>
4064:          public static List<string> NddPonIpList(int oltId, int ponNumber)
4065:          {
4066:              var 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();
4067:   
4068:              return list.Distinct().ToList();
4069:          }
4070:   
4071:          ////////////////////////////////////////////////////////////////////////////
4072:   
4073:          /// <summary>
4074:          /// 
4075:          /// </summary>
4076:          public static List<string> OntIdListFromNddOntIdList(List<string> nddOntIdList)
4077:          {
4078:              List<string> list;
4079:   
4080:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4081:              {
4082:                  list = (from o in db.Onts join nid in nddOntIdList on o.Id equals nid select o.Id).ToList();
4083:              }
4084:   
4085:              return list.Distinct().ToList();
4086:          }
4087:   
4088:          ////////////////////////////////////////////////////////////////////////////
4089:   
4090:          /// <summary>
4091:          /// 
4092:          /// </summary>
4093:          public static List<string> OntOntPotsIdListFromOntIdList(List<string> ontIdList)
4094:          {
4095:              List<string> list;
4096:   
4097:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4098:              {
4099:                  list = (from oop in db.OntOntPotses join oid in ontIdList on oop.Ont.Id equals oid select oop.Id).ToList();
4100:              }
4101:   
4102:              return list.Distinct().ToList();
4103:          }
4104:   
4105:          ////////////////////////////////////////////////////////////////////////////
4106:   
4107:          /// <summary>
4108:          /// 
4109:          /// </summary>
4110:          public static List<string> OntServiceVoipsIdListFromOntIdList(List<string> ontIdList)
4111:          {
4112:              List<string> list;
4113:   
4114:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4115:              {
4116:                  list = (from ov in db.OntServiceVoips join oid in ontIdList on ov.Ont.Id equals oid select ov.Id).ToList();
4117:              }
4118:   
4119:              return list.Distinct().ToList();
4120:          }
4121:   
4122:          ////////////////////////////////////////////////////////////////////////////
4123:   
4124:          /// <summary>
4125:          /// 
4126:          /// </summary>
4127:          public static List<string> AccessIdListFromOntSerial(string serial)
4128:          {
4129:              List<string> list;
4130:   
4131:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4132:              {
4133:                  list = (from o in db.Onts where o.Serial == serial select o.Access.Id).ToList();
4134:              }
4135:   
4136:              return list.Distinct().ToList();
4137:          }
4138:   
4139:          ////////////////////////////////////////////////////////////////////////////
4140:   
4141:          /// <summary>
4142:          /// 
4143:          /// </summary>
4144:          public static List<string> AccessIdListFromEmsOntSerial(string serial)
4145:          {
4146:              List<string> list;
4147:   
4148:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4149:              {
4150:                  list = (from eo in db.EmsOnts where eo.SERIALNUM == serial select eo.Access.Id).ToList();
4151:              }
4152:   
4153:              return list.Distinct().ToList();
4154:          }
4155:   
4156:          ////////////////////////////////////////////////////////////////////////////
4157:   
4158:          /// <summary>
4159:          /// 
4160:          /// </summary>
4161:          public static List<string> AccessIdListFromEmsOntIp(string ip)
4162:          {
4163:              List<string> list;
4164:   
4165:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4166:              {
4167:                  list = (from eo in db.EmsOnts where eo.IP == ip select eo.Access.Id).ToList();
4168:              }
4169:   
4170:              return list.Distinct().ToList();
4171:          }
4172:   
4173:          ////////////////////////////////////////////////////////////////////////////
4174:   
4175:          /// <summary>
4176:          /// 
4177:          /// </summary>
4178:          public static List<string> OntServiceVoipsIdListFromIpList(List<string> ipList)
4179:          {
4180:              List<string> list;
4181:   
4182:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4183:              {
4184:                  list = (from ov in db.OntServiceVoips join npi in ipList on ov.Ip equals npi select ov.Id).ToList();
4185:              }
4186:   
4187:              return list.Distinct().ToList();
4188:          }
4189:   
4190:          ////////////////////////////////////////////////////////////////////////////
4191:   
4192:          /// <summary>
4193:          /// 
4194:          /// </summary>
4195:          public static List<long> EventIdListFromOntIdList(List<string> ontIdList)
4196:          {
4197:              List<long> list;
4198:   
4199:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4200:              {
4201:                  list = (from e in db.Events join oid in ontIdList on e.Ont.Id equals oid where e.Ont != null select e.Id).ToList();
4202:              }
4203:   
4204:              return list.Distinct().ToList();
4205:          }
4206:   
4207:          ////////////////////////////////////////////////////////////////////////////
4208:   
4209:          /// <summary>
4210:          /// 
4211:          /// </summary>
4212:          public static List<int> AgcfGatewayRecordIdListFromIpList(List<string> ipList)
4213:          {
4214:              List<int> list;
4215:   
4216:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4217:              {
4218:                  if (ipList.Count <= 32)
4219:                  {
4220:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList on gr.IP1 equals ip select gr.Id).ToList();
4221:                  }
4222:                  else
4223:                  {
4224:                      list = (from gr in db.AgcfGatewayRecords join ip in ipList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
4225:                      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();
4226:                  }
4227:              }
4228:   
4229:              return list.Distinct().ToList();
4230:          }
4231:   
4232:          ////////////////////////////////////////////////////////////////////////////
4233:   
4234:          /// <summary>
4235:          /// 
4236:          /// </summary>
4237:          public static List<int> AgcfGatewayRecordIdListFromNddOntIdList(List<string> nddOntIdlist)
4238:          {
4239:              List<int> list;
4240:              List<string> nddIpList;
4241:   
4242:              nddIpList = (from srsid in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList join nid in nddOntIdlist on srsid.Id equals nid select srsid.Ip).ToList();
4243:   
4244:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4245:              {
4246:                  if (nddOntIdlist.Count <= 32)
4247:                  {
4248:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList on gr.IP1 equals ip select gr.Id).ToList();
4249:                  }
4250:                  else
4251:                  {
4252:                      list = (from gr in db.AgcfGatewayRecords join ip in nddIpList.GetRange(0, 32) on gr.IP1 equals ip select gr.Id).ToList();
4253:                      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();
4254:                  }
4255:              }
4256:   
4257:              return list.Distinct().ToList();
4258:          }
4259:   
4260:          ////////////////////////////////////////////////////////////////////////////
4261:   
4262:          /// <summary>
4263:          /// 
4264:          /// </summary>
4265:          public static List<int> AgcfGatewayRecordIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
4266:          {
4267:              List<int> list;
4268:   
4269:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4270:              {
4271:                  if (agcfEndpointIdList.Count <= 32)
4272:                  {
4273:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
4274:                  }
4275:                  else
4276:                  {
4277:                      list = (from ep in db.AgcfEndpoints join epid in agcfEndpointIdList.GetRange(0, 32) on ep.Id equals epid select ep.AgcfGatewayRecord.Id).ToList();
4278:                      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();
4279:                  }
4280:              }
4281:   
4282:              return list.Distinct().ToList();
4283:          }
4284:   
4285:          ////////////////////////////////////////////////////////////////////////////
4286:   
4287:          /// <summary>
4288:          /// 
4289:          /// </summary>
4290:          public static List<string> AgcfEndpointIdListFromAgcfGatewayRecordIdList(List<int> agcfGatewayRecordIdList)
4291:          {
4292:              List<string> list;
4293:   
4294:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4295:              {
4296:                  list = (from e in db.AgcfEndpoints join grid in agcfGatewayRecordIdList on e.AgcfGatewayRecord.Id equals grid where e.AgcfGatewayRecord != null select e.Id).ToList();
4297:              }
4298:   
4299:              return list.Distinct().ToList();
4300:          }
4301:   
4302:          ////////////////////////////////////////////////////////////////////////////
4303:          ////////////////////////////////////////////////////////////////////////////
4304:   
4305:          /// <summary>
4306:          /// 
4307:          /// </summary>
4308:          public static List<string> MgwIdListFromAsbrIdList(List<string> asbrIdList)
4309:          {
4310:              List<string> list;
4311:   
4312:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4313:              {
4314:                  if (asbrIdList.Count <= 32)
4315:                  {
4316:                      list = (from m in db.Mgws
4317:                              join a in db.Asbrs on m.Id equals a.Mgw.Id
4318:                              join aid in asbrIdList on a.Id equals aid
4319:                              select m.Id).ToList();
4320:                  }
4321:                  else
4322:                  {
4323:                      list = (from m in db.Mgws
4324:                              join a in db.Asbrs on m.Id equals a.Mgw.Id
4325:                              join aid in asbrIdList.GetRange(0, 32) on a.Id equals aid
4326:                              select m.Id).ToList();
4327:   
4328:                      list = list.Union(from m in db.Mgws
4329:                                        join a in db.Asbrs on m.Id equals a.Mgw.Id
4330:                                        join aid in asbrIdList.GetRange(32, asbrIdList.Count - 32 - 1) on a.Id equals aid
4331:                                        select m.Id).ToList();
4332:                  }
4333:              }
4334:   
4335:              return list.Distinct().ToList();
4336:          }
4337:   
4338:          ////////////////////////////////////////////////////////////////////////////
4339:   
4340:          /// <summary>
4341:          /// 
4342:          /// </summary>
4343:          public static List<string> MgwIpListFromIdList(List<string> mgwIdList)
4344:          {
4345:              List<string> list;
4346:   
4347:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4348:              {
4349:                  if (mgwIdList.Count <= 32)
4350:                  {
4351:                      list = (from m in db.Mgws join mid in mgwIdList on m.Id equals mid select m.RA1).ToList();
4352:                  }
4353:                  else
4354:                  {
4355:                      list = (from m in db.Mgws join mid in mgwIdList.GetRange(0, 32) on m.Id equals mid select m.RA1).ToList();
4356:   
4357:                      list = list.Union(from m in db.Mgws join mid in mgwIdList.GetRange(32, mgwIdList.Count - 32 - 1) on m.Id equals mid select m.Id).ToList();
4358:                  }
4359:              }
4360:   
4361:              return list.Distinct().ToList();
4362:          }
4363:   
4364:          ////////////////////////////////////////////////////////////////////////////
4365:   
4366:          /// <summary>
4367:          /// 
4368:          /// </summary>
4369:          public static List<string> AsbrIdListFromImpuSipDomainList(List<string> impuSipDomainList)
4370:          {
4371:              string id;
4372:              List<string> list, asbrIdInTecAndSkbNetworkElementList;
4373:   
4374:              asbrIdInTecAndSkbNetworkElementList = new List<string>(impuSipDomainList.Count * 2);
4375:   
4376:              foreach(var isd in impuSipDomainList)
4377:              {
4378:                  id = Ia.Ngn.Cl.Model.Business.Huawei.Asbr.AsbrId(Ia.Ngn.Cl.Model.Business.Huawei.SoftX.TecNetworkElement.Domain, isd);
4379:                  asbrIdInTecAndSkbNetworkElementList.Add(id);
4380:   
4381:                  id = Ia.Ngn.Cl.Model.Business.Huawei.Asbr.AsbrId(Ia.Ngn.Cl.Model.Business.Huawei.SoftX.SkbNetworkElement.Domain, isd);
4382:                  asbrIdInTecAndSkbNetworkElementList.Add(id);
4383:              }
4384:   
4385:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4386:              {
4387:                  list = (from a in db.Asbrs join iid in asbrIdInTecAndSkbNetworkElementList on a.Id equals iid select a.Id).ToList();
4388:              }
4389:   
4390:              return list.Distinct().ToList();
4391:          }
4392:   
4393:          ////////////////////////////////////////////////////////////////////////////
4394:          ////////////////////////////////////////////////////////////////////////////
4395:   
4396:          /// <summary>
4397:          /// 
4398:          /// </summary>
4399:          public static List<string> AgcfEndpointIdListFromSubPartyIdList(List<string> subPartyIdList)
4400:          {
4401:              List<string> list;
4402:   
4403:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4404:              {
4405:                  list = (from sp in db.SubParties join spid in subPartyIdList on sp.Id equals spid select sp.AgcfEndpoint.Id).ToList();
4406:              }
4407:   
4408:              return list.Distinct().ToList();
4409:          }
4410:   
4411:          ////////////////////////////////////////////////////////////////////////////
4412:   
4413:          /// <summary>
4414:          /// 
4415:          /// </summary>
4416:          public static List<string> AgcfEndpointIdListFromPrividUserList(List<string> prividUserList)
4417:          {
4418:              List<string> list;
4419:   
4420:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4421:              {
4422:                  list = (from ep in db.AgcfEndpoints join pu in prividUserList on ep.PrividUser equals pu select ep.Id).ToList();
4423:              }
4424:   
4425:              return list.Distinct().ToList();
4426:          }
4427:   
4428:          ////////////////////////////////////////////////////////////////////////////
4429:   
4430:          /// <summary>
4431:          /// 
4432:          /// </summary>
4433:          public static List<string> SubPartyIdListFromAgcfEndpointIdList(List<string> agcfEndpointIdList)
4434:          {
4435:              List<string> list;
4436:   
4437:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4438:              {
4439:                  if (agcfEndpointIdList.Count == 1)
4440:                  {
4441:                      var agcfEndpointId = agcfEndpointIdList[0];
4442:                      list = (from sp in db.SubParties where sp.AgcfEndpoint != null && sp.AgcfEndpoint.Id == agcfEndpointId select sp.Id).ToList();
4443:                  }
4444:                  else if (agcfEndpointIdList.Count <= 32)
4445:                  {
4446:                      list = (from sp in db.SubParties join e in agcfEndpointIdList on sp.AgcfEndpoint.Id equals e where sp.AgcfEndpoint != null select sp.Id).ToList();
4447:                  }
4448:                  else if (agcfEndpointIdList.Count <= 64)
4449:                  {
4450:                      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();
4451:                      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();
4452:                  }
4453:                  else if (agcfEndpointIdList.Count <= 96)
4454:                  {
4455:                      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();
4456:                      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();
4457:                      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();
4458:                  }
4459:                  else //if (agcfEndpointIdList.Count <= 128)
4460:                  {
4461:                      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();
4462:                      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();
4463:                      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();
4464:                      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();
4465:                  }
4466:              }
4467:   
4468:              return list.Distinct().ToList();
4469:          }
4470:   
4471:          ////////////////////////////////////////////////////////////////////////////
4472:   
4473:          /// <summary>
4474:          /// 
4475:          /// </summary>
4476:          public static List<string> SubPartyIdListFromPartyIdList(List<string> partyIdList)
4477:          {
4478:              List<string> list;
4479:   
4480:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4481:              {
4482:                  if (partyIdList.Count == 1)
4483:                  {
4484:                      var partyId = partyIdList[0];
4485:                      list = (from sp in db.SubParties where sp.PartyId == partyId select sp.Id).ToList();
4486:                  }
4487:                  else if (partyIdList.Count <= 32)
4488:                  {
4489:                      list = (from sp in db.SubParties join pid in partyIdList on sp.PartyId equals pid select sp.Id).ToList();
4490:                  }
4491:                  else if (partyIdList.Count <= 64)
4492:                  {
4493:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
4494:                      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();
4495:                  }
4496:                  else if (partyIdList.Count <= 96)
4497:                  {
4498:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
4499:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
4500:                      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();
4501:                  }
4502:                  else //if (agcfEndpointIdList.Count <= 128)
4503:                  {
4504:                      list = (from sp in db.SubParties join pid in partyIdList.GetRange(0, 32) on sp.PartyId equals pid select sp.Id).ToList();
4505:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(32, 32) on sp.PartyId equals pid select sp.Id).ToList();
4506:                      list = list.Union(from sp in db.SubParties join pid in partyIdList.GetRange(64, 32) on sp.PartyId equals pid select sp.Id).ToList();
4507:                      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();
4508:                  }
4509:              }
4510:   
4511:              return list.Distinct().ToList();
4512:          }
4513:   
4514:          ////////////////////////////////////////////////////////////////////////////
4515:   
4516:          /// <summary>
4517:          /// 
4518:          /// </summary>
4519:          public static List<string> SubscriberIdListFromSubPartyIdList(List<string> subPartyIdList)
4520:          {
4521:              List<string> list;
4522:   
4523:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4524:              {
4525:                  if (subPartyIdList.Count == 1)
4526:                  {
4527:                      var subPartyId = subPartyIdList[0];
4528:                      list = (from s in db.Subscribers where s.SubParty != null && s.SubParty.Id == subPartyId select s.Id).ToList();
4529:                  }
4530:                  else if (subPartyIdList.Count <= 32)
4531:                  {
4532:                      list = (from s in db.Subscribers join spid in subPartyIdList on s.SubParty.Id equals spid select s.Id).ToList();
4533:                  }
4534:                  else if (subPartyIdList.Count <= 64)
4535:                  {
4536:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4537:                      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();
4538:                  }
4539:                  else if (subPartyIdList.Count <= 96)
4540:                  {
4541:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4542:                      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();
4543:                      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();
4544:                  }
4545:                  else //if (subPartyIdList.Count <= 128)
4546:                  {
4547:                      list = (from s in db.Subscribers join spid in subPartyIdList.GetRange(0, 32) on s.SubParty.Id equals spid select s.Id).ToList();
4548:                      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();
4549:                      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();
4550:                      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();
4551:                  }
4552:              }
4553:   
4554:              return list.Distinct().ToList();
4555:          }
4556:   
4557:          ////////////////////////////////////////////////////////////////////////////
4558:   
4559:          /// <summary>
4560:          /// 
4561:          /// </summary>
4562:          public static List<string> SubscriberIdListFromPartyIdList(List<string> partyIdList)
4563:          {
4564:              List<string> list;
4565:   
4566:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4567:              {
4568:                  if (partyIdList.Count == 1)
4569:                  {
4570:                      var partyId = partyIdList[0];
4571:                      list = (from s in db.Subscribers where s.PartyId == partyId select s.Id).ToList();
4572:                  }
4573:                  else if (partyIdList.Count <= 32)
4574:                  {
4575:                      list = (from s in db.Subscribers join pid in partyIdList on s.PartyId equals pid select s.Id).ToList();
4576:                  }
4577:                  else if (partyIdList.Count <= 64)
4578:                  {
4579:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
4580:                      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();
4581:                  }
4582:                  else if (partyIdList.Count <= 96)
4583:                  {
4584:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
4585:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
4586:                      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();
4587:                  }
4588:                  else //if (subPartyIdList.Count <= 128)
4589:                  {
4590:                      list = (from s in db.Subscribers join pid in partyIdList.GetRange(0, 32) on s.PartyId equals pid select s.Id).ToList();
4591:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(32, 32) on s.PartyId equals pid select s.Id).ToList();
4592:                      list = list.Union(from s in db.Subscribers join pid in partyIdList.GetRange(64, 32) on s.PartyId equals pid select s.Id).ToList();
4593:                      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();
4594:                  }
4595:              }
4596:   
4597:              return list.Distinct().ToList();
4598:          }
4599:   
4600:          ////////////////////////////////////////////////////////////////////////////
4601:          ////////////////////////////////////////////////////////////////////////////   
4602:   
4603:          /// <summary>
4604:          /// 
4605:          /// </summary>
4606:          public static void SynchronizeNumberFormatLists(ref List<string> partyIdList, ref List<string> prividUserList, ref List<string> serviceList, ref List<int> numberList, ref List<long> serviceLongList, ref List<string> impuSipDomainList, ref List<string> sipUserNameList, ref List<string> serviceWithCountryCodeList, ref List<string> serviceIdList)
4607:          {
4608:              int number;
4609:              long numberWithCountryCode;
4610:              string service, impuSipDomain, sipUserName, serviceWithCountryCode, partyId, prividUser;
4611:   
4612:              foreach (var pi in partyIdList)
4613:              {
4614:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(pi);
4615:   
4616:                  if (!string.IsNullOrEmpty(service))
4617:                  {
4618:                      number = int.Parse(service);
4619:                      numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
4620:                      impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
4621:                      sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
4622:                      serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
4623:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
4624:                      prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
4625:   
4626:                      serviceList.Add(service);
4627:                      numberList.Add(number);
4628:                      serviceLongList.Add(numberWithCountryCode);
4629:                      impuSipDomainList.Add(impuSipDomain);
4630:                      sipUserNameList.Add(sipUserName);
4631:                      serviceWithCountryCodeList.Add(serviceWithCountryCode);
4632:                      //partyIdList.Add(partyId);
4633:                      prividUserList.Add(prividUser);
4634:                  }
4635:              }
4636:   
4637:              foreach (var s in serviceList)
4638:              {
4639:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s);
4640:   
4641:                  if (!string.IsNullOrEmpty(service))
4642:                  {
4643:                      number = int.Parse(service);
4644:                      numberWithCountryCode = long.Parse(Ia.Ngn.Cl.Model.Business.Service.CountryCode.ToString() + number);
4645:                      impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
4646:                      sipUserName = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.SipUserName(service);
4647:                      serviceWithCountryCode = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
4648:                      partyId = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PartyId(service);
4649:                      prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
4650:   
4651:                      //serviceList.Add(service);
4652:                      numberList.Add(number);
4653:                      serviceLongList.Add(numberWithCountryCode);
4654:                      impuSipDomainList.Add(impuSipDomain);
4655:                      sipUserNameList.Add(sipUserName);
4656:                      serviceWithCountryCodeList.Add(serviceWithCountryCode);
4657:                      partyIdList.Add(partyId);
4658:                      prividUserList.Add(prividUser);
4659:                  }
4660:              }
4661:   
4662:              serviceList = serviceList.Distinct().ToList();
4663:              numberList = numberList.Distinct().ToList();
4664:              serviceLongList = serviceLongList.Distinct().ToList();
4665:              impuSipDomainList = impuSipDomainList.Distinct().ToList();
4666:              sipUserNameList = sipUserNameList.Distinct().ToList();
4667:              serviceWithCountryCodeList = serviceWithCountryCodeList.Distinct().ToList();
4668:              partyIdList = partyIdList.Distinct().ToList();
4669:              prividUserList = prividUserList.Distinct().ToList();
4670:   
4671:              serviceIdList = Ia.Ngn.Cl.Model.Business.Service.ServiceListToServiceIdListForAllServiceTypes(serviceList);
4672:          }
4673:   
4674:          ////////////////////////////////////////////////////////////////////////////   
4675:   
4676:          /// <summary>
4677:          /// 
4678:          /// </summary>
4679:          public static void UpdateServiceListFromServiceRequestServiceIdOrService2IdList(List<string> serviceRequestServiceIdListOrService2IdList, ref List<string> serviceList)
4680:          {
4681:              string service;
4682:   
4683:              foreach (var si in serviceRequestServiceIdListOrService2IdList)
4684:              {
4685:                  service = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceIdToService(si);
4686:   
4687:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4688:              }
4689:   
4690:              serviceList = serviceList.Distinct().ToList();
4691:          }
4692:   
4693:          ////////////////////////////////////////////////////////////////////////////   
4694:   
4695:          /// <summary>
4696:          /// 
4697:          /// </summary>
4698:          public static void CollectServiceListFromEmsOntSipInfoListAndEmsVoipPstnUserListByEmsOntIdList(List<string> emsOntIdList, ref List<string> serviceList)
4699:          {
4700:              string service;
4701:              List<string> emsOntSipInfoSipUserNameList, emsVoipPstnUserDnList;
4702:   
4703:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
4704:              {
4705:                  emsOntSipInfoSipUserNameList = (from eosi in db.EmsOntSipInfos join eoid in emsOntIdList on eosi.EmsOnt.Id equals eoid select eosi.SIPUSERNAME).Distinct().ToList();
4706:   
4707:                  emsVoipPstnUserDnList = (from evpu in db.EmsVoipPstnUsers join eoid in emsOntIdList on evpu.EmsOnt.Id equals eoid select evpu.DN).Distinct().ToList();
4708:              }
4709:   
4710:              foreach (var eosisun in emsOntSipInfoSipUserNameList)
4711:              {
4712:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(eosisun);
4713:   
4714:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4715:              }
4716:   
4717:              foreach (var evpud in emsVoipPstnUserDnList)
4718:              {
4719:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(evpud);
4720:   
4721:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4722:              }
4723:   
4724:              serviceList = serviceList.Distinct().ToList();
4725:          }
4726:   
4727:          ////////////////////////////////////////////////////////////////////////////   
4728:   
4729:          /// <summary>
4730:          /// 
4731:          /// </summary>
4732:          public static void CollectServiceListFromAgcfEndpointList(List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList, ref List<string> serviceList)
4733:          {
4734:              string service;
4735:   
4736:              foreach (var ep in agcfEndpointList)
4737:              {
4738:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(ep.PrividUser);
4739:   
4740:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4741:              }
4742:   
4743:              serviceList = serviceList.Distinct().ToList();
4744:          }
4745:   
4746:          ////////////////////////////////////////////////////////////////////////////   
4747:   
4748:          /// <summary>
4749:          /// 
4750:          /// </summary>
4751:          public static void CollectServiceListFromSubscriberList(List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList, ref List<string> serviceList)
4752:          {
4753:              string service;
4754:   
4755:              foreach (var s in subscriberList)
4756:              {
4757:                  service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(s.PartyId);
4758:   
4759:                  if (!string.IsNullOrEmpty(service)) serviceList.Add(service);
4760:              }
4761:   
4762:              serviceList = serviceList.Distinct().ToList();
4763:          }
4764:   
4765:          ////////////////////////////////////////////////////////////////////////////
4766:          ////////////////////////////////////////////////////////////////////////////   
4767:      }
4768:   
4769:      ////////////////////////////////////////////////////////////////////////////
4770:      ////////////////////////////////////////////////////////////////////////////   
4771:  }