1: using System;
2: using System.Collections;
3: using System.Collections.Generic;
4: using System.Linq;
5: using System.Web;
6: using System.Web.Security;
7: using System.Text;
8: using System.Text.RegularExpressions;
9: using System.Data;
10:
11: namespace Ia.Ngn.Cl.Model.Business
12: {
13: ////////////////////////////////////////////////////////////////////////////
14:
15: /// <summary publish="true">
16: /// Service Request Type support class of Next Generation Network'a (NGN's) business model.
17: /// </summary>
18: ///
19: /// <remarks>
20: /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
21: ///
22: /// 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
23: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
24: ///
25: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
26: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
27: ///
28: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
29: ///
30: /// Copyright notice: This notice may not be removed or altered from any source distribution.
31: /// </remarks>
32: public partial class ServiceRequestType
33: {
34: /// <summary/>
35: public ServiceRequestType() { }
36:
37: ////////////////////////////////////////////////////////////////////////////
38:
39: /// <summary>
40: ///
41: /// </summary>
42: public static List<int> PossibleChangedNumberList(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
43: {
44: int i;
45: List<int> numberList;
46: List<string> stringNumberList;
47:
48: numberList = new List<int>();
49: stringNumberList = (from srt in serviceRequestTypeList where srt.TypeId == 11 select srt.Value).ToList();
50:
51: if (stringNumberList.Count > 0)
52: {
53: foreach(string u in stringNumberList)
54: {
55: if(int.TryParse(u, out i)) numberList.Add(i);
56: }
57: }
58: else
59: {
60: }
61:
62: return numberList;
63: }
64:
65: ////////////////////////////////////////////////////////////////////////////
66:
67: /// <summary>
68: ///
69: /// </summary>
70: public static Ia.Ngn.Cl.Model.Access ExtractAccess(int serviceRequestId, List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
71: {
72: Ia.Ngn.Cl.Model.Access access;
73: List<Ia.Ngn.Cl.Model.ServiceRequestType> subtypeSrtList;
74:
75: subtypeSrtList = (from srt in serviceRequestTypeList where srt.ServiceRequest.Id == serviceRequestId select srt).ToList();
76:
77: access = ExtractAccess(subtypeSrtList);
78:
79: return access;
80: }
81:
82: ////////////////////////////////////////////////////////////////////////////
83:
84: /// <summary>
85: ///
86: /// </summary>
87: private static Ia.Ngn.Cl.Model.Access ExtractAccess(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
88: {
89: int oltId, ponNumber, ontNumber;
90: Dictionary<int, string> typeDictionary;
91: Ia.Ngn.Cl.Model.Access access;
92:
93: typeDictionary = TypeDictionary(serviceRequestTypeList);
94:
95: Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromDictionaryValueList(typeDictionary, out oltId, out ponNumber, out ontNumber);
96:
97: access = Ia.Ngn.Cl.Model.Data.Access.Read(oltId, ponNumber, ontNumber);
98:
99: return access;
100: }
101:
102: ////////////////////////////////////////////////////////////////////////////
103:
104: /// <summary>
105: ///
106: /// </summary>
107: public static Ia.Ngn.Cl.Model.Access ExtractAccess(Ia.Ngn.Cl.Model.Ngn db, string value)
108: {
109: int oltId, ponNumber, ontNumber;
110: Dictionary<int, string> typeDictionary;
111: Ia.Ngn.Cl.Model.Access access;
112:
113: typeDictionary = new Dictionary<int, string>(1);
114: typeDictionary.Add(1, value);
115:
116: Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromDictionaryValueList(typeDictionary, out oltId, out ponNumber, out ontNumber);
117:
118: access = Ia.Ngn.Cl.Model.Data.Access.Read(db, oltId, ponNumber, ontNumber);
119:
120: return access;
121: }
122:
123: ////////////////////////////////////////////////////////////////////////////
124:
125: /// <summary>
126: ///
127: /// </summary>
128: public static Dictionary<int, string> TypeDictionary(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
129: {
130: Dictionary<int, string> typeDictionary;
131:
132: typeDictionary = new Dictionary<int, string>(63); // <serviceRequestType> <typeList> <type> has about 63 types max
133:
134: foreach (Ia.Ngn.Cl.Model.ServiceRequestType serviceRequestType in serviceRequestTypeList)
135: {
136: typeDictionary.Add(serviceRequestType.TypeId, serviceRequestType.Value);
137: }
138:
139: return typeDictionary;
140: }
141:
142: ////////////////////////////////////////////////////////////////////////////
143: ////////////////////////////////////////////////////////////////////////////
144: }
145:
146: ////////////////////////////////////////////////////////////////////////////
147: ////////////////////////////////////////////////////////////////////////////
148: }