1: using Ia.Cl.Model;
2: using Ia.Ngn.Cl.Model.Business;
3: using System;
4: using System.Collections;
5: using System.Collections.Generic;
6: using System.Data;
7: using System.Linq;
8: using System.Runtime.Serialization;
9: using System.Web.Http;
10: using static Ia.Ngn.Ofn.Wa.Api.Model.Controller.ServiceRequestAdministrativeIssueController;
11:
12: namespace Ia.Ngn.Ofn.Wa.Api.Model.Controller
13: {
14: ////////////////////////////////////////////////////////////////////////////
15:
16: /// <summary publish="true">
17: /// Service Request API Controller class of Optical Fiber Network (OFN) model.
18: /// </summary>
19: ///
20: /// <remarks>
21: /// Copyright © 2021-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
22: ///
23: /// 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
24: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
25: ///
26: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
27: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
28: ///
29: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
30: ///
31: /// Copyright notice: This notice may not be removed or altered from any source distribution.
32: /// </remarks>
33: // [Authorize]
34: public partial class ServiceRequestController : ApiController
35: {
36: private static readonly object objectLock = new object();
37:
38: ////////////////////////////////////////////////////////////////////////////
39:
40: /// <summary>
41: /// Service Request: List service request numbers within the Optical Fiber Network
42: /// </summary>
43: public ServiceRequestController() { }
44:
45: /*
46: ////////////////////////////////////////////////////////////////////////////
47: ////////////////////////////////////////////////////////////////////////////
48:
49: /// <summary>
50: ///
51: /// </summary>
52: [HttpGet]
53: [Route("api/v1/service-requests/system-codes")]
54: public Dictionary<int, string> SystemCode()
55: {
56: return Ia.Ngn.Cl.Model.Data.ServiceRequest.SystemCode;
57: }
58:
59: ////////////////////////////////////////////////////////////////////////////
60:
61: /// <summary>
62: ///
63: /// </summary>
64: [HttpGet]
65: [Route("api/v1/service-requests/service-categories")]
66: public SortedList ServiceCategory()
67: {
68: return Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceCategorySortedList;
69: }
70:
71: ////////////////////////////////////////////////////////////////////////////
72:
73: /// <summary>
74: ///
75: /// </summary>
76: [HttpGet]
77: [Route("api/v1/service-requests/services")]
78: public SortedList Service()
79: {
80: return Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList;
81: }
82:
83: ////////////////////////////////////////////////////////////////////////////
84:
85: /// <summary>
86: ///
87: /// </summary>
88: [HttpGet]
89: [Route("api/v1/service-requests/customer-categories")]
90: public SortedList CustomerCategory()
91: {
92: return Ia.Ngn.Cl.Model.Data.ServiceRequest.CustomerCategorySortedList;
93: }
94:
95: ////////////////////////////////////////////////////////////////////////////
96:
97: /// <summary>
98: ///
99: /// </summary>
100: [HttpGet]
101: [Route("api/v1/service-requests/status")]
102: public SortedList Status()
103: {
104: return Ia.Ngn.Cl.Model.Data.ServiceRequest.StatusSortedList;
105: }
106: */
107:
108: ////////////////////////////////////////////////////////////////////////////
109:
110: /// <summary>
111: ///
112: /// </summary>
113: [DataContract(IsReference = true, Namespace = "kw.com.ia.ofn.api.serviceRequest", Name = "PostCreateServiceRequestResponse")]
114: public class PostCreateServiceRequestResponse
115: {
116: /// <summary/>
117: [DataMember]
118: public string Id { get; set; }
119:
120: /// <summary/>
121: [DataMember]
122: public string Service { get; set; }
123:
124: /// <summary/>
125: [DataMember]
126: public string AccessName { get; set; }
127:
128: /// <summary/>
129: [DataMember]
130: public bool IsWithinAllowedToBeProvisionedDomainList { get; set; }
131:
132: /// <summary/>
133: [DataMember]
134: public bool HasValidAction { get; set; }
135:
136: /// <summary/>
137: [DataMember]
138: public bool CallerId { get; set; }
139:
140: /// <summary/>
141: [DataMember]
142: public bool InternationalCalling { get; set; }
143:
144: /// <summary/>
145: [DataMember]
146: public bool InternationalCallingUserControlled { get; set; }
147:
148: /// <summary/>
149: [DataMember]
150: public bool CallForwarding { get; set; }
151:
152: /// <summary/>
153: [DataMember]
154: public bool CallWaiting { get; set; }
155:
156: /// <summary/>
157: [DataMember]
158: public bool ConferenceCall { get; set; }
159:
160: /// <summary/>
161: [DataMember]
162: public bool WakeupCall { get; set; }
163:
164: /// <summary/>
165: [DataMember]
166: public bool AbbriviatedCalling { get; set; }
167:
168: /// <summary/>
169: [DataMember]
170: public DateTime RequestDateTime { get; set; }
171:
172: /// <summary/>
173: [DataMember]
174: public bool IsSuccessful { get; set; }
175: }
176:
177: ////////////////////////////////////////////////////////////////////////////
178:
179: /// <summary>
180: /// Post (create) a service request with action and complementary service
181: /// </summary>
182: [HttpPost]
183: [Route("api/v1/service-requests")]
184: public PostCreateServiceRequestResponse PostCreateServiceRequest([FromUri] string service, [FromUri] string action
185: , [FromUri] string accessName
186: , [FromUri] string callerId
187: , [FromUri] string internationalCalling
188: , [FromUri] string internationalCallingUserControlled
189: , [FromUri] string callForwardingCounterpart
190: , [FromUri] string callWaiting
191: , [FromUri] string conferenceCall
192: , [FromUri] string wakeupCall
193: , [FromUri] string abbriviatedCalling
194:
195: )
196: {
197: bool isWithinAllowedToBeProvisionedDomainList, hasValidAction, hasCallerId, hasInternationalCalling, hasInternationalCallingUserControlled, hasCallForwarding, hasCallWaiting, hasConferenceCall, hasWakeupCall, hasAbbriviatedCalling, isSuccessful;
198: DateTime requestDateTime;
199:
200: requestDateTime = DateTime.UtcNow.AddHours(3);
201:
202: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
203: {
204: isWithinAllowedToBeProvisionedDomainList = true;
205:
206: hasCallerId = (!string.IsNullOrEmpty(callerId) && callerId.ToUpper() == "Y");
207: hasInternationalCalling = (!string.IsNullOrEmpty(internationalCalling) && internationalCalling.ToUpper() == "Y");
208: hasInternationalCallingUserControlled = (!string.IsNullOrEmpty(internationalCallingUserControlled) && internationalCallingUserControlled.ToUpper() == "Y");
209: hasCallForwarding = (!string.IsNullOrEmpty(callForwardingCounterpart) && callForwardingCounterpart.ToUpper() == "Y");
210: hasCallWaiting = (!string.IsNullOrEmpty(callWaiting) && callWaiting.ToUpper() == "Y");
211: hasConferenceCall = (!string.IsNullOrEmpty(conferenceCall) && conferenceCall.ToUpper() == "Y");
212: hasWakeupCall = (!string.IsNullOrEmpty(wakeupCall) && wakeupCall.ToUpper() == "Y");
213: hasAbbriviatedCalling = (!string.IsNullOrEmpty(abbriviatedCalling) && abbriviatedCalling.ToUpper() == "Y");
214:
215: /*
216: var dataTable = new DataTable();
217: service = SRV_NO.ToString();
218:
219: dataTable = new DataTable();
220: dataTable.TableName = @"SRV_NO = " + service + "+ order by SRV_REQ_ID asc";
221: dataTable.Columns.Add("SRV_REQ_ID", typeof(int));
222: dataTable.Columns.Add("SRV_NO", typeof(int));
223: dataTable.Columns.Add("ADDRESS", typeof(string));
224: dataTable.Columns.Add("CUST_CAT_ID", typeof(int));
225: dataTable.Columns.Add("ACCOUNT_NO", typeof(int));
226: dataTable.Columns.Add("NAME", typeof(string));
227: dataTable.Columns.Add("REQ_DATE", typeof(DateTime));
228: dataTable.Columns.Add("SRV_SER_NO", typeof(int));
229: dataTable.Columns.Add("SRV_CAT_ID", typeof(int));
230: dataTable.Columns.Add("SRV_ID", typeof(int));
231: dataTable.Columns.Add("BALANCE", typeof(double));
232: dataTable.Columns.Add("STATUS", typeof(int));
233:
234: dataTable.Rows.Add(SRV_REQ_ID, SRV_NO, ADDRESS, CUST_CAT_ID, ACCOUNT_NO, NAME, REQ_DATE, SRV_SER_NO, SRV_CAT_ID, SRV_ID, BALANCE, STATUS);
235:
236: Ia.Ngn.Cl.Model.Data.ServiceRequest.UpdateForServiceRequestWithOutputDataTableAndService(dataTable, service, out isUpdated, out result);
237:
238: Ia.Ngn.Cl.Model.Data.Default.Log(" _PostServiceRequest(): " + SRV_REQ_ID);
239: */
240:
241: var port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown.ToString();
242:
243: switch (action)
244: {
245: case "1":
246: {
247: InsertServiceExemption(service);
248:
249: EnqueueCreateReadOrDeleteRead(Ia.Ngn.Cl.Model.Business.Msmq.Process.CreateReadServiceAccessPort, service, accessName, port, false);
250:
251: hasValidAction = true;
252: isSuccessful = true;
253:
254: break;
255: }
256:
257: case "2":
258: {
259: InsertServiceExemption(service);
260:
261: /* public enum SupplementaryService
262: * {
263: * CallerId = 1, InternationalCalling, InternationalCallingUserControlled, CallForwarding, CallWaiting, ConferenceCall, WakeupCall, AbbriviatedCalling, ServiceSuspension
264: * };
265: */
266:
267: if (hasCallerId) EnqueueSetReadButton(service, "1");
268: if (hasInternationalCalling) EnqueueSetReadButton(service, "2");
269: if (hasInternationalCallingUserControlled) EnqueueSetReadButton(service, "3");
270: if (hasCallForwarding) EnqueueSetReadButton(service, "4");
271: if (hasCallWaiting) EnqueueSetReadButton(service, "5");
272: if (hasConferenceCall) EnqueueSetReadButton(service, "6");
273: if (hasWakeupCall) EnqueueSetReadButton(service, "7");
274: if (hasAbbriviatedCalling) EnqueueSetReadButton(service, "8");
275:
276: hasValidAction = true;
277: isSuccessful = true;
278:
279: break;
280: }
281:
282: case "3":
283: {
284: InsertServiceExemption(service);
285:
286: EnqueueCreateReadOrDeleteRead(Ia.Ngn.Cl.Model.Business.Msmq.Process.DeleteReadServiceAccess, service, accessName, port, false);
287:
288: hasValidAction = true;
289: isSuccessful = true;
290:
291: break;
292: }
293:
294: default:
295: {
296: hasValidAction = false;
297: isSuccessful = false;
298:
299: break;
300: }
301: }
302: }
303: else
304: {
305: isWithinAllowedToBeProvisionedDomainList = false;
306: hasValidAction = false;
307: hasCallerId = false;
308: hasInternationalCalling = false;
309: hasInternationalCallingUserControlled = false;
310: hasCallForwarding = false;
311: hasCallWaiting = false;
312: hasConferenceCall = false;
313: hasWakeupCall = false;
314: hasAbbriviatedCalling = false;
315: isSuccessful = false;
316: }
317:
318: var postCreateServiceRequestResponse = new PostCreateServiceRequestResponse
319: {
320: Service = service,
321: AccessName = accessName,
322: IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
323: HasValidAction = hasValidAction,
324: CallerId = hasCallerId,
325: InternationalCalling = hasInternationalCalling,
326: InternationalCallingUserControlled = hasInternationalCallingUserControlled,
327: CallForwarding = hasCallForwarding,
328: CallWaiting = hasCallWaiting,
329: ConferenceCall = hasConferenceCall,
330: WakeupCall = hasWakeupCall,
331: AbbriviatedCalling = hasAbbriviatedCalling,
332: RequestDateTime = requestDateTime,
333: IsSuccessful = isSuccessful
334: };
335:
336: return postCreateServiceRequestResponse;
337: }
338:
339: ////////////////////////////////////////////////////////////////////////////
340: ////////////////////////////////////////////////////////////////////////////
341:
342: /// <summary>
343: ///
344: /// </summary>
345: [DataContract(IsReference = true, Namespace = "kw.com.ia.ofn.api.serviceRequest", Name = "GetReadServiceRequestResponse")]
346: public class GetReadServiceRequestResponse
347: {
348: /// <summary/>
349: [DataMember]
350: public string Id { get; set; }
351:
352: /// <summary/>
353: [DataMember]
354: public string Service { get; set; }
355:
356: /// <summary/>
357: [DataMember]
358: public string AccessName { get; set; }
359:
360: /// <summary/>
361: [DataMember]
362: public bool IsWithinAllowedToBeProvisionedDomainList { get; set; }
363:
364: /// <summary/>
365: [DataMember]
366: public bool CallerId { get; set; }
367:
368: /// <summary/>
369: [DataMember]
370: public bool InternationalCalling { get; set; }
371:
372: /// <summary/>
373: [DataMember]
374: public bool InternationalCallingUserControlled { get; set; }
375:
376: /// <summary/>
377: [DataMember]
378: public bool CallForwarding { get; set; }
379:
380: /// <summary/>
381: [DataMember]
382: public bool CallWaiting { get; set; }
383:
384: /// <summary/>
385: [DataMember]
386: public bool ConferenceCall { get; set; }
387:
388: /// <summary/>
389: [DataMember]
390: public bool WakeupCall { get; set; }
391:
392: /// <summary/>
393: [DataMember]
394: public bool AbbriviatedCalling { get; set; }
395:
396: /// <summary/>
397: [DataMember]
398: public bool ServiceIsSuspended { get; set; }
399:
400: /// <summary/>
401: [DataMember]
402: public DateTime RequestDateTime { get; set; }
403:
404: /// <summary/>
405: [DataMember]
406: public bool IsSuccessful { get; set; }
407: }
408:
409: ////////////////////////////////////////////////////////////////////////////
410:
411: /// <summary>
412: /// Get (read) a service request list by service
413: /// </summary>
414: [HttpGet]
415: [Route("api/v1/service-requests")]
416: public List<GetReadServiceRequestResponse> GetReadServiceRequestByService([FromUri] string service)
417: {
418: bool isWithinAllowedToBeProvisionedDomainList, hasCallerId, hasInternationalCalling, hasInternationalCallingUserControlled, hasCallForwarding, hasCallWaiting, hasConferenceCall, hasWakeupCall, hasAbbriviatedCalling, ServiceIsSuspended, isSuccessful;
419: string accessName;
420:
421: var responseList = new List<GetReadServiceRequestResponse>();
422:
423: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
424: {
425: isWithinAllowedToBeProvisionedDomainList = true;
426: isSuccessful = true;
427:
428: var list = Ia.Ngn.Cl.Model.Data.ServiceRequest.List(service);
429:
430: foreach (var item in list)
431: {
432: responseList.Add(new GetReadServiceRequestResponse
433: {
434: Service = service,
435: AccessName = string.Empty,
436: IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
437: CallerId = false,
438: InternationalCalling = false,
439: InternationalCallingUserControlled = false,
440: CallForwarding = false,
441: CallWaiting = false,
442: ConferenceCall = false,
443: WakeupCall = false,
444: AbbriviatedCalling = false,
445: ServiceIsSuspended = false,
446: RequestDateTime = item.RequestDateTime,
447: IsSuccessful = isSuccessful
448: });
449: }
450: }
451: else
452: {
453: isWithinAllowedToBeProvisionedDomainList = false;
454: isSuccessful = false;
455:
456: responseList.Add(new GetReadServiceRequestResponse
457: {
458: Service = service,
459: AccessName = string.Empty,
460: IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
461: CallerId = false,
462: InternationalCalling = false,
463: InternationalCallingUserControlled = false,
464: CallForwarding = false,
465: CallWaiting = false,
466: ConferenceCall = false,
467: WakeupCall = false,
468: AbbriviatedCalling = false,
469: ServiceIsSuspended = false,
470: RequestDateTime = DateTime.MinValue,
471: IsSuccessful = isSuccessful
472: });
473: }
474:
475: Ia.Ngn.Cl.Model.Data.Default.Log("GetReadServiceRequesttByService(): " + service);
476:
477: return responseList;
478: }
479:
480: ////////////////////////////////////////////////////////////////////////////
481: ////////////////////////////////////////////////////////////////////////////
482:
483: /// <summary>
484: ///
485: /// </summary>
486: [DataContract(IsReference = true, Namespace = "kw.com.ia.ofn.api.serviceRequest", Name = "DeleteDeleteServiceRequestResponse")]
487: public class DeleteDeleteServiceRequestResponse
488: {
489: /// <summary/>
490: [DataMember]
491: public string Id { get; set; }
492:
493: /// <summary/>
494: [DataMember]
495: public string Service { get; set; }
496:
497: /// <summary/>
498: [DataMember]
499: public string AccessName { get; set; }
500:
501: /// <summary/>
502: [DataMember]
503: public bool IsWithinAllowedToBeProvisionedDomainList { get; set; }
504:
505: /// <summary/>
506: [DataMember]
507: public DateTime RequestDateTime { get; set; }
508:
509: /// <summary/>
510: [DataMember]
511: public bool IsSuccessful { get; set; }
512: }
513:
514: ////////////////////////////////////////////////////////////////////////////
515:
516: /// <summary>
517: /// Delete (delete) a service request by id
518: /// </summary>
519: [HttpDelete]
520: [Route("api/v1/service-requests")]
521: public DeleteDeleteServiceRequestResponse DeleteDeleteServiceRequestById([FromUri] string id)
522: {
523: bool isWithinAllowedToBeProvisionedDomainList, isSuccessful;
524: string accessName;
525: DateTime requestDateTime;
526:
527: requestDateTime = DateTime.UtcNow.AddHours(3);
528:
529: /*
530: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(service))
531: {
532: isWithinAllowedToBeProvisionedDomainList = true;
533:
534: // var list = Ia.Ngn.Cl.Model.Data.ServiceRequest.List(service);
535:
536:
537:
538:
539: isSuccessful = false;
540: }
541: else
542: {
543: isWithinAllowedToBeProvisionedDomainList = false;
544: isSuccessful = false;
545: }
546: */
547:
548: isWithinAllowedToBeProvisionedDomainList = false;
549: isSuccessful = false;
550:
551: Ia.Ngn.Cl.Model.Data.Default.Log("DeleteDeleteServiceRequesttByService(): " + id);
552:
553: var deleteServiceRequestResponse = new DeleteDeleteServiceRequestResponse
554: {
555: Id = id,
556: IsWithinAllowedToBeProvisionedDomainList = isWithinAllowedToBeProvisionedDomainList,
557: RequestDateTime = requestDateTime,
558: IsSuccessful = isSuccessful
559: };
560:
561: return deleteServiceRequestResponse;
562: }
563:
564: /*
565: ////////////////////////////////////////////////////////////////////////////
566:
567: /// <summary>
568: /// List service request by id
569: /// </summary>
570: [HttpGet]
571: [Route("api/v1/service-requests/{id}")]
572: public List<Ia.Ngn.Cl.Model.ServiceRequest> ListById(int id)
573: {
574: var list = Ia.Ngn.Cl.Model.Data.ServiceRequest.ListById(id);
575:
576: Ia.Ngn.Cl.Model.Data.Default.Log(" ListById(): " + id);
577:
578: return list;
579: }
580: */
581:
582: ////////////////////////////////////////////////////////////////////////////
583:
584: /// <summary>
585: ///
586: /// </summary>
587: protected static string EnqueueCreateReadOrDeleteRead(Ia.Ngn.Cl.Model.Business.Msmq.Process process, string service0, string accessName0, string port0, bool overrideRouterDomainRestriction)
588: {
589: int portNumber;
590: string service, accessName, port, accessNameOrEmpty, serviceTaskResult;
591: Ia.Cl.Model.Result result;
592: Ia.Ngn.Cl.Model.Access access;
593:
594: result = new Ia.Cl.Model.Result();
595:
596: if (!string.IsNullOrEmpty(service0))
597: {
598: service = service0.Trim();
599:
600: if (service.Length > 0)
601: {
602: if (int.TryParse(service, out int number))
603: {
604: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
605: {
606: port = port0.Trim();
607:
608: if (string.IsNullOrEmpty(port)) port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown.ToString();
609:
610: if (int.TryParse(port, out portNumber))
611: {
612: if (portNumber >= Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown && portNumber <= Ia.Ngn.Cl.Model.Data.Default.MaximumOntTelPorts)
613: {
614: if (process == Ia.Ngn.Cl.Model.Business.Msmq.Process.CreateReadServiceAccessPort)
615: {
616: if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedNokiaSwitchDomainList(service))
617: {
618: if (!string.IsNullOrEmpty(accessName0))
619: {
620: accessName = accessName0.Trim();
621:
622: if (accessName.Length > 0)
623: {
624: if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(accessName, out string accessName2))
625: {
626: access = Ia.Ngn.Cl.Model.Data.Access.ReadByAccessName(accessName2);
627:
628: if (access != null)
629: {
630: Ia.Ngn.Cl.Model.Business.Maintenance.Task.ServiceAccessPortTask(process, service, access.Name, portNumber, overrideRouterDomainRestriction, null, out result);
631: }
632: else result.AddError(@"""" + accessName + @""" does not exist (الجهاز غير معرف). ");
633: }
634: else result.AddError(@"""" + accessName + @""" does not belong to the network (الجهاز لا ينتمي للشبكة). ");
635: }
636: else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
637: }
638: else result.AddError("Can't create a Nokia service without an access. AccessName is null or empty. (لم يتم إدخال جهاز لتركيب رقم نوكيا). ");
639: }
640: else if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedHuaweiSwitchDomainList(service))
641: {
642: if (!string.IsNullOrEmpty(accessName0))
643: {
644: accessName = accessName0.Trim();
645:
646: if (accessName.Length > 0)
647: {
648: if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(accessName, out string accessName2))
649: {
650: access = Ia.Ngn.Cl.Model.Data.Access.ReadByAccessName(accessName2);
651:
652: if (access != null)
653: {
654: Ia.Ngn.Cl.Model.Business.Maintenance.Task.ServiceAccessTask(process, service, access.Name, overrideRouterDomainRestriction, null, out result);
655: }
656: else result.AddError(@"""" + accessName + @""" does not exist (الجهاز غير معرف). ");
657: }
658: else result.AddError(@"""" + accessName + @""" does not belong to the network (الجهاز لا ينتمي للشبكة). ");
659: }
660: else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
661: }
662: else
663: {
664: Ia.Ngn.Cl.Model.Business.Maintenance.Task.ServiceAccessTask(process, service, string.Empty, overrideRouterDomainRestriction, null, out result);
665: }
666: }
667: else result.AddError("No input was entered for access (لم يتم إدخال جهاز). ");
668: }
669: else if (process == Ia.Ngn.Cl.Model.Business.Msmq.Process.DeleteReadServiceAccess)
670: {
671: if (!string.IsNullOrEmpty(accessName0))
672: {
673: accessName = accessName0.Trim();
674:
675: if (accessName.Length > 0)
676: {
677: if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(accessName, out string accessName2))
678: {
679: access = Ia.Ngn.Cl.Model.Data.Access.ReadByAccessName(accessName2);
680:
681: if (access != null) accessNameOrEmpty = access.Name;
682: else accessNameOrEmpty = string.Empty;
683: }
684: else accessNameOrEmpty = string.Empty;
685: }
686: else accessNameOrEmpty = string.Empty;
687: }
688: else accessNameOrEmpty = string.Empty;
689:
690: Ia.Ngn.Cl.Model.Business.Maintenance.Task.ServiceAccessTask(process, service, accessNameOrEmpty, overrideRouterDomainRestriction, null, out result);
691: }
692: else throw new ArgumentOutOfRangeException("MSMQ process " + process.ToString() + " is undefined");
693: }
694: else result.AddError(@"The port number """ + port + @""" is out of range. Should be between " + Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown + " and " + Ia.Ngn.Cl.Model.Data.Default.MaximumOntTelPorts + " inclusive. (رقم المدخل خارج نطاق المقبول");
695: }
696: else result.AddError(@"The port number """ + port + @""" is not empty or a valid number (ليس خاليا ولا رقماَ). ");
697: }
698: else result.AddError(@"The number """ + number + @""" does not belong to the network (الرقم لا ينتمي للشبكة).");
699: }
700: else result.AddError(@"The service number """ + service + @""" is not a valid number (ليس رقماَ). ");
701: }
702: else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
703: }
704: else result.AddError("No input was entered for service (لم يتم إدخال رقم).");
705:
706: if (result.IsSuccessful)
707: {
708: if (result.HasWarning)
709: {
710: serviceTaskResult = result.Message + result.Warning;
711: }
712: else
713: {
714: serviceTaskResult = result.Message;
715: }
716: }
717: else
718: {
719: serviceTaskResult = result.Error;
720: }
721:
722: return serviceTaskResult;
723: }
724:
725: ////////////////////////////////////////////////////////////////////////////
726: ////////////////////////////////////////////////////////////////////////////
727:
728: /// <summary>
729: ///
730: /// </summary>
731: protected static string EnqueueSetReadButton(string service, string supplementaryService)
732: {
733: string serviceSupplementaryServiceTaskResult;
734:
735: var result = new Ia.Cl.Model.Result();
736:
737: var selectedItem = supplementaryService;
738:
739: if (!string.IsNullOrEmpty(service))
740: {
741: service = service.Trim();
742:
743: if (service.Length > 0)
744: {
745: if (int.TryParse(service, out int number))
746: {
747: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
748: {
749: Ia.Ngn.Cl.Model.Business.Maintenance.Task.SupplementaryServiceTask(Ia.Ngn.Cl.Model.Business.Msmq.Process.UpdateReadServiceSupplementaryService, service, selectedItem, true, null, out result);
750: }
751: else result.AddError(@"The number """ + number + @""" does not belong to the network (الرقم لا ينتمي للشبكة).");
752: }
753: else result.AddError(@"The service number """ + service + @""" is not a valid number (ليس رقماَ). ");
754: }
755: else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
756: }
757: else result.AddError("No input was entered for service (لم يتم إدخال رقم).");
758:
759: if (result.IsSuccessful)
760: {
761: if (result.HasWarning)
762: {
763: serviceSupplementaryServiceTaskResult = result.Message + result.Warning;
764: }
765: else
766: {
767: serviceSupplementaryServiceTaskResult = result.Message;
768: }
769: }
770: else
771: {
772: serviceSupplementaryServiceTaskResult = result.Error;
773: }
774:
775: return serviceSupplementaryServiceTaskResult;
776: }
777:
778: ////////////////////////////////////////////////////////////////////////////
779:
780: /// <summary>
781: ///
782: /// </summary>
783: protected static string EnqueueResetReadButton(string service, string supplementaryService)
784: {
785: string serviceSupplementaryServiceTaskResult;
786:
787: var result = new Ia.Cl.Model.Result();
788:
789: var selectedItem = supplementaryService;
790:
791: if (!string.IsNullOrEmpty(service))
792: {
793: service = service.Trim();
794:
795: if (service.Length > 0)
796: {
797: if (int.TryParse(service, out int number))
798: {
799: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(number))
800: {
801: Ia.Ngn.Cl.Model.Business.Maintenance.Task.SupplementaryServiceTask(Ia.Ngn.Cl.Model.Business.Msmq.Process.UpdateReadServiceSupplementaryService, service, selectedItem, false, null, out result);
802: }
803: else result.AddError(@"The number """ + number + @""" does not belong to the network (الرقم لا ينتمي للشبكة).");
804: }
805: else result.AddError(@"The service number """ + service + @""" is not a valid number (ليس رقماَ). ");
806: }
807: else result.AddError("Input format is unknown (قيمة غير مفهومة). ");
808: }
809: else result.AddError("No input was entered for service (لم يتم إدخال رقم).");
810:
811: if (result.IsSuccessful)
812: {
813: if (result.HasWarning)
814: {
815: serviceSupplementaryServiceTaskResult = result.Message + result.Warning;
816: }
817: else
818: {
819: serviceSupplementaryServiceTaskResult = result.Message;
820: }
821: }
822: else
823: {
824: serviceSupplementaryServiceTaskResult = result.Error;
825: }
826:
827: return serviceSupplementaryServiceTaskResult;
828: }
829:
830: ////////////////////////////////////////////////////////////////////////////
831: ////////////////////////////////////////////////////////////////////////////
832:
833: /// <summary>
834: ///
835: /// </summary>
836: protected static string InsertServiceExemption(string service)
837: {
838: string id, note, serviceExemptionId, result;
839: DateTime now;
840: Ia.Ngn.Cl.Model.ServiceExemption serviceExemption;
841:
842: note = "New billing system service request order test";
843:
844: now = DateTime.UtcNow.AddHours(3);
845:
846: id = Ia.Ngn.Cl.Model.ServiceExemption.ServiceServiceExemptionId(service, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
847:
848: var serviceExemption0 = Ia.Ngn.Cl.Model.Data.ServiceExemption.Read(id);
849:
850: if (serviceExemption0 == null)
851: {
852: serviceExemption = new Ia.Ngn.Cl.Model.ServiceExemption()
853: {
854: Id = id,
855: Service = service,
856: Note = note,
857: UserId = Guid.Empty,
858: Created = now,
859: Updated = now
860: };
861:
862: serviceExemptionId = Ia.Ngn.Cl.Model.Data.ServiceExemption.Create(serviceExemption, out result);
863:
864: if (!string.IsNullOrEmpty(serviceExemptionId))
865: {
866: result = "Success: Service \"" + service + "\" added to exemption list (تمت إضافة الرقم للقائمة).";
867: }
868: else
869: {
870: }
871: }
872: else
873: {
874: result = "The service \"" + service + "\" already exists in the list (الرقم ينتمي للقائمة).";
875: }
876:
877: return result;
878: }
879:
880: ////////////////////////////////////////////////////////////////////////////
881: ////////////////////////////////////////////////////////////////////////////
882: }
883: }