1: using System.Collections.Generic;
2: using System.Linq;
3: using System.Text.RegularExpressions;
4:
5: namespace Ia.Ngn.Cl.Model.Business.Maintenance
6: {
7: ////////////////////////////////////////////////////////////////////////////
8:
9: /// <summary publish="true">
10: /// Default maintenance network information support class for the Next Generation Network business model
11: /// </summary>
12: ///
13: /// <remarks>
14: /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
15: ///
16: /// 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
17: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
18: ///
19: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
20: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21: ///
22: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
23: ///
24: /// Copyright notice: This notice may not be removed or altered from any source distribution.
25: /// </remarks>
26: public class Default
27: {
28: ////////////////////////////////////////////////////////////////////////////
29:
30: /// <summary>
31: ///
32: /// </summary>
33: public Default() { }
34:
35: ////////////////////////////////////////////////////////////////////////////
36:
37: /// <summary>
38: ///
39: /// </summary>
40: public static void BulkQueue(string input, out Ia.Cl.Model.Result result)
41: {
42: List<string> list;
43:
44: result = new Ia.Cl.Model.Result();
45:
46: if (!string.IsNullOrEmpty(input))
47: {
48: input = Regex.Replace(input, @"\s+", " "); // to handle any type of space, including newlines
49: input = input.Trim().ToLower();
50:
51: if (input.Length > 0)
52: {
53: list = input.Split(new char[] { ',', ' ' }).ToList();
54:
55: if (list.Count > 0)
56: {
57: Ia.Ngn.Cl.Model.Business.Maintenance.Default.InsertServiceAccessListIntoQueue(list, out result);
58: }
59: else
60: {
61: result.AddError("List is empty. ");
62: }
63: }
64: else
65: {
66: result.AddError("No input was entered. ");
67: }
68: }
69: else
70: {
71: result.AddError("Input is null or empty. ");
72: }
73: }
74:
75: ////////////////////////////////////////////////////////////////////////////
76:
77: /// <summary>
78: ///
79: /// </summary>
80: public static void InsertServiceAccessListIntoQueue(List<string> list, out Ia.Cl.Model.Result result)
81: {
82: string service, accessName;
83: result = new Ia.Cl.Model.Result();
84:
85: foreach (string item in list)
86: {
87: if (!string.IsNullOrEmpty(item))
88: {
89: service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(item);
90:
91: if (!string.IsNullOrEmpty(service))
92: {
93: if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedDomainList(item))
94: {
95: if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedDomainList(item))
96: {
97: Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Enqueue(item);
98:
99: result.AddSuccess("The number \"" + item + "\" inserted into queue. ");
100: }
101: else
102: {
103: result.AddWarning("The number \"" + item + "\" does not belong to the network. ");
104: }
105: }
106: else
107: {
108: result.AddWarning("The number \"" + item + "\" does not belong to the network. ");
109: }
110: }
111: else
112: {
113: if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(item, out accessName))
114: {
115: Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Enqueue(accessName);
116:
117: result.AddSuccess("The access name \"" + accessName + "\" inserted into queue. ");
118: }
119: else
120: {
121: //result.AddWarning("The access name \"" + item + "\" does not belong to the network. ");
122: result.AddWarning("The number or access name \"" + item + "\" is not recognized or does not belong to the network. ");
123: }
124: }
125: }
126: else
127: {
128:
129: }
130: }
131: }
132:
133: ////////////////////////////////////////////////////////////////////////////
134: ////////////////////////////////////////////////////////////////////////////
135: }
136:
137: ////////////////////////////////////////////////////////////////////////////
138: ////////////////////////////////////////////////////////////////////////////
139: }