1: using System.Web.Http;
2:
3: namespace Ia.Ngn.Cl.Model.Api.Controller
4: {
5: ////////////////////////////////////////////////////////////////////////////
6:
7: /// <summary publish="true">
8: /// Service, Access, and GatewayId API Controller class of Next Generation Network'a (NGN's) model.
9: /// </summary>
10: ///
11: /// <remarks>
12: /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
13: ///
14: /// 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
15: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
16: ///
17: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
18: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19: ///
20: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
21: ///
22: /// Copyright notice: This notice may not be removed or altered from any source distribution.
23: /// </remarks>
24: public class ServiceAccessNameGatewayIdController : ApiController
25: {
26: ////////////////////////////////////////////////////////////////////////////
27:
28: /// <summary>
29: ///
30: /// </summary>
31: [HttpGet]
32: [Route("api/data/default/queue/service/enqueue/{service}")]
33: public bool ServiceEnqueue(string service)
34: {
35: bool isSuccessful;
36: int number;
37: //Guid userId;
38: //Ia.Cl.Model.Result result;
39:
40: //result = new Ia.Cl.Model.Result();
41: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
42:
43: if (int.TryParse(service, out number))
44: {
45: if (Ia.Ngn.Cl.Model.Business.Service.NumberIsWithinAllowedDomainList(number))
46: {
47: Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Enqueue(service);
48:
49: isSuccessful = true;
50: }
51: else isSuccessful = false;
52: }
53: else isSuccessful = false;
54:
55: return isSuccessful;
56: }
57:
58: /*
59: ////////////////////////////////////////////////////////////////////////////
60:
61: /// <summary>
62: ///
63: /// </summary>
64: [HttpGet]
65: [Route("api/data/default/queue/service/dequeue")]
66: public string ServiceDequeue()
67: {
68: string service;
69:
70: if (Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Count > 0) service = Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Dequeue;
71: else service = null;
72:
73: return service;
74: }
75:
76: ////////////////////////////////////////////////////////////////////////////
77:
78: /// <summary>
79: ///
80: /// </summary>
81: [HttpGet]
82: [Route("api/data/default/queue/service/count")]
83: public long ServiceCount()
84: {
85: //Guid userId;
86: //Ia.Cl.Model.Result result;
87:
88: //result = new Ia.Cl.Model.Result();
89: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
90:
91: return Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Count;
92: }
93: */
94:
95: ////////////////////////////////////////////////////////////////////////////
96: ////////////////////////////////////////////////////////////////////////////
97:
98: /// <summary>
99: ///
100: /// </summary>
101: [HttpGet]
102: [Route("api/data/default/queue/access-name/enqueue/{accessName}")]
103: public bool AccessNameEnqueue(string input)
104: {
105: bool isSuccessful;
106: string accessName;
107: //Guid userId;
108: //Ia.Cl.Model.Result result;
109:
110: //result = new Ia.Cl.Model.Result();
111: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
112:
113: if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(input, out accessName))
114: {
115: Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Enqueue(accessName);
116:
117: isSuccessful = true;
118: }
119: else isSuccessful = false;
120:
121: return isSuccessful;
122: }
123:
124: /*
125: ////////////////////////////////////////////////////////////////////////////
126:
127: /// <summary>
128: ///
129: /// </summary>
130: [HttpGet]
131: [Route("api/data/default/queue/access-name/dequeue")]
132: public string AccessNameDequeue()
133: {
134: string accessName;
135: //Guid userId;
136: //Ia.Cl.Model.Result result;
137:
138: //result = new Ia.Cl.Model.Result();
139: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
140:
141: if (Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Count > 0) accessName = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Dequeue;
142: else accessName = null;
143:
144: return accessName;
145: }
146:
147: ////////////////////////////////////////////////////////////////////////////
148:
149: /// <summary>
150: ///
151: /// </summary>
152: [HttpGet]
153: [Route("api/data/default/queue/access-name/count")]
154: public long AccessNameCount()
155: {
156: //Guid userId;
157: //Ia.Cl.Model.Result result;
158:
159: //result = new Ia.Cl.Model.Result();
160: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
161:
162: return Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Count;
163: }
164: */
165:
166: ////////////////////////////////////////////////////////////////////////////
167: ////////////////////////////////////////////////////////////////////////////
168:
169: /// <summary>
170: ///
171: /// </summary>
172: [HttpGet]
173: [Route("api/data/default/queue/gatewayId/enqueue/{gatewayId}")]
174: public bool GatewayIdEnqueue(int gatewayId)
175: {
176: bool isSuccessful;
177: //Guid userId;
178: //Ia.Cl.Model.Result result;
179:
180: //result = new Ia.Cl.Model.Result();
181: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
182:
183: if (gatewayId >= Ia.Ngn.Cl.Model.Business.Nokia.Ims.FirstGatewayId && gatewayId <= Ia.Ngn.Cl.Model.Business.Nokia.Ims.LastGatewayId)
184: {
185: Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Enqueue(gatewayId);
186:
187: isSuccessful = true;
188: }
189: else isSuccessful = false;
190:
191: return isSuccessful;
192: }
193:
194: /*
195: ////////////////////////////////////////////////////////////////////////////
196:
197: /// <summary>
198: ///
199: /// </summary>
200: [HttpGet]
201: [Route("api/data/default/queue/gatewayId/dequeue")]
202: public int GatewayIdDequeue()
203: {
204: int gatewayId;
205: //Guid userId;
206: //Ia.Cl.Model.Result result;
207:
208: //result = new Ia.Cl.Model.Result();
209: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
210:
211: if (Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Count > 0) gatewayId = Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Dequeue;
212: else gatewayId = 0;
213:
214: return gatewayId;
215: }
216:
217: ////////////////////////////////////////////////////////////////////////////
218:
219: /// <summary>
220: ///
221: /// </summary>
222: [HttpGet]
223: [Route("api/data/default/queue/gatewayId/count")]
224: public long GatewayIdCount()
225: {
226: //Guid userId;
227: //Ia.Cl.Model.Result result;
228:
229: //result = new Ia.Cl.Model.Result();
230: //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
231:
232: return Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Count;
233: }
234: */
235:
236: ////////////////////////////////////////////////////////////////////////////
237: ////////////////////////////////////////////////////////////////////////////
238: }
239: }