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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Msmq

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

MSMQ support class for Next Generation Network (NGN) data model.

   1:  using Newtonsoft.Json;
   2:  using System;
   3:  using System.Collections.Generic;
   4:  using System.Xml;
   5:   
   6:  namespace Ia.Ngn.Cl.Model.Data
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// MSMQ support class for Next Generation Network (NGN) data model.
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2018-2021 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 abstract partial class Msmq
  28:      {
  29:          ////////////////////////////////////////////////////////////////////////////
  30:   
  31:          /// <summary>
  32:          ///
  33:          /// </summary>
  34:          public class Queue
  35:          {
  36:              // I can't use properties from child classes in virtual function in parents
  37:              // there is a reason why I can't construct a virtual abstract method
  38:   
  39:              public enum Process { ReadService, UpdateServiceSupplementaryService, ReadAccess, ResetAccess, ReadGateway, CreateReadServiceAccess, DeleteReadServiceAccess };
  40:   
  41:              ////////////////////////////////////////////////////////////////////////////
  42:   
  43:              /// <summary>
  44:              ///
  45:              /// </summary>
  46:              public class Message
  47:              {
  48:                  public Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process Process { get; set; }
  49:                  public string Service { get; set; }
  50:                  public string AccessName { get; set; }
  51:                  public int GatewayId { get; set; }
  52:                  public Ia.Ngn.Cl.Model.Business.Service.SupplementaryService ServiceSupplementaryService { get; set; }
  53:                  public bool ServiceSupplementaryServiceState { get; set; }
  54:                  public Guid Guid { get; set; }
  55:   
  56:                  public string Serialization { get; set; }
  57:   
  58:                  ////////////////////////////////////////////////////////////////////////////
  59:   
  60:                  /// <summary>
  61:                  ///
  62:                  /// </summary>
  63:                  public Message()
  64:                  {
  65:                  }
  66:   
  67:                  ////////////////////////////////////////////////////////////////////////////
  68:   
  69:                  /// <summary>
  70:                  ///
  71:                  /// </summary>
  72:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string serviceOrAccessName)
  73:                  {
  74:                      this.Process = process;
  75:   
  76:                      if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigits(serviceOrAccessName))
  77:                      {
  78:                          this.Service = serviceOrAccessName;
  79:                      }
  80:                      else if (Ia.Ngn.Cl.Model.Business.Access.AccessNameIsInAValidFormat(serviceOrAccessName))
  81:                      {
  82:                          this.AccessName = serviceOrAccessName;
  83:                      }
  84:                      else
  85:                      {
  86:   
  87:                      }
  88:   
  89:                      this.Guid = Guid.Empty;
  90:   
  91:                      this.Serialization = Serialize();
  92:                  }
  93:   
  94:                  ////////////////////////////////////////////////////////////////////////////
  95:   
  96:                  /// <summary>
  97:                  ///
  98:                  /// </summary>
  99:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string serviceOrAccessName, Guid guid)
 100:                  {
 101:                      this.Process = process;
 102:   
 103:                      if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigits(serviceOrAccessName))
 104:                      {
 105:                          this.Service = serviceOrAccessName;
 106:                      }
 107:                      else if (Ia.Ngn.Cl.Model.Business.Access.AccessNameIsInAValidFormat(serviceOrAccessName))
 108:                      {
 109:                          this.AccessName = serviceOrAccessName;
 110:                      }
 111:                      else
 112:                      {
 113:   
 114:                      }
 115:   
 116:                      this.Guid = guid;
 117:   
 118:                      this.Serialization = Serialize();
 119:                  }
 120:   
 121:                  ////////////////////////////////////////////////////////////////////////////
 122:   
 123:                  /// <summary>
 124:                  ///
 125:                  /// </summary>
 126:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, int gatewayId)
 127:                  {
 128:                      this.Process = process;
 129:                      this.GatewayId = gatewayId;
 130:                      this.Guid = Guid.Empty;
 131:   
 132:                      this.Serialization = Serialize();
 133:                  }
 134:   
 135:                  ////////////////////////////////////////////////////////////////////////////
 136:   
 137:                  /// <summary>
 138:                  ///
 139:                  /// </summary>
 140:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, int gatewayId, Guid guid)
 141:                  {
 142:                      this.Process = process;
 143:                      this.GatewayId = gatewayId;
 144:                      this.Guid = guid;
 145:   
 146:                      this.Serialization = Serialize();
 147:                  }
 148:   
 149:                  ////////////////////////////////////////////////////////////////////////////
 150:   
 151:                  /// <summary>
 152:                  ///
 153:                  /// </summary>
 154:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string service, string accessName)
 155:                  {
 156:                      this.Process = process;
 157:                      this.Service = service;
 158:                      this.AccessName = accessName;
 159:                      this.Guid = Guid.Empty;
 160:   
 161:                      this.Serialization = Serialize();
 162:                  }
 163:   
 164:                  ////////////////////////////////////////////////////////////////////////////
 165:   
 166:                  /// <summary>
 167:                  ///
 168:                  /// </summary>
 169:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string service, string accessName, Guid guid)
 170:                  {
 171:                      this.Process = process;
 172:                      this.Service = service;
 173:                      this.AccessName = accessName;
 174:                      this.Guid = guid;
 175:   
 176:                      this.Serialization = Serialize();
 177:                  }
 178:   
 179:                  ////////////////////////////////////////////////////////////////////////////
 180:   
 181:                  /// <summary>
 182:                  ///
 183:                  /// </summary>
 184:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService serviceSupplementaryService, bool serviceSupplementaryServiceState)
 185:                  {
 186:                      this.Process = process;
 187:                      this.Service = service;
 188:                      this.ServiceSupplementaryService = serviceSupplementaryService;
 189:                      this.ServiceSupplementaryServiceState = serviceSupplementaryServiceState;
 190:                      this.Guid = Guid.Empty;
 191:   
 192:                      this.Serialization = Serialize();
 193:                  }
 194:   
 195:                  ////////////////////////////////////////////////////////////////////////////
 196:   
 197:                  /// <summary>
 198:                  ///
 199:                  /// </summary>
 200:                  public Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService serviceSupplementaryService, bool serviceSupplementaryServiceState, Guid guid)
 201:                  {
 202:                      this.Process = process;
 203:                      this.Service = service;
 204:                      this.ServiceSupplementaryService = serviceSupplementaryService;
 205:                      this.ServiceSupplementaryServiceState = serviceSupplementaryServiceState;
 206:                      this.Guid = guid;
 207:   
 208:                      this.Serialization = Serialize();
 209:                  }
 210:   
 211:                  ////////////////////////////////////////////////////////////////////////////
 212:   
 213:                  /// <summary>
 214:                  ///
 215:                  /// </summary>
 216:                  public static Message Deserialize(string json)
 217:                  {
 218:                      Message message;
 219:   
 220:                      if (!string.IsNullOrEmpty(json))
 221:                      {
 222:                          message = JsonConvert.DeserializeObject<Message>(json);
 223:   
 224:                          message.Serialization = json;
 225:                      }
 226:                      else message = default(Message);
 227:   
 228:                      return message;
 229:                  }
 230:   
 231:                  ////////////////////////////////////////////////////////////////////////////
 232:   
 233:                  /// <summary>
 234:                  ///
 235:                  /// </summary>
 236:                  private string Serialize()
 237:                  {
 238:                      return JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
 239:                  }
 240:   
 241:                  ////////////////////////////////////////////////////////////////////////////
 242:              }
 243:   
 244:              ////////////////////////////////////////////////////////////////////////////
 245:              ////////////////////////////////////////////////////////////////////////////
 246:          }
 247:   
 248:          ////////////////////////////////////////////////////////////////////////////
 249:   
 250:          /// <summary>
 251:          ///
 252:          /// </summary>
 253:          public abstract class ServiceQueue : Queue
 254:          {
 255:              protected static readonly string serviceApplicationQueueName = "msmq/data/default/queue/service/service-application";
 256:              protected static readonly string netManagerApplicationQueueName = "msmq/data/default/queue/service/net-manager-application";
 257:              protected static readonly string serviceRequestApplicationQueueName = "msmq/data/default/queue/service/service-request-application";
 258:              protected static readonly string spsApplicationQueueName = "msmq/data/default/queue/service/sps-application";
 259:              protected static readonly string softXApplicationQueueName = "msmq/data/default/queue/service/softx-application";
 260:              protected static readonly string axeApplicationQueueName = "msmq/data/default/queue/service/axe-application";
 261:   
 262:              ////////////////////////////////////////////////////////////////////////////
 263:   
 264:              /// <summary>
 265:              ///
 266:              /// </summary>
 267:              public static void Enqueue(string service)
 268:              {
 269:                  Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process.ReadService, service);
 270:              }
 271:   
 272:              ////////////////////////////////////////////////////////////////////////////
 273:   
 274:              /// <summary>
 275:              ///
 276:              /// </summary>
 277:              public static void Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process process, string service)
 278:              {
 279:                  Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
 280:                  Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pstn pstn;
 281:   
 282:                  var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(process, service);
 283:   
 284:                  if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceRequestApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(serviceRequestApplicationQueueName, message.Process.ToString(), message.Serialization);
 285:   
 286:                  switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(message.Service);
 287:   
 288:                  if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia || switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 289:                  {
 290:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(serviceApplicationQueueName, message.Process.ToString(), message.Serialization);
 291:                  }
 292:   
 293:                  // if service belongs to PSTN:
 294:                  if (Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinPstnDomainList(message.Service))
 295:                  {
 296:                      // test to see if service is in Siemens EWSD or Ericsson AXE
 297:                      pstn = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnFromService(message.Service);
 298:   
 299:                      if (pstn.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.SiemensEwsd)
 300:                      {
 301:                          if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.NetManagerApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(netManagerApplicationQueueName, message.Process.ToString(), message.Serialization);
 302:                      }
 303:                      else if (pstn.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.EricssonAxe)
 304:                      {
 305:                          if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.AxeApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(axeApplicationQueueName, message.Process.ToString(), message.Serialization);
 306:                      }
 307:                      else
 308:                      {
 309:   
 310:                      }
 311:   
 312:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.SpsApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(spsApplicationQueueName, message.Process.ToString(), message.Serialization);
 313:                  }
 314:   
 315:                  if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 316:                  {
 317:                      // Huawei IMS-Nokia GPON areas
 318:   
 319:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.SoftXApplication.List.Contains(message.Serialization))
 320:                      {
 321:                          Ia.Cl.Model.Msmq.SendPrivate(softXApplicationQueueName, message.Process.ToString(), message.Serialization);
 322:                      }
 323:                  }
 324:              }
 325:   
 326:              ////////////////////////////////////////////////////////////////////////////
 327:   
 328:              /// <summary>
 329:              ///
 330:              /// </summary>
 331:              public static void Enqueue(List<string> serviceList)
 332:              {
 333:                  foreach (string service in serviceList) Enqueue(service);
 334:              }
 335:   
 336:              ////////////////////////////////////////////////////////////////////////////
 337:   
 338:              /// <summary>
 339:              ///
 340:              /// </summary>
 341:              public abstract class ServiceApplication
 342:              {
 343:                  private static readonly string queueName = serviceApplicationQueueName;
 344:   
 345:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 346:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 347:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 348:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 349:              }
 350:   
 351:              ////////////////////////////////////////////////////////////////////////////
 352:   
 353:              /// <summary>
 354:              ///
 355:              /// </summary>
 356:              public abstract class NetManagerApplication
 357:              {
 358:                  private static readonly string queueName = netManagerApplicationQueueName;
 359:   
 360:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 361:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 362:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 363:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 364:              }
 365:   
 366:              ////////////////////////////////////////////////////////////////////////////
 367:   
 368:              /// <summary>
 369:              ///
 370:              /// </summary>
 371:              public abstract class ServiceRequestApplication
 372:              {
 373:                  private static readonly string queueName = serviceRequestApplicationQueueName;
 374:   
 375:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 376:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 377:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 378:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 379:              }
 380:   
 381:              ////////////////////////////////////////////////////////////////////////////
 382:   
 383:              /// <summary>
 384:              ///
 385:              /// </summary>
 386:              public abstract class SpsApplication
 387:              {
 388:                  private static readonly string queueName = spsApplicationQueueName;
 389:   
 390:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 391:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 392:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 393:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 394:              }
 395:   
 396:              ////////////////////////////////////////////////////////////////////////////
 397:   
 398:              /// <summary>
 399:              ///
 400:              /// </summary>
 401:              public abstract class SoftXApplication
 402:              {
 403:                  private static readonly string queueName = softXApplicationQueueName;
 404:   
 405:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 406:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 407:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 408:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 409:              }
 410:   
 411:              ////////////////////////////////////////////////////////////////////////////
 412:   
 413:              /// <summary>
 414:              ///
 415:              /// </summary>
 416:              public abstract class AxeApplication
 417:              {
 418:                  private static readonly string queueName = axeApplicationQueueName;
 419:   
 420:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 421:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 422:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 423:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 424:              }
 425:   
 426:              ////////////////////////////////////////////////////////////////////////////
 427:              ////////////////////////////////////////////////////////////////////////////
 428:   
 429:              /// <summary>
 430:              ///
 431:              /// </summary>
 432:              public abstract class ServiceSuspensionQueue
 433:              {
 434:                  protected static readonly string provisionApplicationQueueName = "msmq/data/default/queue/service/service-suspension/provision-application";
 435:   
 436:                  ////////////////////////////////////////////////////////////////////////////
 437:   
 438:                  /// <summary>
 439:                  ///
 440:                  /// </summary>
 441:                  public static void Enqueue(string service)
 442:                  {
 443:                      Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
 444:   
 445:                      var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process.ReadService, service);
 446:   
 447:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceRequestApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(serviceRequestApplicationQueueName, message.Process.ToString(), message.Serialization);
 448:   
 449:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceSuspensionQueue.ProvisionApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(provisionApplicationQueueName, message.Process.ToString(), message.Serialization);
 450:   
 451:                      switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(message.Service);
 452:   
 453:                      if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia || switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 454:                      {
 455:                          if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(serviceApplicationQueueName, message.Process.ToString(), message.Serialization);
 456:                      }
 457:                  }
 458:   
 459:                  ////////////////////////////////////////////////////////////////////////////
 460:   
 461:                  /// <summary>
 462:                  ///
 463:                  /// </summary>
 464:                  public abstract class ProvisionApplication
 465:                  {
 466:                      private static readonly string queueName = provisionApplicationQueueName;
 467:   
 468:                      public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 469:                      public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 470:                      public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 471:                      public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 472:                  }
 473:   
 474:                  ////////////////////////////////////////////////////////////////////////////
 475:                  ////////////////////////////////////////////////////////////////////////////
 476:              }
 477:   
 478:              ////////////////////////////////////////////////////////////////////////////
 479:              ////////////////////////////////////////////////////////////////////////////
 480:          }
 481:   
 482:          ////////////////////////////////////////////////////////////////////////////
 483:          ////////////////////////////////////////////////////////////////////////////
 484:   
 485:   
 486:   
 487:   
 488:   
 489:   
 490:          ////////////////////////////////////////////////////////////////////////////
 491:          ////////////////////////////////////////////////////////////////////////////
 492:   
 493:          /// <summary>
 494:          ///
 495:          /// </summary>
 496:          public abstract class AccessNameQueue : Queue
 497:          {
 498:              protected static readonly string amsApplicationQueueName = "msmq/data/default/queue/access-name/ams-application";
 499:              protected static readonly string nceApplicationQueueName = "msmq/data/default/queue/access-name/nce-application";
 500:              protected static readonly string softXApplicationQueueName = "msmq/data/default/queue/access-name/softx-application";
 501:   
 502:              ////////////////////////////////////////////////////////////////////////////
 503:   
 504:              /// <summary>
 505:              ///
 506:              /// </summary>
 507:              public static void Enqueue(string accessName)
 508:              {
 509:                  Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process.ReadAccess, accessName);
 510:              }
 511:   
 512:              ////////////////////////////////////////////////////////////////////////////
 513:   
 514:              /// <summary>
 515:              ///
 516:              /// </summary>
 517:              public static void Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process process, string accessName)
 518:              {
 519:                  accessName = accessName.ToUpper();
 520:   
 521:                  var switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorByAccessName(accessName);
 522:                  var accessVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorByAccessName(accessName);
 523:   
 524:                  var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(process, accessName);
 525:   
 526:                  if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 527:                  {
 528:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.AmsApplication.List.Contains(message.Serialization))
 529:                      {
 530:                          Ia.Cl.Model.Msmq.SendPrivate(amsApplicationQueueName, message.Process.ToString(), message.Serialization);
 531:                      }
 532:   
 533:                      if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 534:                      {
 535:                          // Huawei IMS-Nokia GPON areas
 536:   
 537:                          if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.SoftXApplication.List.Contains(message.Serialization))
 538:                          {
 539:                              Ia.Cl.Model.Msmq.SendPrivate(softXApplicationQueueName, message.Process.ToString(), message.Serialization);
 540:                          }
 541:                      }
 542:                  }
 543:                  else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 544:                  {
 545:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.NceApplication.List.Contains(message.Serialization))
 546:                      {
 547:                          Ia.Cl.Model.Msmq.SendPrivate(nceApplicationQueueName, message.Process.ToString(), message.Serialization);
 548:                      }
 549:                  }
 550:                  else
 551:                  {
 552:   
 553:                  }
 554:              }
 555:   
 556:              ////////////////////////////////////////////////////////////////////////////
 557:   
 558:              /// <summary>
 559:              ///
 560:              /// </summary>
 561:              public abstract class AmsApplication
 562:              {
 563:                  private static readonly string queueName = amsApplicationQueueName;
 564:   
 565:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 566:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 567:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 568:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 569:              }
 570:   
 571:              ////////////////////////////////////////////////////////////////////////////
 572:   
 573:              /// <summary>
 574:              ///
 575:              /// </summary>
 576:              public abstract class NceApplication
 577:              {
 578:                  private static readonly string queueName = nceApplicationQueueName;
 579:   
 580:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 581:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 582:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 583:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 584:              }
 585:   
 586:              ////////////////////////////////////////////////////////////////////////////
 587:   
 588:              /// <summary>
 589:              ///
 590:              /// </summary>
 591:              public abstract class SoftXApplication
 592:              {
 593:                  private static readonly string queueName = softXApplicationQueueName;
 594:   
 595:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 596:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 597:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 598:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 599:              }
 600:   
 601:              ////////////////////////////////////////////////////////////////////////////
 602:              ////////////////////////////////////////////////////////////////////////////
 603:   
 604:              /// <summary>
 605:              ///
 606:              /// </summary>
 607:              public abstract class ProvisionAccessQueue
 608:              {
 609:                  protected static readonly string provisionApplicationQueueName = "msmq/data/default/queue/access-name/provision-access/provision-application";
 610:                  protected static readonly string serviceRequestApplicationQueueName = "msmq/data/default/queue/access-name/provision-access/service-request-application";
 611:   
 612:                  ////////////////////////////////////////////////////////////////////////////
 613:   
 614:                  /// <summary>
 615:                  ///
 616:                  /// </summary>
 617:                  public static void Enqueue(string accessName)
 618:                  {
 619:                      accessName = accessName.ToUpper();
 620:   
 621:                      var accessVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorByAccessName(accessName);
 622:   
 623:                      var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.ReadAccess, accessName);
 624:   
 625:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.ProvisionAccessQueue.ProvisionApplication.List.Contains(message.Serialization))
 626:                      {
 627:                          Ia.Cl.Model.Msmq.SendPrivate(provisionApplicationQueueName, message.Process.ToString(), message.Serialization);
 628:                      }
 629:   
 630:                      if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.ProvisionAccessQueue.ServiceRequestApplication.List.Contains(message.Serialization))
 631:                      {
 632:                          Ia.Cl.Model.Msmq.SendPrivate(serviceRequestApplicationQueueName, message.Process.ToString(), message.Serialization);
 633:                      }
 634:   
 635:                      if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
 636:                      {
 637:                          if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.AmsApplication.List.Contains(message.Serialization))
 638:                          {
 639:                              Ia.Cl.Model.Msmq.SendPrivate(amsApplicationQueueName, message.Process.ToString(), message.Serialization);
 640:                          }
 641:                      }
 642:                      else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
 643:                      {
 644:                          if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.NceApplication.List.Contains(message.Serialization))
 645:                          {
 646:                              Ia.Cl.Model.Msmq.SendPrivate(nceApplicationQueueName, message.Process.ToString(), message.Serialization);
 647:                          }
 648:                      }
 649:                      else
 650:                      {
 651:   
 652:                      }
 653:                  }
 654:   
 655:                  ////////////////////////////////////////////////////////////////////////////
 656:   
 657:                  /// <summary>
 658:                  ///
 659:                  /// </summary>
 660:                  public abstract class ProvisionApplication
 661:                  {
 662:                      private static readonly string queueName = provisionApplicationQueueName;
 663:   
 664:                      public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 665:                      public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 666:                      public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 667:                      public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 668:                  }
 669:   
 670:                  ////////////////////////////////////////////////////////////////////////////
 671:   
 672:                  /// <summary>
 673:                  ///
 674:                  /// </summary>
 675:                  public abstract class ServiceRequestApplication
 676:                  {
 677:                      private static readonly string queueName = serviceRequestApplicationQueueName;
 678:   
 679:                      public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 680:                      public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 681:                      public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 682:                      public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 683:                  }
 684:   
 685:                  ////////////////////////////////////////////////////////////////////////////
 686:                  ////////////////////////////////////////////////////////////////////////////
 687:              }
 688:   
 689:              ////////////////////////////////////////////////////////////////////////////
 690:              ////////////////////////////////////////////////////////////////////////////
 691:          }
 692:   
 693:          ////////////////////////////////////////////////////////////////////////////
 694:          ////////////////////////////////////////////////////////////////////////////
 695:   
 696:   
 697:   
 698:   
 699:   
 700:   
 701:          ////////////////////////////////////////////////////////////////////////////
 702:          ////////////////////////////////////////////////////////////////////////////
 703:   
 704:          /// <summary>
 705:          ///
 706:          /// </summary>
 707:          public abstract class GatewayIdQueue : Queue
 708:          {
 709:              protected static readonly string serviceApplicationQueueName = "msmq/data/default/queue/gatewayId/service-application";
 710:   
 711:              ////////////////////////////////////////////////////////////////////////////
 712:   
 713:              /// <summary>
 714:              ///
 715:              /// </summary>
 716:              public static void Enqueue(int gatewayId)
 717:              {
 718:                  var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.ReadGateway, gatewayId);
 719:   
 720:                  if (!Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.ServiceApplication.List.Contains(message.Serialization))
 721:                  {
 722:                      Ia.Cl.Model.Msmq.SendPrivate(serviceApplicationQueueName, message.Process.ToString(), message.Serialization);
 723:                  }
 724:              }
 725:   
 726:              ////////////////////////////////////////////////////////////////////////////
 727:   
 728:              /// <summary>
 729:              ///
 730:              /// </summary>
 731:              public abstract class ServiceApplication
 732:              {
 733:                  private static readonly string queueName = serviceApplicationQueueName;
 734:   
 735:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 736:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 737:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 738:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 739:              }
 740:   
 741:              ////////////////////////////////////////////////////////////////////////////
 742:              ////////////////////////////////////////////////////////////////////////////
 743:          }
 744:   
 745:          ////////////////////////////////////////////////////////////////////////////
 746:          ////////////////////////////////////////////////////////////////////////////
 747:   
 748:   
 749:   
 750:   
 751:   
 752:          ////////////////////////////////////////////////////////////////////////////
 753:          ////////////////////////////////////////////////////////////////////////////
 754:   
 755:          /// <summary>
 756:          ///
 757:          /// </summary>
 758:          public abstract class ProvisionQueue : Queue
 759:          {
 760:              protected static readonly string provisionApplicationQueueName = "msmq/data/default/queue/provision/provision-application";
 761:              protected static readonly string nceApplicationQueueName = "msmq/data/default/queue/provision/nce-application";
 762:   
 763:              ////////////////////////////////////////////////////////////////////////////
 764:   
 765:              /// <summary>
 766:              ///
 767:              /// </summary>
 768:              public static void Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string service, string accessName, Guid staffUserId)
 769:              {
 770:                  var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(process, service, accessName, staffUserId);
 771:   
 772:                  if (!Ia.Ngn.Cl.Model.Data.Msmq.ProvisionQueue.ProvisionApplication.List.Contains(message.Serialization))
 773:                  {
 774:                      Ia.Cl.Model.Msmq.SendPrivate(provisionApplicationQueueName, message.Process.ToString(), message.Serialization);
 775:                  }
 776:   
 777:                  if (!Ia.Ngn.Cl.Model.Data.Msmq.ProvisionQueue.NceApplication.List.Contains(message.Serialization))
 778:                  {
 779:                      Ia.Cl.Model.Msmq.SendPrivate(nceApplicationQueueName, message.Process.ToString(), message.Serialization);
 780:                  }
 781:              }
 782:   
 783:              ////////////////////////////////////////////////////////////////////////////
 784:   
 785:              /// <summary>
 786:              ///
 787:              /// </summary>
 788:              public static void Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.Queue.Process process, string service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService supplementaryService, bool supplementaryServiceState, Guid staffUserId)
 789:              {
 790:                  var message = new Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message(process, service, supplementaryService, supplementaryServiceState, staffUserId);
 791:   
 792:                  if (!Ia.Ngn.Cl.Model.Data.Msmq.ProvisionQueue.ProvisionApplication.List.Contains(message.Serialization)) Ia.Cl.Model.Msmq.SendPrivate(provisionApplicationQueueName, message.Process.ToString(), message.Serialization);
 793:              }
 794:   
 795:              ////////////////////////////////////////////////////////////////////////////
 796:   
 797:              /// <summary>
 798:              ///
 799:              /// </summary>
 800:              public abstract class ProvisionApplication
 801:              {
 802:                  private static readonly string queueName = provisionApplicationQueueName;
 803:   
 804:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 805:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 806:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 807:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 808:              }
 809:   
 810:              ////////////////////////////////////////////////////////////////////////////
 811:   
 812:              /// <summary>
 813:              ///
 814:              /// </summary>
 815:              public abstract class NceApplication
 816:              {
 817:                  private static readonly string queueName = nceApplicationQueueName;
 818:   
 819:                  public static Message Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 820:                  public static Message Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return Ia.Ngn.Cl.Model.Data.Msmq.Queue.Message.Deserialize(body); } }
 821:                  public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
 822:                  public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
 823:              }
 824:   
 825:              ////////////////////////////////////////////////////////////////////////////
 826:              ////////////////////////////////////////////////////////////////////////////
 827:          }
 828:   
 829:          ////////////////////////////////////////////////////////////////////////////
 830:          ////////////////////////////////////////////////////////////////////////////
 831:   
 832:   
 833:   
 834:   
 835:   
 836:          ////////////////////////////////////////////////////////////////////////////
 837:          ////////////////////////////////////////////////////////////////////////////
 838:   
 839:          /// <summary>
 840:          ///
 841:          /// </summary>
 842:          public abstract class System : Queue
 843:          {
 844:              protected static readonly string queueName = "msmq/data/default/queue/system";
 845:   
 846:              ////////////////////////////////////////////////////////////////////////////
 847:   
 848:              /// <summary>
 849:              ///
 850:              /// </summary>
 851:              public static void Enqueue(string sender, string message)
 852:              {
 853:                  Ia.Cl.Model.Msmq.SendPrivate(queueName, sender, message);
 854:              }
 855:   
 856:              ////////////////////////////////////////////////////////////////////////////
 857:   
 858:              /// <summary>
 859:              ///
 860:              /// </summary>
 861:              public static string Dequeue
 862:              {
 863:                  get
 864:                  {
 865:                      Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body);
 866:   
 867:                      return body;
 868:                  }
 869:              }
 870:   
 871:              ////////////////////////////////////////////////////////////////////////////
 872:   
 873:              /// <summary>
 874:              ///
 875:              /// </summary>
 876:              public static string Peek
 877:              {
 878:                  get
 879:                  {
 880:                      Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body);
 881:   
 882:                      return body;
 883:                  }
 884:              }
 885:   
 886:              ////////////////////////////////////////////////////////////////////////////
 887:   
 888:              /// <summary>
 889:              ///
 890:              /// </summary>
 891:              public static List<string> List
 892:              {
 893:                  get
 894:                  {
 895:                      List<string> list;
 896:   
 897:                      list = new List<string>();
 898:   
 899:                      foreach (string s in Ia.Cl.Model.Msmq.PeekPrivateList(queueName)) list.Add(s);
 900:   
 901:                      return list;
 902:                  }
 903:              }
 904:   
 905:              ////////////////////////////////////////////////////////////////////////////
 906:   
 907:              /// <summary>
 908:              ///
 909:              /// </summary>
 910:              public static long Count
 911:              {
 912:                  get
 913:                  {
 914:                      return Ia.Cl.Model.Msmq.Count(queueName);
 915:                  }
 916:              }
 917:   
 918:              ////////////////////////////////////////////////////////////////////////////
 919:              ////////////////////////////////////////////////////////////////////////////
 920:          }
 921:   
 922:          ////////////////////////////////////////////////////////////////////////////
 923:          ////////////////////////////////////////////////////////////////////////////
 924:   
 925:   
 926:   
 927:   
 928:          ////////////////////////////////////////////////////////////////////////////
 929:          ////////////////////////////////////////////////////////////////////////////
 930:   
 931:          /// <summary>
 932:          ///
 933:          /// </summary>
 934:          public sealed class NewAccessFlag
 935:          {
 936:              private const string queueName = "msmq/data/default/flag/new-access";
 937:   
 938:              /// <summary/>
 939:              public static void Set()
 940:              {
 941:                  Ia.Cl.Model.Msmq.SendPrivate(queueName, "set", true.ToString());
 942:              }
 943:   
 944:              /// <summary/>
 945:              public static void Reset()
 946:              {
 947:                  Ia.Cl.Model.Msmq.SendPrivate(queueName, "reset", false.ToString());
 948:              }
 949:   
 950:              /// <summary/>
 951:              public static bool Read
 952:              {
 953:                  get
 954:                  {
 955:                      bool b;
 956:   
 957:                      Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body);
 958:   
 959:                      b = bool.TryParse(body.ToString(), out b) ? b : false;
 960:   
 961:                      return b;
 962:                  }
 963:              }
 964:   
 965:              /// <summary/>
 966:              public static bool Peek
 967:              {
 968:                  get
 969:                  {
 970:                      bool b;
 971:   
 972:                      Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body);
 973:   
 974:                      b = bool.TryParse(body.ToString(), out b) ? b : false;
 975:   
 976:                      return b;
 977:                  }
 978:              }
 979:          }
 980:   
 981:          ////////////////////////////////////////////////////////////////////////////
 982:          ////////////////////////////////////////////////////////////////////////////
 983:      }
 984:  }