1: using System;
2: using System.Collections.Generic;
3:
4: namespace Ia.Ngn.Cl.Model.Business
5: {
6: ////////////////////////////////////////////////////////////////////////////
7:
8: /// <summary publish="true">
9: /// Service Request History support class of Optical Fiber Network (OFN) business model.
10: /// </summary>
11: ///
12: /// <remarks>
13: /// Copyright © 2019-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
14: ///
15: /// 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
16: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
17: ///
18: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
19: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20: ///
21: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
22: ///
23: /// Copyright notice: This notice may not be removed or altered from any source distribution.
24: /// </remarks>
25: public class ServiceRequestHistory
26: {
27: ////////////////////////////////////////////////////////////////////////////
28:
29: /// <summary>
30: ///
31: /// </summary>
32: public ServiceRequestHistory() { }
33:
34: ////////////////////////////////////////////////////////////////////////////
35:
36: /// <summary>
37: ///
38: /// </summary>
39: public static string ServiceRequestHistoryId(int number, int serial, int serviceServiceId, DateTime serviceDateTime)
40: {
41: string serviceId, id; //, ctag;
42:
43: serviceId = Ia.Ngn.Cl.Model.Business.Service2.ServiceId(number.ToString(), Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
44:
45: //ctag = Ia.Cl.Model.Default.RandomNumber(4);
46:
47: id = serviceId + ":" + serial + ":" + serviceServiceId + ":" + serviceDateTime.ToString("yyyy-MM-dd");// + ":" + ctag;
48:
49: return id;
50: }
51:
52: ////////////////////////////////////////////////////////////////////////////
53:
54: /// <summary>
55: ///
56: /// </summary>
57: public static bool ServiceRequestServiceHistoryProvisionedValueFromStatus(int status)
58: {
59: bool provisioned;
60:
61: if (status == 7001 || status == 7002 || status == 7003 || status == 7004 || status == 7008)
62: {
63: /*
64: [7001] = "يعمل",
65: [7002] = "قطع مؤقت",
66: [7003] = "قطع مبرمج",
67: [7004] = "قيد التنفيذ",
68: [7008] = "قطع معاكسة",
69: */
70:
71: provisioned = true;
72: }
73: else if (status == 7005 || status == 7006 || status == 7007 || status == 7009 || status == 7010)
74: {
75: /*
76: [7005] = "تعذر التنفيذ",
77: [7006] = "رفع نهائي",
78: [7007] = "رفع محاسبة",
79: [7009] = "ملغى",
80: [7010] = "لا يعمل",
81: */
82:
83: provisioned = false;
84: }
85: else
86: {
87: provisioned = false;
88: }
89:
90: return provisioned;
91: }
92:
93: ////////////////////////////////////////////////////////////////////////////
94:
95: /// <summary>
96: ///
97: /// </summary>
98: public static void NumberSerialProvisionedDictionary(List<Ia.Ngn.Cl.Model.ServiceRequestHistory> serviceRequestHistoryList, out Dictionary<int, int> numberSerial, out Dictionary<int, bool> numberProvisioned)
99: {
100: bool provisioned;
101: int number, serial;
102:
103: numberSerial = new Dictionary<int, int>();
104: numberProvisioned = new Dictionary<int, bool>();
105:
106: if (serviceRequestHistoryList.Count > 0)
107: {
108: foreach (var srh in serviceRequestHistoryList)
109: {
110: number = srh.Number;
111: serial = srh.Serial;
112: provisioned = ServiceRequestServiceHistoryProvisionedValueFromStatus(srh.Status);
113:
114: if (numberSerial.ContainsKey(number))
115: {
116: if (serial > numberSerial[number])
117: {
118: numberSerial[number] = serial;
119: numberProvisioned[number] = provisioned;
120: }
121: else
122: {
123: }
124: }
125: else
126: {
127: numberSerial[number] = serial;
128: numberProvisioned[number] = provisioned;
129: }
130: }
131: }
132: }
133:
134: ////////////////////////////////////////////////////////////////////////////
135: ////////////////////////////////////////////////////////////////////////////
136: }
137:
138: ////////////////////////////////////////////////////////////////////////////
139: ////////////////////////////////////////////////////////////////////////////
140: }