1: using System;
2: using System.Collections.Generic;
3:
4: namespace Ia.Ngn.Cl.Model.Business.Huawei
5: {
6: ////////////////////////////////////////////////////////////////////////////
7:
8: /// <summary publish="true">
9: /// Huawei's OwSbr Entity Framework class for Optical Fiber Network (OFN) business model.
10: /// </summary>
11: ///
12: /// <remarks>
13: /// Copyright © 2014-2021 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 Owsbr
26: {
27: /// <summary/>
28: public Owsbr() { }
29:
30: ////////////////////////////////////////////////////////////////////////////
31:
32: /// <summary>
33: ///
34: /// </summary>
35: public static Ia.Ngn.Cl.Model.Huawei.Owsbr ParseFromDictionary(Dictionary<string, string> parameterDictionary)
36: {
37: string impu;
38: Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
39:
40: owsbr = new Ia.Ngn.Cl.Model.Huawei.Owsbr();
41:
42: impu = (parameterDictionary.ContainsKey("IMPU")) ? parameterDictionary["IMPU"].ToString() : null;
43:
44: if (impu != null)
45: {
46: owsbr.IMPU = impu;
47:
48: owsbr.US = (parameterDictionary.ContainsKey("US")) ? int.Parse(parameterDictionary["US"].ToString()) : 0;
49:
50: owsbr.Created = DateTime.UtcNow.AddHours(3);
51: owsbr.Updated = DateTime.UtcNow.AddHours(3);
52: //owsbr..UserId = Guid.Empty;
53: }
54: else
55: {
56:
57: }
58:
59: return owsbr;
60: }
61:
62: ////////////////////////////////////////////////////////////////////////////
63:
64: /// <summary>
65: ///
66: /// </summary>
67: public static bool ServiceSuspensionState(Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr)
68: {
69: bool b;
70:
71: b = (owsbr.US != 0); // 0: Normal
72:
73: return b;
74: }
75:
76: ////////////////////////////////////////////////////////////////////////////
77:
78: /// <summary>
79: ///
80: /// </summary>
81: public static string UsCodeColoredString(int us)
82: {
83: /// 0: NORMAL (NORMAL): The subscriber can originate and answer calls normally.
84: /// 1: OUTOWN (OUTOWN): The subscriber can answer calls but is forbidden to originate any call except for owing override calls.
85: /// 2: INOWN (INOWN): The subscriber is forbidden to answer calls but can originate calls.
86: /// 3: BOTHOWN (BOTHOWN): The subscriber is forbidden to answer and originate any calls.
87:
88: string s;
89:
90: switch (us)
91: {
92: case 0: s = "<span style=\"color:green\">Normal (يعمل)</span>"; break;
93: case 1: s = "<span style=\"color:red\">Outgoing calls barred (منع اتصال)</span>"; break;
94: case 2: s = "<span style=\"color:red\">Incoming calls barred (منع استقبال)</span>"; break;
95: case 3: s = "<span style=\"color:red\">Calls barred (منع استخدام)</span>"; break;
96: default: s = "<span style=\"color:red\">Unknown</span>"; break;
97: }
98:
99: return s;
100: }
101:
102: ////////////////////////////////////////////////////////////////////////////
103: ////////////////////////////////////////////////////////////////////////////
104: }
105:
106: ////////////////////////////////////////////////////////////////////////////
107: ////////////////////////////////////////////////////////////////////////////
108: }