شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » ServiceAccessNameGatewayIdController

Public general use code classes and xml files that we've compiled and used over the years:

Service Suspension API Controller class of Next Generation Network'a (NGN's) model.

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