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

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, Access, and GatewayId 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, Access, and GatewayId API Controller class of Next Generation Network'a (NGN's) model.
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2006-2019 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:  
  65:          /// <summary>
  66:          ///
  67:          /// </summary>
  68:          [HttpGet]
  69:          public string ServiceDequeue()
  70:          {
  71:              string service;
  72:  
  73:              if (Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Count > 0) service = Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Dequeue;
  74:              else service = null;
  75:  
  76:              return service;
  77:          }
  78:  
  79:          ////////////////////////////////////////////////////////////////////////////
  80:  
  81:          /// <summary>
  82:          ///
  83:          /// </summary>
  84:          [HttpGet]
  85:          public long ServiceCount()
  86:          {
  87:              //Guid userId;
  88:              //Ia.Cl.Model.Result result;
  89:  
  90:              //result = new Ia.Cl.Model.Result();
  91:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
  92:  
  93:              return Ia.Ngn.Cl.Model.Data.Msmq.ServiceQueue.Count;
  94:          }
  95:          */
  96:   
  97:          ////////////////////////////////////////////////////////////////////////////
  98:          ////////////////////////////////////////////////////////////////////////////
  99:   
 100:          /// <summary>
 101:          ///
 102:          /// </summary>
 103:          [HttpGet]
 104:          public bool AccessNameEnqueue(string input)
 105:          {
 106:              bool isSuccessful;
 107:              string accessName;
 108:              //Guid userId;
 109:              //Ia.Cl.Model.Result result;
 110:   
 111:              //result = new Ia.Cl.Model.Result();
 112:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 113:   
 114:              if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(input, out accessName))
 115:              {
 116:                  Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Enqueue(accessName);
 117:   
 118:                  isSuccessful = true;
 119:              }
 120:              else isSuccessful = false;
 121:   
 122:              return isSuccessful;
 123:          }
 124:   
 125:          /*
 126:          ////////////////////////////////////////////////////////////////////////////
 127:  
 128:          /// <summary>
 129:          ///
 130:          /// </summary>
 131:          [HttpGet]
 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:          public long AccessNameCount()
 154:          {
 155:              //Guid userId;
 156:              //Ia.Cl.Model.Result result;
 157:  
 158:              //result = new Ia.Cl.Model.Result();
 159:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 160:  
 161:              return Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Count;
 162:          }
 163:          */
 164:   
 165:          ////////////////////////////////////////////////////////////////////////////
 166:          ////////////////////////////////////////////////////////////////////////////
 167:   
 168:          /// <summary>
 169:          ///
 170:          /// </summary>
 171:          [HttpGet]
 172:          public bool GatewayIdEnqueue(int gatewayId)
 173:          {
 174:              bool isSuccessful;
 175:              //Guid userId;
 176:              //Ia.Cl.Model.Result result;
 177:   
 178:              //result = new Ia.Cl.Model.Result();
 179:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 180:   
 181:              if (gatewayId >= Ia.Ngn.Cl.Model.Business.Nokia.Ims.FirstGatewayId && gatewayId <= Ia.Ngn.Cl.Model.Business.Nokia.Ims.LastGatewayId)
 182:              {
 183:                  Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Enqueue(gatewayId);
 184:   
 185:                  isSuccessful = true;
 186:              }
 187:              else isSuccessful = false;
 188:   
 189:              return isSuccessful;
 190:          }
 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:      }
 235:  }