1: using System;
2: using System.Collections.Generic;
3:
4: namespace Ia.Ngn.Cl.Model.Business.Nokia
5: {
6: ////////////////////////////////////////////////////////////////////////////
7:
8: /// <summary publish="true">
9: /// AGCF Endpoint support class for Nokia's Optical Fiber Network (OFN) business model.
10: /// </summary>
11: ///
12: /// <remarks>
13: /// Copyright � 2014-2017 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 AgcfEndpoint
26: {
27: public AgcfEndpoint() { }
28:
29: ////////////////////////////////////////////////////////////////////////////
30:
31: /// <summary>
32: ///
33: /// </summary>
34: public static List<Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint> ParseFromDictionary(List<Dictionary<string, string>> parameterDictionaryList)
35: {
36: int i;
37: string prividUser;
38: Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint agcfEndpoint;
39: List<Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint> agcfEndpointList;
40:
41: agcfEndpointList = new List<Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint>();
42:
43: foreach (Dictionary<string, string> parameterDictionary in parameterDictionaryList)
44: {
45: agcfEndpoint = new Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint();
46:
47: prividUser = parameterDictionary["PrividUser"].ToString();
48:
49: agcfEndpoint.Id = Ia.Ngn.Cl.Model.Nokia.AgcfEndpoint.AgcfEndpointId(prividUser);
50:
51: agcfEndpoint.PrividUser = prividUser;
52: agcfEndpoint.Slot = int.TryParse(parameterDictionary["Slot"].ToString(), out i) ? i : 0;
53: agcfEndpoint.Port = int.TryParse(parameterDictionary["Port"].ToString(), out i) ? i : 0;
54: agcfEndpoint.GwId = int.TryParse(parameterDictionary["GwId"].ToString(), out i) ? i : 0;
55: agcfEndpoint.Dn = parameterDictionary["Dn"].ToString();
56: agcfEndpoint.AdditionalDNs = parameterDictionary["AdditionalDNs"].ToString();
57: agcfEndpoint.DomainIndex = int.TryParse(parameterDictionary["DomainIndex"].ToString(), out i) ? i : 0;
58: agcfEndpoint.FeatureFlag = int.TryParse(parameterDictionary["FeatureFlag"].ToString(), out i) ? i : 0;
59: agcfEndpoint.DslamId = parameterDictionary["DslamId"].ToString();
60: agcfEndpoint.Rack = int.TryParse(parameterDictionary["Rack"].ToString(), out i) ? i : 0;
61: agcfEndpoint.Shelf = int.TryParse(parameterDictionary["Shelf"].ToString(), out i) ? i : 0;
62: agcfEndpoint.FlatTermID = int.TryParse(parameterDictionary["FlatTermID"].ToString(), out i) ? i : 0;
63: agcfEndpoint.SubscriberType = (parameterDictionary["SubscriberType"].ToString() == "Analog") ? true : false;
64: agcfEndpoint.ReversePolarity = int.TryParse(parameterDictionary["ReversePolarity"].ToString(), out i) ? i : 0;
65: agcfEndpoint.PayphoneMetering = int.TryParse(parameterDictionary["PayphoneMetering"].ToString(), out i) ? i : 0;
66: agcfEndpoint.DigitMap1st = int.TryParse(parameterDictionary["DigitMap1st"].ToString(), out i) ? i : 0;
67: agcfEndpoint.DigitMap2nd = int.TryParse(parameterDictionary["DigitMap2nd"].ToString(), out i) ? i : 0;
68: agcfEndpoint.DialTone2nd = int.TryParse(parameterDictionary["DialTone2nd"].ToString(), out i) ? i : 0;
69: agcfEndpoint.CallHoldLc = Convert.ToBoolean(parameterDictionary["CallHoldLc"].ToString());
70: agcfEndpoint.CallWaitingLc = Convert.ToBoolean(parameterDictionary["CallWaitingLc"].ToString());
71: agcfEndpoint.CallToggleLc = Convert.ToBoolean(parameterDictionary["CallToggleLc"].ToString());
72: agcfEndpoint.ThreeWayCallLc = Convert.ToBoolean(parameterDictionary["ThreeWayCallLc"].ToString());
73: agcfEndpoint.McidLc = Convert.ToBoolean(parameterDictionary["McidLc"].ToString());
74: agcfEndpoint.Password = (parameterDictionary.ContainsKey("Password")) ? parameterDictionary["Password"].ToString() : null;
75: agcfEndpoint.CallTransferLc = Convert.ToBoolean(parameterDictionary["CallTransferLc"].ToString());
76:
77: agcfEndpoint.Created = DateTime.UtcNow.AddHours(3);
78: agcfEndpoint.Updated = DateTime.UtcNow.AddHours(3);
79: agcfEndpoint.UserId = Guid.Empty;
80:
81: agcfEndpointList.Add(agcfEndpoint);
82: }
83:
84: return agcfEndpointList;
85: }
86:
87: ////////////////////////////////////////////////////////////////////////////
88: ////////////////////////////////////////////////////////////////////////////
89: }
90:
91: ////////////////////////////////////////////////////////////////////////////
92: ////////////////////////////////////////////////////////////////////////////
93: }