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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » ServiceRequestService

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

Service Request Service support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections;
   3:  using System.Collections.Generic;
   4:  using System.Linq;
   5:  using System.Web;
   6:  using System.ComponentModel.DataAnnotations;
   7:  using System.ComponentModel.DataAnnotations.Schema;
   8:  using System.Data;
   9:  using System.Text;
  10:   
  11:  namespace Ia.Ngn.Cl.Model.Business
  12:  {
  13:      ////////////////////////////////////////////////////////////////////////////
  14:   
  15:      /// <summary publish="true">
  16:      /// Service Request Service support class of Next Generation Network'a (NGN's) business model.
  17:      /// </summary>
  18:      /// 
  19:      /// <remarks> 
  20:      /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  21:      ///
  22:      /// 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
  23:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  24:      ///
  25:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  26:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  27:      /// 
  28:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  29:      /// 
  30:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  31:      /// </remarks> 
  32:      public partial class ServiceRequestService
  33:      {
  34:          private static StringBuilder log = new StringBuilder();
  35:   
  36:          ////////////////////////////////////////////////////////////////////////////
  37:   
  38:          /// <summary>
  39:          ///
  40:          /// </summary>
  41:          public enum ServiceRequestServiceType { Create = 1, Read, Update, Delete };
  42:   
  43:          ////////////////////////////////////////////////////////////////////////////
  44:   
  45:          /// <summary>
  46:          ///
  47:          /// </summary>
  48:          public ServiceRequestService() { }
  49:   
  50:          ////////////////////////////////////////////////////////////////////////////
  51:   
  52:          /// <summary>
  53:          ///
  54:          /// </summary>
  55:          public static string ServiceIdToService(string service)
  56:          {
  57:              return Ia.Ngn.Cl.Model.Business.Service.ServiceIdToService(service);
  58:          }
  59:   
  60:          ////////////////////////////////////////////////////////////////////////////
  61:   
  62:          /// <summary>
  63:          ///
  64:          /// </summary>
  65:          public static string ServiceRequestServiceId(string service, int serviceType)
  66:          {
  67:              // below:
  68:              string id;
  69:   
  70:              id = Ia.Ngn.Cl.Model.Business.Service2.ServiceId(service, serviceType);
  71:   
  72:              return id;
  73:          }
  74:   
  75:          ////////////////////////////////////////////////////////////////////////////
  76:   
  77:          /// <summary>
  78:          ///
  79:          /// </summary>
  80:          public static void UpdateServiceSuspension(string service, bool serviceSuspensionState, Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, out Ia.Cl.Model.Result result)
  81:          {
  82:              result = new Ia.Cl.Model.Result();
  83:   
  84:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanReadUpdateServiceSuspension(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Update, staffContact))
  85:              {
  86:                  if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedDomainList(service))
  87:                  {
  88:                      Ia.Ngn.Cl.Model.Data.ServiceRequestService.UpdateServiceSuspension(service, serviceSuspensionState, staffContact.UserId, out result);
  89:   
  90:                      if (result.IsSuccessful)
  91:                      {
  92:                          result.AddSuccess("Service record '" + service + "' has its service suspension value updated to '" + serviceSuspensionState.ToString().ToLower() + "'");
  93:                      }
  94:                      else
  95:                      {
  96:                      }
  97:                  }
  98:                  else
  99:                  {
 100:                      result.AddError(@"The number '" + service + @"' does not belong to the network (الرقم لا ينتمي للشبكة). ");
 101:                  }
 102:              }
 103:              else
 104:              {
 105:                  result.AddError("You are not authorized to modify this value (لست مخولاً بتعديل هذه القيمة). ");
 106:              }
 107:          }
 108:   
 109:          ////////////////////////////////////////////////////////////////////////////
 110:   
 111:          /// <summary>
 112:          ///
 113:          /// </summary>
 114:          public static void ReadServiceSuspension(string service, Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string key, out bool isSuspended, out DateTime serviceLastUpdated, out Ia.Cl.Model.Result result)
 115:          {
 116:              DateTime now;
 117:              Ia.Ngn.Cl.Model.Service2 service2;
 118:              Ia.Ngn.Cl.Model.ServiceRequestService serviceRequestService;
 119:   
 120:              result = new Ia.Cl.Model.Result();
 121:   
 122:              isSuspended = false;
 123:              serviceLastUpdated = DateTime.MinValue;
 124:   
 125:              now = DateTime.UtcNow.AddHours(3);
 126:   
 127:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanReadUpdateServiceSuspension(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Read, staffContact))
 128:              {
 129:                  if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedDomainList(service))
 130:                  {
 131:                      serviceRequestService = Ia.Ngn.Cl.Model.Data.ServiceRequestService.Read(service);
 132:                      service2 = Ia.Ngn.Cl.Model.Data.Service2.Read(service);
 133:   
 134:                      if (serviceRequestService != null && service2 != null)
 135:                      {
 136:                          result.AddSuccess("Pending service suspension value is '" + serviceRequestService.ServiceSuspension.ToString().ToLower() + "' (updated: " + serviceRequestService.Updated + "). System service suspension value is '" + service2.ServiceSuspension.ToString().ToLower() + "' (updated: " + service2.Updated + "). ");
 137:   
 138:                          isSuspended = service2.ServiceSuspension;
 139:                          serviceLastUpdated = service2.Updated;
 140:                      }
 141:                      else
 142:                      {
 143:                          result.AddError("Service and/or service request service record for '" + service + "' does not exist. ");
 144:                      }
 145:                  }
 146:                  else
 147:                  {
 148:                      result.AddError(@"The number '" + service + @"' does not belong to the network (الرقم لا ينتمي للشبكة). ");
 149:                  }
 150:              }
 151:              else
 152:              {
 153:                  result.AddError("You are not authorized to read this value (لست مخولاً بقراءة هذه القيمة). ");
 154:              }
 155:          }
 156:   
 157:          ////////////////////////////////////////////////////////////////////////////
 158:   
 159:          /// <summary>
 160:          /// Update service-request-service table with data from service requests
 161:          /// </summary>
 162:          public static void UpdateForServiceRequestIdRange(Tuple<int, int> startEndRange, out string result)
 163:          {
 164:              List<int> numberList;
 165:              List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList;
 166:   
 167:              // 1. Read all SRs for this range
 168:              serviceRequestList = Ia.Ngn.Cl.Model.Data.ServiceRequest.ListWithinIdRange(startEndRange.Item1, startEndRange.Item2);
 169:   
 170:              // 2. Collect numbers in int format into int list
 171:              numberList = serviceRequestList.NumberList();
 172:   
 173:              UpdateForServiceList(numberList, out result);
 174:          }
 175:   
 176:          ////////////////////////////////////////////////////////////////////////////
 177:   
 178:          /// <summary>
 179:          ///
 180:          /// </summary>
 181:          public static void UpdateForService(string service, out string result)
 182:          {
 183:              List<int> numberList;
 184:   
 185:              numberList = new List<int>();
 186:   
 187:              if (int.TryParse(service, out int i))
 188:              {
 189:                  numberList.Add(i);
 190:   
 191:                  UpdateForServiceList(numberList, out result);
 192:              }
 193:              else
 194:              {
 195:                  result = "Error: service: " + service + " is not in integer format. ";
 196:              }
 197:          }
 198:   
 199:          ////////////////////////////////////////////////////////////////////////////
 200:   
 201:          /// <summary>
 202:          /// Update service-request-service table with service list
 203:          /// </summary>
 204:          public static void UpdateForServiceList(List<int> numberList, out string result)
 205:          {
 206:              string r0, r1, r2;
 207:              List<int> number1List;
 208:              List<string> serviceList, service1List, service2List;
 209:              List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList;
 210:              List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList;
 211:              List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList;
 212:              List<Ia.Ngn.Cl.Model.ServiceRequestService> serviceRequestServiceList, serviceRequestService1List, serviceRequestService2List;
 213:   
 214:              r0 = r1 = r2 = "";
 215:   
 216:              // SR
 217:              // 3. Collect numbers in int format into int list
 218:              number1List = Ia.Ngn.Cl.Model.Data.ServiceRequest.NumberList(numberList);
 219:   
 220:              if (number1List.Count > 0)
 221:              {
 222:                  // 6 Read all SRs related to collected numbers
 223:                  serviceRequestList = Ia.Ngn.Cl.Model.Data.ServiceRequest.List(number1List);
 224:   
 225:                  // 7. Read all SRTs related to collected numbers
 226:                  serviceRequestTypeList = Ia.Ngn.Cl.Model.Data.ServiceRequestType.List(number1List);
 227:   
 228:                  // 8. Collect numbers in string format into int list
 229:                  service1List = (from n in number1List select n.ToString()).ToList<string>();
 230:   
 231:                  serviceRequestService1List = ServiceRequestServiceFromServiceRequest(serviceRequestList, serviceRequestTypeList);
 232:   
 233:                  // 12. Remove duplicates (Linq orderyby boolean See http://stackoverflow.com/questions/9481054/linq-orderyby-boolean)
 234:                  serviceRequestService1List = serviceRequestService1List.OrderByDescending(u => u.Serial).OrderByDescending(u => u.Provisioned).OrderByDescending(u => u.LastRequestDateTime).GroupBy(u => u.Id).Select(u => u.First()).ToList();
 235:              }
 236:              else
 237:              {
 238:                  serviceRequestList = new List<Ia.Ngn.Cl.Model.ServiceRequest>();
 239:                  serviceRequestTypeList = new List<Ia.Ngn.Cl.Model.ServiceRequestType>();
 240:                  service1List = new List<string>();
 241:   
 242:                  serviceRequestService1List = new List<Ia.Ngn.Cl.Model.ServiceRequestService>();
 243:              }
 244:   
 245:              // SRH
 246:              // 9. Read all SRHs related to collected numbers
 247:              serviceRequestHistoryList = Ia.Ngn.Cl.Model.Data.ServiceRequestHistory.List(numberList);
 248:   
 249:              // 8. Collect numbers in string format into int list
 250:              service2List = (from n in numberList select n.ToString()).ToList<string>();
 251:   
 252:              if (serviceRequestHistoryList.Count > 0)
 253:              {
 254:                  serviceRequestService2List = ServiceRequestServiceFromServiceRequestHistory(serviceRequestHistoryList);
 255:   
 256:                  // 12. Remove duplicates (Linq orderyby boolean See http://stackoverflow.com/questions/9481054/linq-orderyby-boolean)
 257:                  serviceRequestService2List = serviceRequestService2List.OrderByDescending(u => u.Serial).OrderByDescending(u => u.Provisioned).OrderByDescending(u => u.LastRequestDateTime).GroupBy(u => u.Id).Select(u => u.First()).ToList();
 258:              }
 259:              else
 260:              {
 261:                  serviceRequestService2List = new List<Ia.Ngn.Cl.Model.ServiceRequestService>();
 262:              }
 263:   
 264:              if (serviceRequestService1List.Count > 0)
 265:              {
 266:                  serviceRequestServiceList = serviceRequestService1List;
 267:                  serviceList = service1List;
 268:   
 269:                  /*
 270:                  serviceRequestServiceList = new List<Ia.Ngn.Cl.Model.ServiceRequestService>();
 271:  
 272:                  foreach (var v in serviceRequestService1List) serviceRequestServiceList.Add(v);
 273:  
 274:                  if (serviceRequestService2List.Count > 0)
 275:                  {
 276:                      serviceList = service1List.Union(service2List).ToList();
 277:  
 278:                      foreach (var v in serviceRequestService2List)
 279:                      {
 280:                          if (!serviceRequestServiceList.Any(u => u.Id == v.Id))
 281:                          {
 282:                              serviceRequestServiceList.Add(v);
 283:                          }
 284:                      }
 285:                  }
 286:                  else
 287:                  {
 288:                      serviceList = service1List;
 289:                  }
 290:                  */
 291:              }
 292:              else
 293:              {
 294:                  serviceRequestServiceList = serviceRequestService2List;
 295:                  serviceList = service2List;
 296:              }
 297:   
 298:              // 13. Update service request services
 299:              Ia.Ngn.Cl.Model.Data.ServiceRequestService.UpdateWithServiceList(serviceList, serviceRequestServiceList, out r1);
 300:   
 301:              // 14. Update service requests with SRS foreign keys
 302:              Ia.Ngn.Cl.Model.Data.ServiceRequest.UpdateWithServiceList(serviceList, serviceRequestList, out r2);
 303:   
 304:              result = r1 + " " + r2;
 305:          }
 306:   
 307:          ////////////////////////////////////////////////////////////////////////////
 308:   
 309:          /// <summary>
 310:          ///
 311:          /// </summary>
 312:          public static List<Ia.Ngn.Cl.Model.ServiceRequestService> ServiceRequestServiceFromServiceRequest(List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList, List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 313:          {
 314:              int serial, serviceType, serviceId;
 315:              string service, serviceSerial, serviceRequestServiceId, changedToServiceNumber;
 316:              DateTime lastRequestDateTime;
 317:              Ia.Ngn.Cl.Model.ServiceRequestService serviceRequestService;
 318:              List<Ia.Ngn.Cl.Model.ServiceRequestService> serviceRequestServiceList;
 319:   
 320:              serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService;
 321:              lastRequestDateTime = DateTime.MinValue;
 322:              serviceRequestServiceList = new List<Ia.Ngn.Cl.Model.ServiceRequestService>(serviceRequestList.Count);
 323:   
 324:              // 11. Loop through all sr records by request id ascending
 325:              var list = serviceRequestList.OrderBy(p => p.RequestDateTime.Date).ThenBy(p => p.ServiceId == 38).ThenBy(p => p.Id); // <service id="38" arabicName="مجموعة الخدمات" />
 326:              foreach (Ia.Ngn.Cl.Model.ServiceRequest serviceRequest in list) // serviceRequestList.OrderBy(p => p.Id))
 327:              {
 328:                  if (Ia.Ngn.Cl.Model.Business.Authority.ServiceRequestIsAllowedProcessing(serviceRequest))
 329:                  {
 330:                      if (serviceRequest.ServiceCategoryId == 3)
 331:                      {
 332:                          // <category id="3" arabicName="هاتف" />
 333:   
 334:                          if (serviceRequest.Status == 2003 || serviceRequest.Status == 2005)
 335:                          {
 336:                              // <status id="2003" arabicName="قيد التنفيذ" />
 337:                              // <status id="2005" arabicName="تم التنفيذ" />
 338:   
 339:                              service = serviceRequest.Number.ToString();
 340:                              serial = serviceRequest.Serial;
 341:                              serviceId = serviceRequest.ServiceId;
 342:                              serviceSerial = service + ":" + serial;
 343:   
 344:                              serviceRequestServiceId = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceRequestServiceId(service, serviceType);
 345:   
 346:                              serviceRequestService = (from srs in serviceRequestServiceList where srs.Id == serviceRequestServiceId select srs).OrderByDescending(u => u.Serial).OrderByDescending(u => u.LastRequestDateTime).GroupBy(u => u.Id).Select(u => u.First()).FirstOrDefault(); //.SingleOrDefault();
 347:   
 348:                              if (serviceRequestService == null || serviceRequestService.Provisioned == false)
 349:                              {
 350:                                  if (serviceId == 1 || serviceId == 129 || serviceId == 54)
 351:                                  {
 352:                                      // <service id="1" arabicName="خط هاتف" />
 353:                                      // <service id="129" arabicName="خط هاتف مع نداء آلي"/>
 354:                                      // <service id="54" arabicName="اعادة تركيب" />
 355:   
 356:                                      serviceRequestService = new Ia.Ngn.Cl.Model.ServiceRequestService();
 357:   
 358:                                      serviceRequestService.Id = serviceRequestServiceId;
 359:                                      serviceRequestService.Service = service;
 360:                                      serviceRequestService.Serial = serial;
 361:                                      serviceRequestService.AreaCode = Ia.Ngn.Cl.Model.Business.Service.CountryCode;
 362:                                      serviceRequestService.ServiceType = serviceType;
 363:                                      serviceRequestService.Provisioned = true;
 364:   
 365:                                      TelephonyService(serviceRequest, serviceRequestTypeList, ref serviceRequestService);
 366:   
 367:                                      serviceRequestServiceList.Add(serviceRequestService);
 368:                                      serviceRequest.ServiceRequestService = serviceRequestService;
 369:   
 370:                                      lastRequestDateTime = serviceRequest.RequestDateTime;
 371:                                      if (serviceRequestService.LastRequestDateTime < lastRequestDateTime) serviceRequestService.LastRequestDateTime = lastRequestDateTime;
 372:                                  }
 373:                                  else
 374:                                  {
 375:                                      // incomplete service request list for serial
 376:                                  }
 377:                              }
 378:                              else
 379:                              {
 380:                                  if (serviceRequestService.Provisioned && serviceRequestService.Serial == serial)
 381:                                  {
 382:                                      if (serviceRequest.ServiceId == 41)
 383:                                      {
 384:                                          // <service id="41" arabicName="تغيير رقم" />
 385:   
 386:                                          // below: <type id="11" name="dn" arabicName="dn" oracleFieldName="الرقم الجديد"/>
 387:                                          changedToServiceNumber = (from srt in serviceRequestTypeList where srt.ServiceRequest.Id == serviceRequest.Id && srt.TypeId == 11 && srt.Value != null select srt.Value).SingleOrDefault();
 388:   
 389:                                          if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedDomainList(changedToServiceNumber)) // important because some numbers are null
 390:                                          {
 391:                                              serviceRequestService.Id = Ia.Ngn.Cl.Model.Business.ServiceRequestService.ServiceRequestServiceId(changedToServiceNumber, serviceType);
 392:                                              serviceRequestService.Service = changedToServiceNumber;
 393:                                          }
 394:                                          else
 395:                                          {
 396:   
 397:                                          }
 398:                                      }
 399:                                      else
 400:                                      {
 401:                                          TelephonyService(serviceRequest, serviceRequestTypeList, ref serviceRequestService);
 402:                                      }
 403:   
 404:                                      lastRequestDateTime = serviceRequest.RequestDateTime;
 405:                                      if (serviceRequestService.LastRequestDateTime < lastRequestDateTime) serviceRequestService.LastRequestDateTime = lastRequestDateTime;
 406:                                  }
 407:   
 408:                                  serviceRequest.ServiceRequestService = serviceRequestService;
 409:                              }
 410:                          }
 411:                          else
 412:                          {
 413:                          }
 414:                      }
 415:                  }
 416:              }
 417:   
 418:              return serviceRequestServiceList;
 419:          }
 420:   
 421:          ////////////////////////////////////////////////////////////////////////////
 422:   
 423:          /// <summary>
 424:          ///
 425:          /// </summary>
 426:          public static List<Ia.Ngn.Cl.Model.ServiceRequestService> ServiceRequestServiceFromServiceRequestHistory(List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList)
 427:          {
 428:              int serial, status, serviceType, serviceId;
 429:              string service, serviceSerial, serviceIdIssue;
 430:              DateTime lastRequestDateTime;
 431:              Ia.Ngn.Cl.Model.ServiceRequestService serviceRequestService;
 432:              Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService serviceSerialRequestService;
 433:              List<string> serviceSerialsToRemoveList;
 434:              List<Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService> serviceSerialRequestServiceList;
 435:              List<Ia.Ngn.Cl.Model.ServiceRequestService> serviceRequestServiceList;
 436:              Dictionary<string, int> serviceToLastSerialDictionary;
 437:              Dictionary<string, Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService> serviceRequestHistoryNumberSerialComplementaryServiceDictionary;
 438:   
 439:              serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.NgnService;
 440:              serviceIdIssue = string.Empty;
 441:              lastRequestDateTime = DateTime.MinValue;
 442:              serviceSerialsToRemoveList = new List<string>();
 443:              serviceSerialRequestServiceList = new List<Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService>(serviceRequestHistoryList.Count);
 444:   
 445:              serviceToLastSerialDictionary = new Dictionary<string, int>(serviceRequestHistoryList.Count);
 446:   
 447:              serviceRequestHistoryNumberSerialComplementaryServiceDictionary = new Dictionary<string, Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService>(serviceRequestHistoryList.Count);
 448:   
 449:   
 450:              // 11. Loop through all srh records by request id ascending
 451:   
 452:              // build service request service from service request histories.
 453:              var list2 = serviceRequestHistoryList.OrderBy(p => p.ServiceDateTime.Date).ThenBy(p => p.ServiceId == 38); // <service id="38" arabicName="مجموعة الخدمات" />
 454:              foreach (var serviceRequestHistory in list2)
 455:              {
 456:                  if (serviceRequestHistory.ServiceCategoryId == 3)
 457:                  {
 458:                      // <category id="3" arabicName="هاتف" />
 459:                      service = serviceRequestHistory.Number.ToString();
 460:                      serial = serviceRequestHistory.Serial;
 461:                      serviceId = serviceRequestHistory.ServiceId;
 462:                      status = serviceRequestHistory.Status;
 463:   
 464:                      serviceSerial = service + ":" + serial;
 465:   
 466:                      if (serviceToLastSerialDictionary.ContainsKey(service))
 467:                      {
 468:                          if (serviceToLastSerialDictionary[service] < serial) serviceToLastSerialDictionary[service] = serial;
 469:                      }
 470:                      else serviceToLastSerialDictionary[service] = serial;
 471:   
 472:                      if (!serviceRequestHistoryNumberSerialComplementaryServiceDictionary.ContainsKey(serviceSerial) || serviceRequestHistoryNumberSerialComplementaryServiceDictionary.ContainsKey(serviceSerial) && serviceRequestHistoryNumberSerialComplementaryServiceDictionary[serviceSerial].Provisioned == false)
 473:                      {
 474:                          if (serviceId == 1 || serviceId == 129 || serviceId == 54)
 475:                          {
 476:                              // <service id="1" arabicName="خط هاتف" />
 477:                              // <service id="129" arabicName="خط هاتف مع نداء آلي"/>
 478:                              // <service id="54" arabicName="اعادة تركيب" />
 479:   
 480:                              serviceSerialRequestService = new Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService();
 481:   
 482:                              serviceSerialRequestService.Id = serviceSerial;
 483:                              serviceSerialRequestService.Service = service;
 484:                              serviceSerialRequestService.Serial = serial;
 485:                              serviceSerialRequestService.Provisioned = true;
 486:   
 487:                              serviceRequestHistoryNumberSerialComplementaryServiceDictionary[serviceSerial] = serviceSerialRequestService;
 488:   
 489:                              lastRequestDateTime = serviceRequestHistory.ServiceDateTime;
 490:                          }
 491:                          else
 492:                          {
 493:                              // incomplete service request list for serial
 494:                          }
 495:                      }
 496:                      else
 497:                      {
 498:                          if (serviceRequestHistoryNumberSerialComplementaryServiceDictionary[serviceSerial].Provisioned && serviceRequestHistoryNumberSerialComplementaryServiceDictionary[serviceSerial].Serial == serial)
 499:                          {
 500:                              if (serviceId == 41)
 501:                              {
 502:                                  // <service id="41" arabicName="تغيير رقم" />
 503:                              }
 504:                              else
 505:                              {
 506:                                  Ia.Ngn.Cl.Model.Business.ServiceRequestService.TelephonyService2(ref serviceRequestHistoryNumberSerialComplementaryServiceDictionary, serviceSerial, status, serviceId, ref serviceIdIssue);
 507:                              }
 508:   
 509:                              lastRequestDateTime = serviceRequestHistory.ServiceDateTime;
 510:                          }
 511:                      }
 512:                  }
 513:              }
 514:   
 515:              // collect all numbers serials that are not the last in their serial series:
 516:              foreach (KeyValuePair<string, Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService> kvp in serviceRequestHistoryNumberSerialComplementaryServiceDictionary)
 517:              {
 518:                  if (serviceToLastSerialDictionary.ContainsKey(kvp.Value.Service))
 519:                  {
 520:                      if (serviceToLastSerialDictionary[kvp.Value.Service] > kvp.Value.Serial) serviceSerialsToRemoveList.Add(kvp.Key);
 521:                  }
 522:                  else
 523:                  {
 524:                      serviceIdIssue += "Error: serviceToLastSerialDictionary does not contain kvp.Value.Service: " + kvp.Value.Service + "\r\n";
 525:                  }
 526:              }
 527:   
 528:              // remove previous service-serials
 529:              foreach (string s in serviceSerialsToRemoveList)
 530:              {
 531:                  serviceRequestHistoryNumberSerialComplementaryServiceDictionary.Remove(s);
 532:              }
 533:   
 534:              // construct serviceRequestServiceList from dictionary
 535:              serviceRequestServiceList = new List<Ia.Ngn.Cl.Model.ServiceRequestService>();
 536:   
 537:              foreach (KeyValuePair<string, Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService> kvp in serviceRequestHistoryNumberSerialComplementaryServiceDictionary)
 538:              {
 539:                  serviceRequestService = new Model.ServiceRequestService()
 540:                  {
 541:                      Id = kvp.Value.Service + ":1:965",
 542:                      Service = kvp.Value.Service,
 543:                      Serial = kvp.Value.Serial,
 544:                      Provisioned = kvp.Value.Provisioned,
 545:                      CallWaiting = kvp.Value.CallWaiting,
 546:                      InternationalCallingUserControlled = kvp.Value.InternationalCallingUserControlled,
 547:                      CallerId = kvp.Value.CallerId,
 548:                      CallForwarding = kvp.Value.CallForwarding,
 549:                      CallBarring = kvp.Value.CallBarring,
 550:                      ConferenceCall = kvp.Value.ConferenceCall,
 551:                      AbbriviatedCalling = kvp.Value.AbbriviatedCalling,
 552:                      InternationalCalling = kvp.Value.InternationalCalling,
 553:                      AlarmCall = kvp.Value.AlarmCall,
 554:                      WakeupCall = kvp.Value.WakeupCall,
 555:                      BarringOfAllOutgoingCalls = kvp.Value.BarringOfAllOutgoingCalls,
 556:                      BarringOfAllIncomingCalls = kvp.Value.BarringOfAllIncomingCalls,
 557:                      LastRequestDateTime = lastRequestDateTime
 558:                  };
 559:   
 560:                  serviceRequestServiceList.Add(serviceRequestService);
 561:              }
 562:   
 563:              return serviceRequestServiceList;
 564:          }
 565:   
 566:          ////////////////////////////////////////////////////////////////////////////
 567:   
 568:          /// <summary>
 569:          ///
 570:          /// </summary>
 571:          private static void TelephonyService(Ia.Ngn.Cl.Model.ServiceRequest serviceRequest, List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList, ref Ia.Ngn.Cl.Model.ServiceRequestService serviceRequestService)
 572:          {
 573:              Ia.Ngn.Cl.Model.Access access;
 574:   
 575:              if (serviceRequest.ServiceId == 1 || serviceRequest.ServiceId == 129 || serviceRequest.ServiceId == 39 || serviceRequest.ServiceId == 54)
 576:              {
 577:                  // <service id="1" arabicName="خط هاتف" />
 578:                  // <service id="129" arabicName="خط هاتف مع نداء آلي"/>
 579:                  // <service id="39" arabicName="نقل خارجى" />
 580:                  // <service id="54" arabicName="اعادة تركيب" />
 581:   
 582:                  if (serviceRequest.ServiceId == 1 || serviceRequest.ServiceId == 129 || serviceRequest.ServiceId == 54)
 583:                  {
 584:                      // <service id="1" arabicName="خط هاتف" />
 585:                      // <service id="129" arabicName="خط هاتف مع نداء آلي"/>
 586:                      // <service id="54" arabicName="اعادة تركيب" />
 587:   
 588:                      // below: keep this here and don't move it out to accommodate 39
 589:                      using (var db = new Ia.Ngn.Cl.Model.Ngn())
 590:                      {
 591:                          // important: ServiceRequestService.Update() will only update stored.Access if it is null, or (stored.userId == Guid.Empty && update.Id > stored.Id)
 592:                          access = Ia.Ngn.Cl.Model.Business.ServiceRequestType.ExtractAccess(serviceRequest.Id, serviceRequestTypeList);
 593:   
 594:                          if (access != null) serviceRequestService.Access = (from a in db.Accesses where a.Id == access.Id select a).SingleOrDefault();
 595:                          else serviceRequestService.Access = null;
 596:                          /*
 597:                           * I will not use statistical estimation for incomplete workorders
 598:                          else
 599:                          {
 600:                              serviceAddress = Ia.Ngn.Cl.Model.Business.ServiceRequest.StatisticalServiceAddress(serviceRequestService.Service, serviceRequest.CustomerAddress, out level);
 601:  
 602:                              if (serviceAddress != null)
 603:                              {
 604:                                  accessList = (from a in db.Accesses where a.AreaId == serviceAddress.AreaId select a).ToList();
 605:  
 606:                                  access = Ia.Ngn.Cl.Model.Data.Access.StatisticalAccess(serviceAddress, ref accessList);
 607:  
 608:                                  if (access != null)
 609:                                  {
 610:                                      serviceRequestService.Access = (from a in db.Accesses where a.Id == access.Id select a).SingleOrDefault();
 611:                                  }
 612:                                  else serviceRequestService.Access = null;
 613:                              }
 614:                              else serviceRequestService.Access = null;
 615:                          }
 616:                          */
 617:                      }
 618:   
 619:                      serviceRequestService.CallerId = false;
 620:   
 621:                      serviceRequestService.AlarmCall = false;
 622:                      serviceRequestService.WakeupCall = false;
 623:   
 624:                      ///serviceRequestService.InternationalCallingUserControlled = true; // as requested by MOC NGN management
 625:                      serviceRequestService.CallWaiting = false;
 626:                      serviceRequestService.CallForwarding = false;
 627:                      serviceRequestService.ConferenceCall = false;
 628:                      serviceRequestService.CallBarring = false;
 629:   
 630:                      if (serviceRequest.ServiceId == 1 || serviceRequest.ServiceId == 54) serviceRequestService.InternationalCalling = false;
 631:                      else if (serviceRequest.ServiceId == 129) serviceRequestService.InternationalCalling = true;
 632:                  }
 633:                  else if (serviceRequest.ServiceId == 39)
 634:                  {
 635:                      // <service id="39" arabicName="نقل خارجى" />
 636:   
 637:                      using (var db = new Ia.Ngn.Cl.Model.Ngn())
 638:                      {
 639:                          // important: ServiceRequestService.Update() will only update stored.Access if it is null, or (stored.userId == Guid.Empty && update.Id > stored.Id)
 640:                          access = Ia.Ngn.Cl.Model.Business.ServiceRequestType.ExtractAccess(serviceRequest.Id, serviceRequestTypeList);
 641:   
 642:                          if (access != null) serviceRequestService.Access = (from a in db.Accesses where a.Id == access.Id select a).SingleOrDefault();
 643:                          //else serviceRequestService.Access = null;
 644:                      }
 645:                  }
 646:              }
 647:              else
 648:              {
 649:                  switch (serviceRequest.ServiceId)
 650:                  {
 651:                      // below: <service id="40" arabicName="رفع خط" />
 652:                      case 40:
 653:                          {
 654:                              // will reset all to false
 655:   
 656:                              serviceRequestService.Provisioned = false;
 657:   
 658:                              serviceRequestService.CallerId = false;
 659:                              serviceRequestService.AlarmCall = false;
 660:                              serviceRequestService.WakeupCall = false;
 661:                              serviceRequestService.InternationalCallingUserControlled = false;
 662:                              serviceRequestService.CallWaiting = false;
 663:                              serviceRequestService.CallForwarding = false;
 664:                              serviceRequestService.ConferenceCall = false;
 665:                              serviceRequestService.CallBarring = false;
 666:                              serviceRequestService.InternationalCalling = false;
 667:   
 668:                              break;
 669:                          }
 670:   
 671:                      // below: <service id="131" arabicName="خط ذهبي"/>
 672:                      case 131: { break; }
 673:   
 674:                      // below: <service id="132" arabicName="خط فضي"/>
 675:                      case 132: { break; }
 676:   
 677:                      // below: <service id="133" arabicName="خط برونزي"/>
 678:                      case 133: { break; }
 679:   
 680:                      // below: <service id="12" arabicName="خدمة الإنتظار" />
 681:                      case 12: { serviceRequestService.CallWaiting = true; break; }
 682:   
 683:                      // below: <service id="68" arabicName="إيقاف خدمة الإنتظار" />
 684:                      case 68: { serviceRequestService.CallWaiting = false; break; }
 685:   
 686:                      // below: <service id="13" arabicName="التحكم بالصفر الدولي" />
 687:                      case 13: { serviceRequestService.InternationalCallingUserControlled = true; break; }
 688:   
 689:                      // below: <service id="67" arabicName="وقف التحكم بالصفر" />
 690:                      case 67: { serviceRequestService.InternationalCallingUserControlled = false; break; }
 691:   
 692:                      // below: <service id="14" arabicName="كاشف رقم" />
 693:                      case 14: { serviceRequestService.CallerId = true; break; }
 694:   
 695:                      // below: <service id="66" arabicName="إيقاف كاشف" />
 696:                      case 66: { serviceRequestService.CallerId = false; break; }
 697:   
 698:                      // below: <service id="5" arabicName="تحويل مكالمات" />
 699:                      case 5: { serviceRequestService.CallForwarding = true; break; }
 700:   
 701:                      // below: <service id="75" arabicName="إيقاف التحويل" />
 702:                      case 75: { serviceRequestService.CallForwarding = false; break; }
 703:   
 704:                      // below: <service id="20" arabicName="النداء الآلي" />
 705:                      case 20: { serviceRequestService.InternationalCalling = true; break; }
 706:   
 707:                      // below: <service id="19" arabicName="قطع النداء الآلي" />
 708:                      case 19: { serviceRequestService.InternationalCalling = false; break; }
 709:   
 710:                      // below: <service id="38" arabicName="مجموعة الخدمات" />
 711:                      case 38:
 712:                          {
 713:                              serviceRequestService.CallerId = true;
 714:   
 715:                              serviceRequestService.AlarmCall = true;
 716:                              serviceRequestService.WakeupCall = true;
 717:   
 718:                              //serviceRequestService.InternationalCallingUserControlled = true;
 719:                              serviceRequestService.CallWaiting = true;
 720:                              serviceRequestService.CallForwarding = true;
 721:                              serviceRequestService.ConferenceCall = true;
 722:                              break;
 723:                          }
 724:   
 725:                      // below: <service id="62" arabicName="إيقاف مجموعة الخدمات" />
 726:                      case 62:
 727:                          {
 728:                              serviceRequestService.CallerId = false;
 729:   
 730:                              serviceRequestService.AlarmCall = false;
 731:                              serviceRequestService.WakeupCall = false;
 732:   
 733:                              //serviceRequestService.InternationalCallingUserControlled = false;
 734:                              serviceRequestService.CallWaiting = false;
 735:                              serviceRequestService.CallForwarding = false;
 736:                              serviceRequestService.ConferenceCall = false;
 737:                              break;
 738:                          }
 739:   
 740:                      // below: <service id="52" arabicName="قطع حرارة" />
 741:                      case 52: { serviceRequestService.CallBarring = true; break; }
 742:   
 743:                      // below: <service id="53" arabicName="اعادة حرارة" />
 744:                      case 53: { serviceRequestService.CallBarring = false; break; }
 745:   
 746:                      // below: <service id="7" arabicName="منع الإتصال" />
 747:                      case 7: { serviceRequestService.BarringOfAllOutgoingCalls = true; break; }
 748:   
 749:                      // below: <service id="73" arabicName="إيقاف منع الإتصال" />
 750:                      case 73: { serviceRequestService.BarringOfAllOutgoingCalls = false; break; }
 751:   
 752:                      // below: <service id="8" arabicName="ايقاف استقبال" />
 753:                      case 8: { serviceRequestService.BarringOfAllIncomingCalls = true; break; }
 754:   
 755:                      // below: <service id="72" arabicName="رد استقبال" />
 756:                      case 72: { serviceRequestService.BarringOfAllIncomingCalls = false; break; }
 757:   
 758:                      // below: <service id="10" arabicName="خدمة الإيقاظ" />
 759:                      case 10:
 760:                          {
 761:                              serviceRequestService.AlarmCall = true;
 762:                              serviceRequestService.WakeupCall = true;
 763:                              break;
 764:                          }
 765:   
 766:                      // below: <service id="70" arabicName="إيقاف خدمة الإيقاظ" />
 767:                      case 70:
 768:                          {
 769:                              serviceRequestService.AlarmCall = false;
 770:                              serviceRequestService.WakeupCall = false;
 771:                              break;
 772:                          }
 773:   
 774:                      // below: <service id="6" arabicName="استشارة" />
 775:                      case 6: { serviceRequestService.ConferenceCall = true; break; }
 776:   
 777:                      // below: <service id="74" arabicName="إيقاف استشارة" />
 778:                      case 74: { serviceRequestService.ConferenceCall = false; break; }
 779:   
 780:                      // below: <service id="11" arabicName="إختصار الرقم" />
 781:                      case 11: { serviceRequestService.AbbriviatedCalling = true; break; }
 782:   
 783:                      // below: <service id="69" arabicName="إيقاف إختصار الرقم" />
 784:                      case 69: { serviceRequestService.AbbriviatedCalling = false; break; }
 785:   
 786:                      // below: <service id="55" arabicName="مفتاح بدالة" />
 787:                      case 55: { break; }
 788:   
 789:                      // below: <if id="60" name_ar="إيقاف مفتاح بدالة"...
 790:                      case 60: { break; }
 791:   
 792:                      // below: <if id="56" name_ar="فرع بدالة"...
 793:                      case 56: { break; }
 794:   
 795:                      // below: <if id="59" name_ar="إيقاف فرع بدالة"...
 796:                      case 59: { break; }
 797:   
 798:                      // below: <service id="64" arabicName="ايقاف التحويل الآلي/بدالة رئيس" />
 799:                      case 64: { break; }
 800:   
 801:                      // below: <service id="63" arabicName="ايقاف التحويل الآلي/بدالة فرع" />
 802:                      case 63: { break; }
 803:   
 804:                      // below: <service id="608" arabicName="خط رقمي دسل"/>
 805:                      case 608: { break; }
 806:   
 807:                      // below: <service id="609" arabicName="قطع خط رقمي دسل"/>
 808:                      case 609: { break; }
 809:   
 810:                      // below: <service id="15" arabicName="خدمة المحاسبة" />
 811:                      case 15: { break; }
 812:   
 813:                      // below: <service id="65" arabicName="إيقاف المحاسبة الذاتية" />
 814:                      case 65: { break; }
 815:   
 816:                      // below: <service id="271" arabicName="تغيير اسم"/>
 817:                      case 271: { break; }
 818:   
 819:                      // below: <service id="44" arabicName="تغيير نوع إشتراك" />
 820:                      case 44: { break; }
 821:   
 822:                      // below: <service id="42" arabicName="نقل داخلي" />
 823:                      case 42: { break; }
 824:   
 825:                      // below: <service id="46" arabicName="جهاز كاشف" />
 826:                      case 46: { break; }
 827:   
 828:                      // below: <service id="45" arabicName="تعديل اسم" />
 829:                      case 45: { break; }
 830:   
 831:                      // below: <service id="47" arabicName="جهاز تلفون" />
 832:                      case 47: { break; }
 833:   
 834:                      // below: <service id="49" arabicName="رسوم مودم" />
 835:                      case 49: { break; }
 836:   
 837:                      // below: <service id="37" arabicName="برقية" />
 838:                      case 37: { break; }
 839:   
 840:                      // below: <service id="23" arabicName="مكالمات مصلحية -دفع" />
 841:                      case 23: { break; }
 842:   
 843:                      // below: <service id="17" arabicName="نظام التحويل الآلي/بدالة رئيس" />
 844:                      case 17: { break; }
 845:   
 846:                      // below: <service id="18" arabicName="نظام التحويل الآلي/بدالة فرع" />
 847:                      case 18: { break; }
 848:   
 849:                      // below: <service id="3" arabicName="نداء عاجل" />
 850:                      case 3: { break; }
 851:   
 852:                      // below: <service id="22" arabicName="رسوم كابل" />
 853:                      case 22: { break; }
 854:   
 855:                      // below: <service id="61" arabicName="إيقاف إعادة تركيب" />
 856:                      case 61: { break; }
 857:   
 858:                      // below: <service id="43" arabicName="تنازل" />
 859:                      case 43:
 860:                          {
 861:                              serviceRequestService.Serial++;
 862:                              break;
 863:                          }
 864:   
 865:                      default:
 866:                          {
 867:                              log.AppendLine("TelephonyService(): For ServiceRequest.Number=" + serviceRequest.Number + " ServiceId=" + serviceRequest.ServiceId + " was not recognized. ");
 868:                              break;
 869:                          }
 870:                  }
 871:              }
 872:          }
 873:   
 874:          ////////////////////////////////////////////////////////////////////////////
 875:   
 876:          /// <summary>
 877:          /// 
 878:          /// </summary>
 879:          public static void TelephonyService2(ref Dictionary<string, Ia.Ngn.Cl.Model.Business.ServiceSerialRequestService> serviceRequestNumberSerialComplementaryServiceDictionary, string serviceSerial, int status, int serviceId, ref string serviceIdIssue)
 880:          {
 881:              if (serviceId == 1 || serviceId == 129 || serviceId == 39 || serviceId == 54)
 882:              {
 883:                  // <service id="1" arabicName="خط هاتف" />
 884:                  // <service id="129" arabicName="خط هاتف مع نداء آلي"/>
 885:                  // <service id="39" arabicName="نقل خارجى" />
 886:                  // <service id="54" arabicName="اعادة تركيب" />
 887:   
 888:                  if (serviceId == 1 || serviceId == 129 || serviceId == 54)
 889:                  {
 890:                      // <service id="1" arabicName="خط هاتف" />
 891:                      // <service id="129" arabicName="خط هاتف مع نداء آلي"/>
 892:                      // <service id="54" arabicName="اعادة تركيب" />
 893:   
 894:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallerId = false;
 895:   
 896:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AlarmCall = false;
 897:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].WakeupCall = false;
 898:   
 899:                      ///dic[id].InternationalCallingUserControlled = true; // as requested by NGN management
 900:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallWaiting = false;
 901:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallForwarding = false;
 902:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].ConferenceCall = false;
 903:                      serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallBarring = false;
 904:   
 905:                      if (serviceId == 1 || serviceId == 54) serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCalling = false;
 906:                      else if (serviceId == 129) serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCalling = true;
 907:                  }
 908:                  else if (serviceId == 39)
 909:                  {
 910:                      // <service id="39" arabicName="نقل خارجى" />
 911:                  }
 912:              }
 913:              else
 914:              {
 915:                  switch (serviceId)
 916:                  {
 917:                      // below: <service id="40" arabicName="رفع خط" />
 918:                      case 40:
 919:                          {
 920:                              // - For SRH issues, I will ignore the service رفع خط (<service id="40" arabicName="رفع خط" />) if the number is يعمل (systemCode[7001] = "يعمل") (e.g. 25426947) or number is قطع مبرمج (systemCode[7003] = "قطع مبرمج") (e.g. 25417139)
 921:                              // - Note that status is specific to SRH
 922:   
 923:                              if (status == 7001 || status == 7003) { }
 924:                              else
 925:                              {
 926:                                  // - Will reset all to false
 927:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].Provisioned = false;
 928:   
 929:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallerId = false;
 930:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AlarmCall = false;
 931:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].WakeupCall = false;
 932:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCallingUserControlled = false;
 933:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallWaiting = false;
 934:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallForwarding = false;
 935:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].ConferenceCall = false;
 936:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallBarring = false;
 937:                                  serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCalling = false;
 938:                              }
 939:                              break;
 940:                          }
 941:   
 942:                      // below: <service id="131" arabicName="خط ذهبي"/>
 943:                      case 131: { break; }
 944:   
 945:                      // below: <service id="132" arabicName="خط فضي"/>
 946:                      case 132: { break; }
 947:   
 948:                      // below: <service id="133" arabicName="خط برونزي"/>
 949:                      case 133: { break; }
 950:   
 951:                      // below: <service id="12" arabicName="خدمة الإنتظار" />
 952:                      case 12: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallWaiting = true; break; }
 953:   
 954:                      // below: <service id="68" arabicName="إيقاف خدمة الإنتظار" />
 955:                      case 68: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallWaiting = false; break; }
 956:   
 957:                      // below: <service id="13" arabicName="التحكم بالصفر الدولي" />
 958:                      case 13: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCallingUserControlled = true; break; }
 959:   
 960:                      // below: <service id="67" arabicName="وقف التحكم بالصفر" />
 961:                      case 67: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCallingUserControlled = false; break; }
 962:   
 963:                      // below: <service id="14" arabicName="كاشف رقم" />
 964:                      case 14: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallerId = true; break; }
 965:   
 966:                      // below: <service id="66" arabicName="إيقاف كاشف" />
 967:                      case 66: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallerId = false; break; }
 968:   
 969:                      // below: <service id="5" arabicName="تحويل مكالمات" />
 970:                      case 5: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallForwarding = true; break; }
 971:   
 972:                      // below: <service id="75" arabicName="إيقاف التحويل" />
 973:                      case 75: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallForwarding = false; break; }
 974:   
 975:                      // below: <service id="20" arabicName="النداء الآلي" />
 976:                      case 20: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCalling = true; break; }
 977:   
 978:                      // below: <service id="19" arabicName="قطع النداء الآلي" />
 979:                      case 19: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCalling = false; break; }
 980:   
 981:                      // below: <service id="38" arabicName="مجموعة الخدمات" />
 982:                      case 38:
 983:                          {
 984:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallerId = true;
 985:   
 986:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AlarmCall = true;
 987:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].WakeupCall = true;
 988:   
 989:                              // serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCallingUserControlled = true;
 990:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallWaiting = true;
 991:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallForwarding = true;
 992:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].ConferenceCall = true;
 993:   
 994:                              break;
 995:                          }
 996:   
 997:                      // below: <service id="62" arabicName="إيقاف مجموعة الخدمات" />
 998:                      case 62:
 999:                          {
1000:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallerId = false;
1001:   
1002:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AlarmCall = false;
1003:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].WakeupCall = false;
1004:   
1005:                              //serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].InternationalCallingUserControlled = false;
1006:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallWaiting = false;
1007:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallForwarding = false;
1008:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].ConferenceCall = false;
1009:   
1010:                              break;
1011:                          }
1012:   
1013:                      // below: <service id="52" arabicName="قطع حرارة" />
1014:                      case 52: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallBarring = true; break; }
1015:   
1016:                      // below: <service id="53" arabicName="اعادة حرارة" />
1017:                      case 53: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].CallBarring = false; break; }
1018:   
1019:                      // below: <service id="7" arabicName="منع الإتصال" />
1020:                      case 7: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].BarringOfAllOutgoingCalls = true; break; }
1021:   
1022:                      // below: <service id="73" arabicName="إيقاف منع الإتصال" />
1023:                      case 73: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].BarringOfAllOutgoingCalls = false; break; }
1024:   
1025:                      // below: <service id="8" arabicName="ايقاف استقبال" />
1026:                      case 8: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].BarringOfAllIncomingCalls = true; break; }
1027:   
1028:                      // below: <service id="72" arabicName="رد استقبال" />
1029:                      case 72: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].BarringOfAllIncomingCalls = false; break; }
1030:   
1031:                      // below: <service id="10" arabicName="خدمة الإيقاظ" />
1032:                      case 10:
1033:                          {
1034:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AlarmCall = true;
1035:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].WakeupCall = true;
1036:                              break;
1037:                          }
1038:   
1039:                      // below: <service id="70" arabicName="إيقاف خدمة الإيقاظ" />
1040:                      case 70:
1041:                          {
1042:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AlarmCall = false;
1043:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].WakeupCall = false;
1044:                              break;
1045:                          }
1046:   
1047:                      // below: <service id="6" arabicName="استشارة" />
1048:                      case 6: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].ConferenceCall = true; break; }
1049:   
1050:                      // below: <service id="74" arabicName="إيقاف استشارة" />
1051:                      case 74: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].ConferenceCall = false; break; }
1052:   
1053:                      // below: <service id="11" arabicName="إختصار الرقم" />
1054:                      case 11: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AbbriviatedCalling = true; break; }
1055:   
1056:                      // below: <service id="69" arabicName="إيقاف إختصار الرقم" />
1057:                      case 69: { serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].AbbriviatedCalling = false; break; }
1058:   
1059:                      // below: <service id="55" arabicName="مفتاح بدالة" />
1060:                      case 55: { break; }
1061:   
1062:                      // below: <if id="60" name_ar="إيقاف مفتاح بدالة"...
1063:                      case 60: { break; }
1064:   
1065:                      // below: <if id="56" name_ar="فرع بدالة"...
1066:                      case 56: { break; }
1067:   
1068:                      // below: <if id="59" name_ar="إيقاف فرع بدالة"...
1069:                      case 59: { break; }
1070:   
1071:                      // below: <service id="64" arabicName="ايقاف التحويل الآلي/بدالة رئيس" />
1072:                      case 64: { break; }
1073:   
1074:                      // below: <service id="63" arabicName="ايقاف التحويل الآلي/بدالة فرع" />
1075:                      case 63: { break; }
1076:   
1077:                      // below: <service id="608" arabicName="خط رقمي دسل"/>
1078:                      case 608: { break; }
1079:   
1080:                      // below: <service id="609" arabicName="قطع خط رقمي دسل"/>
1081:                      case 609: { break; }
1082:   
1083:                      // below: <service id="15" arabicName="خدمة المحاسبة" />
1084:                      case 15: { break; }
1085:   
1086:                      // below: <service id="65" arabicName="إيقاف المحاسبة الذاتية" />
1087:                      case 65: { break; }
1088:   
1089:                      // below: <service id="271" arabicName="تغيير اسم"/>
1090:                      case 271: { break; }
1091:   
1092:                      // below: <service id="44" arabicName="تغيير نوع إشتراك" />
1093:                      case 44: { break; }
1094:   
1095:                      // below: <service id="42" arabicName="نقل داخلي" />
1096:                      case 42: { break; }
1097:   
1098:                      // below: <service id="46" arabicName="جهاز كاشف" />
1099:                      case 46: { break; }
1100:   
1101:                      // below: <service id="45" arabicName="تعديل اسم" />
1102:                      case 45: { break; }
1103:   
1104:                      // below: <service id="47" arabicName="جهاز تلفون" />
1105:                      case 47: { break; }
1106:   
1107:                      // below: <service id="49" arabicName="رسوم مودم" />
1108:                      case 49: { break; }
1109:   
1110:                      // below: <service id="37" arabicName="برقية" />
1111:                      case 37: { break; }
1112:   
1113:                      // below: <service id="23" arabicName="مكالمات مصلحية -دفع" />
1114:                      case 23: { break; }
1115:   
1116:                      // below: <service id="17" arabicName="نظام التحويل الآلي/بدالة رئيس" />
1117:                      case 17: { break; }
1118:   
1119:                      // below: <service id="18" arabicName="نظام التحويل الآلي/بدالة فرع" />
1120:                      case 18: { break; }
1121:   
1122:                      // below: <service id="3" arabicName="نداء عاجل" />
1123:                      case 3: { break; }
1124:   
1125:                      // below: <service id="22" arabicName="رسوم كابل" />
1126:                      case 22: { break; }
1127:   
1128:                      // below: <service id="61" arabicName="إيقاف إعادة تركيب" />
1129:                      case 61: { break; }
1130:   
1131:                      // below: <service id="43" arabicName="تنازل" />
1132:                      case 43:
1133:                          {
1134:                              serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].Serial++;
1135:                              break;
1136:                          }
1137:   
1138:                      default:
1139:                          {
1140:                              serviceIdIssue += "SrsTest(): Service=" + serviceRequestNumberSerialComplementaryServiceDictionary[serviceSerial].Service + " ServiceId=" + serviceId + " was not recognized. " + "\r\n";
1141:                              break;
1142:                          }
1143:                  }
1144:              }
1145:          }
1146:   
1147:          ////////////////////////////////////////////////////////////////////////////
1148:          ////////////////////////////////////////////////////////////////////////////
1149:      }
1150:   
1151:      ////////////////////////////////////////////////////////////////////////////
1152:      ////////////////////////////////////////////////////////////////////////////
1153:  }