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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Find

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

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

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