1: using System.Collections.Generic;
2:
3: namespace Ia.Ngn.Cl.Model.Data
4: {
5: ////////////////////////////////////////////////////////////////////////////
6:
7: /// <summary publish="true">
8: /// MSMQ support class for Next Generation Network (NGN) data model.
9: /// </summary>
10: ///
11: /// <remarks>
12: /// Copyright © 2018-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
13: ///
14: /// 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
15: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
16: ///
17: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
18: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19: ///
20: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
21: ///
22: /// Copyright notice: This notice may not be removed or altered from any source distribution.
23: /// </remarks>
24: public abstract partial class Msmq
25: {
26: ////////////////////////////////////////////////////////////////////////////
27:
28: /// <summary>
29: ///
30: /// </summary>
31: public class Queue
32: {
33: // I can't use properties from child classes in virtual function in parents
34: // there is a reason why I can't construct a virtual abstract method
35: }
36:
37: ////////////////////////////////////////////////////////////////////////////
38:
39: /// <summary>
40: ///
41: /// </summary>
42: public abstract class ServiceQueue : Queue
43: {
44: protected static readonly string serviceApplicationQueueName = "msmq/data/default/queue/service/service-application";
45: protected static readonly string netManagerApplicationQueueName = "msmq/data/default/queue/service/net-manager-application";
46: protected static readonly string serviceRequestApplicationQueueName = "msmq/data/default/queue/service/service-request-application";
47: protected static readonly string spsApplicationQueueName = "msmq/data/default/queue/service/sps-application";
48: protected static readonly string softXApplicationQueueName = "msmq/data/default/queue/service/softx-application";
49: protected static readonly string axeApplicationQueueName = "msmq/data/default/queue/service/axe-application";
50:
51: public enum Process { Read };
52:
53: ////////////////////////////////////////////////////////////////////////////
54:
55: /// <summary>
56: ///
57: /// </summary>
58: public static void Enqueue(string service)
59: {
60: Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
61: Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pstn pstn;
62:
63: Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Process process;
64:
65: process = Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Process.Read;
66:
67: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceRequestApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(serviceRequestApplicationQueueName, process.ToString().ToLower(), service);
68:
69: switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
70:
71: if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia || switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
72: {
73: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(serviceApplicationQueueName, process.ToString().ToLower(), service);
74: }
75:
76: // if service belongs to PSTN:
77: if (Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinPstnDomainList(service))
78: {
79: // test to see if service is in Siemens EWSD or Ericsson AXE
80: pstn = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnFromService(service);
81:
82: if (pstn.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.SiemensEwsd)
83: {
84: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.NetManagerApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(netManagerApplicationQueueName, process.ToString().ToLower(), service);
85: }
86: else if (pstn.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.EricssonAxe)
87: {
88: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.AxeApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(axeApplicationQueueName, process.ToString().ToLower(), service);
89: }
90: else
91: {
92:
93: }
94:
95: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.SpsApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(spsApplicationQueueName, process.ToString().ToLower(), service);
96: }
97:
98: if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
99: {
100: // Huawei IMS-Nokia GPON areas
101:
102: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.SoftXApplication.List.Contains(service))
103: {
104: Ia.Cl.Model.Msmq.SendPrivate(softXApplicationQueueName, process.ToString().ToLower(), service);
105: }
106: }
107: }
108:
109: ////////////////////////////////////////////////////////////////////////////
110:
111: /// <summary>
112: ///
113: /// </summary>
114: public static void Enqueue(List<string> serviceList)
115: {
116: foreach(string service in serviceList) Enqueue(service);
117: }
118:
119: ////////////////////////////////////////////////////////////////////////////
120:
121: /// <summary>
122: ///
123: /// </summary>
124: public abstract class ServiceApplication
125: {
126: private static readonly string queueName = serviceApplicationQueueName;
127:
128: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
129: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
130: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
131: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
132: }
133:
134: ////////////////////////////////////////////////////////////////////////////
135:
136: /// <summary>
137: ///
138: /// </summary>
139: public abstract class NetManagerApplication
140: {
141: private static readonly string queueName = netManagerApplicationQueueName;
142:
143: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
144: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
145: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
146: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
147: }
148:
149: ////////////////////////////////////////////////////////////////////////////
150:
151: /// <summary>
152: ///
153: /// </summary>
154: public abstract class ServiceRequestApplication
155: {
156: private static readonly string queueName = serviceRequestApplicationQueueName;
157:
158: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
159: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
160: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
161: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
162: }
163:
164: ////////////////////////////////////////////////////////////////////////////
165:
166: /// <summary>
167: ///
168: /// </summary>
169: public abstract class SpsApplication
170: {
171: private static readonly string queueName = spsApplicationQueueName;
172:
173: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
174: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
175: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
176: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
177: }
178:
179: ////////////////////////////////////////////////////////////////////////////
180:
181: /// <summary>
182: ///
183: /// </summary>
184: public abstract class SoftXApplication
185: {
186: private static readonly string queueName = softXApplicationQueueName;
187:
188: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
189: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
190: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
191: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
192: }
193:
194: ////////////////////////////////////////////////////////////////////////////
195:
196: /// <summary>
197: ///
198: /// </summary>
199: public abstract class AxeApplication
200: {
201: private static readonly string queueName = axeApplicationQueueName;
202:
203: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
204: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
205: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
206: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
207: }
208:
209: ////////////////////////////////////////////////////////////////////////////
210: ////////////////////////////////////////////////////////////////////////////
211:
212: /// <summary>
213: ///
214: /// </summary>
215: public abstract class ServiceSuspensionQueue
216: {
217: protected static readonly string provisionApplicationQueueName = "msmq/data/default/queue/service/service-suspension/provision-application";
218:
219: ////////////////////////////////////////////////////////////////////////////
220:
221: /// <summary>
222: ///
223: /// </summary>
224: public static void Enqueue(string service)
225: {
226: Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor switchVendor;
227:
228: Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Process process;
229:
230: process = Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Process.Read;
231:
232: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceRequestApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(serviceRequestApplicationQueueName, process.ToString().ToLower(), service);
233:
234: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceSuspensionQueue.ProvisionApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(provisionApplicationQueueName, process.ToString().ToLower(), service);
235:
236: switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorFromService(service);
237:
238: if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia || switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
239: {
240: if (!Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.ServiceApplication.List.Contains(service)) Ia.Cl.Model.Msmq.SendPrivate(serviceApplicationQueueName, process.ToString().ToLower(), service);
241: }
242: }
243:
244: ////////////////////////////////////////////////////////////////////////////
245:
246: /// <summary>
247: ///
248: /// </summary>
249: public abstract class ProvisionApplication
250: {
251: private static readonly string queueName = provisionApplicationQueueName;
252:
253: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
254: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
255: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
256: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
257: }
258:
259: ////////////////////////////////////////////////////////////////////////////
260: ////////////////////////////////////////////////////////////////////////////
261: }
262:
263: ////////////////////////////////////////////////////////////////////////////
264: ////////////////////////////////////////////////////////////////////////////
265: }
266:
267: ////////////////////////////////////////////////////////////////////////////
268: ////////////////////////////////////////////////////////////////////////////
269:
270:
271:
272:
273:
274:
275: ////////////////////////////////////////////////////////////////////////////
276: ////////////////////////////////////////////////////////////////////////////
277:
278: /// <summary>
279: ///
280: /// </summary>
281: public abstract class AccessNameQueue : Queue
282: {
283: protected static readonly string amsApplicationQueueName = "msmq/data/default/queue/access-name/ams-application";
284: protected static readonly string nceApplicationQueueName = "msmq/data/default/queue/access-name/nce-application";
285: protected static readonly string softXApplicationQueueName = "msmq/data/default/queue/access-name/softx-application";
286:
287:
288: public enum Process { Read, Reset };
289:
290: /// <summary/>
291: public class AccessNameProcess
292: {
293: /// <summary/>
294: public string AccessName { get; set; }
295:
296: /// <summary/>
297: public Process Process { get; set; }
298:
299: /// <summary/>
300: public AccessNameProcess(string accessName, Process process)
301: {
302: AccessName = accessName;
303: Process = process;
304: }
305: };
306:
307: ////////////////////////////////////////////////////////////////////////////
308:
309: /// <summary>
310: ///
311: /// </summary>
312: public static void Enqueue(string accessName)
313: {
314: var switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorByAccessName(accessName);
315: var accessVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorByAccessName(accessName);
316:
317: var process = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.Read;
318:
319: if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
320: {
321: // I will check if the items is in the list, if not I will enqueue
322: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.AmsApplication.List.Contains(accessName))
323: {
324: Ia.Cl.Model.Msmq.SendPrivate(amsApplicationQueueName, process.ToString().ToLower(), accessName);
325: }
326:
327: if(switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
328: {
329: // Huawei IMS-Nokia GPON areas
330:
331: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.SoftXApplication.List.Contains(accessName))
332: {
333: Ia.Cl.Model.Msmq.SendPrivate(softXApplicationQueueName, process.ToString().ToLower(), accessName);
334: }
335: }
336: }
337: else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
338: {
339: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.NceApplication.List.Contains(accessName))
340: {
341: Ia.Cl.Model.Msmq.SendPrivate(nceApplicationQueueName, process.ToString().ToLower(), accessName);
342: }
343: }
344: else
345: {
346:
347: }
348: }
349:
350: ////////////////////////////////////////////////////////////////////////////
351:
352: /// <summary>
353: ///
354: /// </summary>
355: public static void Enqueue(Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process process, string accessName)
356: {
357: var switchVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SwitchVendorByAccessName(accessName);
358: var accessVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorByAccessName(accessName);
359:
360: if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
361: {
362: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.AmsApplication.List.Contains(accessName))
363: {
364: Ia.Cl.Model.Msmq.SendPrivate(amsApplicationQueueName, process.ToString().ToLower(), accessName);
365: }
366:
367: if (switchVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
368: {
369: // Huawei IMS-Nokia GPON areas
370:
371: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.SoftXApplication.List.Contains(accessName))
372: {
373: Ia.Cl.Model.Msmq.SendPrivate(softXApplicationQueueName, process.ToString().ToLower(), accessName);
374: }
375: }
376: }
377: else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
378: {
379: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.NceApplication.List.Contains(accessName))
380: {
381: Ia.Cl.Model.Msmq.SendPrivate(nceApplicationQueueName, process.ToString().ToLower(), accessName);
382: }
383: }
384: else
385: {
386:
387: }
388: }
389:
390: ////////////////////////////////////////////////////////////////////////////
391:
392: /// <summary>
393: ///
394: /// </summary>
395: public abstract class AmsApplication
396: {
397: private static readonly string queueName = amsApplicationQueueName;
398:
399: public static AccessNameProcess Dequeue
400: {
401: get
402: {
403: Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process process;
404:
405: Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body);
406:
407: switch (label)
408: {
409: case "read": process = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.Read; break;
410: case "reset": process = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.Reset; break;
411: default: process = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.Read; break;
412: }
413:
414: var accessNameProcess = new AccessNameProcess(body, process);
415:
416: return accessNameProcess;
417: }
418: }
419:
420: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
421: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
422: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
423: }
424:
425: ////////////////////////////////////////////////////////////////////////////
426:
427: /// <summary>
428: ///
429: /// </summary>
430: public abstract class NceApplication
431: {
432: private static readonly string queueName = nceApplicationQueueName;
433:
434: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
435: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
436: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
437: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
438: }
439:
440: ////////////////////////////////////////////////////////////////////////////
441:
442: /// <summary>
443: ///
444: /// </summary>
445: public abstract class SoftXApplication
446: {
447: private static readonly string queueName = softXApplicationQueueName;
448:
449: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
450: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
451: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
452: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
453: }
454:
455: ////////////////////////////////////////////////////////////////////////////
456: ////////////////////////////////////////////////////////////////////////////
457:
458: /// <summary>
459: ///
460: /// </summary>
461: public abstract class ProvisionAccessQueue
462: {
463: protected static readonly string provisionApplicationQueueName = "msmq/data/default/queue/access-name/provision-access/provision-application";
464: protected static readonly string serviceRequestApplicationQueueName = "msmq/data/default/queue/access-name/provision-access/service-request-application";
465:
466: ////////////////////////////////////////////////////////////////////////////
467:
468: /// <summary>
469: ///
470: /// </summary>
471: public static void Enqueue(string accessName)
472: {
473: var process = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.Read;
474:
475: var accessVendor = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessVendorByAccessName(accessName);
476:
477: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.ProvisionAccessQueue.ProvisionApplication.List.Contains(accessName))
478: {
479: Ia.Cl.Model.Msmq.SendPrivate(provisionApplicationQueueName, process.ToString().ToLower(), accessName);
480: }
481:
482: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.ProvisionAccessQueue.ServiceRequestApplication.List.Contains(accessName))
483: {
484: Ia.Cl.Model.Msmq.SendPrivate(serviceRequestApplicationQueueName, process.ToString().ToLower(), accessName);
485: }
486:
487: if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
488: {
489: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.AmsApplication.List.Contains(accessName))
490: {
491: Ia.Cl.Model.Msmq.SendPrivate(amsApplicationQueueName, process.ToString().ToLower(), accessName);
492: }
493: }
494: else if (accessVendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
495: {
496: if (!Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.NceApplication.List.Contains(accessName))
497: {
498: Ia.Cl.Model.Msmq.SendPrivate(nceApplicationQueueName, process.ToString().ToLower(), accessName);
499: }
500: }
501: else
502: {
503:
504: }
505: }
506:
507: ////////////////////////////////////////////////////////////////////////////
508:
509: /// <summary>
510: ///
511: /// </summary>
512: public abstract class ProvisionApplication
513: {
514: private static readonly string queueName = provisionApplicationQueueName;
515:
516: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
517: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
518: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
519: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
520: }
521:
522: ////////////////////////////////////////////////////////////////////////////
523:
524: /// <summary>
525: ///
526: /// </summary>
527: public abstract class ServiceRequestApplication
528: {
529: private static readonly string queueName = serviceRequestApplicationQueueName;
530:
531: public static string Dequeue { get { Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body); return body; } }
532: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
533: public static List<string> List { get { return Ia.Cl.Model.Msmq.PeekPrivateList(queueName); } }
534: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
535: }
536:
537: ////////////////////////////////////////////////////////////////////////////
538: ////////////////////////////////////////////////////////////////////////////
539: }
540:
541: ////////////////////////////////////////////////////////////////////////////
542: ////////////////////////////////////////////////////////////////////////////
543: }
544:
545: ////////////////////////////////////////////////////////////////////////////
546: ////////////////////////////////////////////////////////////////////////////
547:
548: /// <summary>
549: ///
550: /// </summary>
551: public abstract class GatewayIdQueue : Queue
552: {
553: protected static readonly string serviceApplicationQueueName = "msmq/data/default/queue/gatewayId/service-application";
554:
555: public enum Process { Read };
556:
557: ////////////////////////////////////////////////////////////////////////////
558:
559: /// <summary>
560: ///
561: /// </summary>
562: public static void Enqueue(int gatewayId)
563: {
564: var process = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Process.Read;
565:
566: if (!Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.ServiceApplication.List.Contains(gatewayId))
567: {
568: Ia.Cl.Model.Msmq.SendPrivate(serviceApplicationQueueName, process.ToString().ToLower(), gatewayId.ToString());
569: }
570: }
571:
572: ////////////////////////////////////////////////////////////////////////////
573:
574: /// <summary>
575: ///
576: /// </summary>
577: public abstract class ServiceApplication
578: {
579: private static readonly string queueName = serviceApplicationQueueName;
580:
581: ////////////////////////////////////////////////////////////////////////////
582:
583: /// <summary>
584: ///
585: /// </summary>
586: public static int Dequeue
587: {
588: get
589: {
590: Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body);
591:
592: int.TryParse(body, out int gatewayId);
593:
594: return gatewayId;
595: }
596: }
597:
598: public static string Peek { get { Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body); return body; } }
599: public static List<int> List
600: {
601: get
602: {
603: List<int> gatewayIdList;
604:
605: gatewayIdList = new List<int>();
606:
607: foreach (string s in Ia.Cl.Model.Msmq.PeekPrivateList(queueName))
608: {
609: if (int.TryParse(s, out int gatewayId)) gatewayIdList.Add(gatewayId);
610: }
611:
612: return gatewayIdList;
613: }
614: }
615: public static long Count { get { return Ia.Cl.Model.Msmq.Count(queueName); } }
616: }
617:
618: ////////////////////////////////////////////////////////////////////////////
619: ////////////////////////////////////////////////////////////////////////////
620: }
621:
622: ////////////////////////////////////////////////////////////////////////////
623: ////////////////////////////////////////////////////////////////////////////
624:
625: /// <summary>
626: ///
627: /// </summary>
628: public abstract class System : Queue
629: {
630: protected static readonly string queueName = "msmq/data/default/queue/system";
631:
632: ////////////////////////////////////////////////////////////////////////////
633:
634: /// <summary>
635: ///
636: /// </summary>
637: public static void Enqueue(string sender, string message)
638: {
639: Ia.Cl.Model.Msmq.SendPrivate(queueName, sender, message);
640: }
641:
642: ////////////////////////////////////////////////////////////////////////////
643:
644: /// <summary>
645: ///
646: /// </summary>
647: public static string Dequeue
648: {
649: get
650: {
651: Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body);
652:
653: return body;
654: }
655: }
656:
657: ////////////////////////////////////////////////////////////////////////////
658:
659: /// <summary>
660: ///
661: /// </summary>
662: public static string Peek
663: {
664: get
665: {
666: Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body);
667:
668: return body;
669: }
670: }
671:
672: ////////////////////////////////////////////////////////////////////////////
673:
674: /// <summary>
675: ///
676: /// </summary>
677: public static List<string> List
678: {
679: get
680: {
681: List<string> list;
682:
683: list = new List<string>();
684:
685: foreach (string s in Ia.Cl.Model.Msmq.PeekPrivateList(queueName)) list.Add(s);
686:
687: return list;
688: }
689: }
690:
691: ////////////////////////////////////////////////////////////////////////////
692:
693: /// <summary>
694: ///
695: /// </summary>
696: public static long Count
697: {
698: get
699: {
700: return Ia.Cl.Model.Msmq.Count(queueName);
701: }
702: }
703:
704: ////////////////////////////////////////////////////////////////////////////
705: ////////////////////////////////////////////////////////////////////////////
706: }
707:
708: ////////////////////////////////////////////////////////////////////////////
709: ////////////////////////////////////////////////////////////////////////////
710:
711:
712:
713:
714: ////////////////////////////////////////////////////////////////////////////
715: ////////////////////////////////////////////////////////////////////////////
716:
717: /// <summary>
718: ///
719: /// </summary>
720: public sealed class NewAccessFlag
721: {
722: private const string queueName = "msmq/data/default/flag/new-access";
723:
724: /// <summary/>
725: public static void Set()
726: {
727: Ia.Cl.Model.Msmq.SendPrivate(queueName, "set", true.ToString());
728: }
729:
730: /// <summary/>
731: public static void Reset()
732: {
733: Ia.Cl.Model.Msmq.SendPrivate(queueName, "reset", false.ToString());
734: }
735:
736: /// <summary/>
737: public static bool Read
738: {
739: get
740: {
741: bool b;
742:
743: Ia.Cl.Model.Msmq.RecievePrivate(queueName, out string label, out string body);
744:
745: b = bool.TryParse(body.ToString(), out b) ? b : false;
746:
747: return b;
748: }
749: }
750:
751: /// <summary/>
752: public static bool Peek
753: {
754: get
755: {
756: bool b;
757:
758: Ia.Cl.Model.Msmq.PeekPrivate(queueName, out string label, out string body);
759:
760: b = bool.TryParse(body.ToString(), out b) ? b : false;
761:
762: return b;
763: }
764: }
765: }
766:
767: ////////////////////////////////////////////////////////////////////////////
768: ////////////////////////////////////////////////////////////////////////////
769: }
770: }