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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Find

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

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

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