Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
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 accessName)
 108:          {
 109:              bool isSuccessful;
 110:              //Guid userId;
 111:              //Ia.Cl.Model.Result result;
 112:   
 113:              //result = new Ia.Cl.Model.Result();
 114:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 115:   
 116:              // below: get olt, pon and ont
 117:              accessName = Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromValue(accessName);
 118:   
 119:              if (Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(accessName))
 120:              {
 121:                  Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Enqueue(accessName);
 122:   
 123:                  isSuccessful = true;
 124:              }
 125:              else isSuccessful = false;
 126:   
 127:              return isSuccessful;
 128:          }
 129:   
 130:          ////////////////////////////////////////////////////////////////////////////
 131:   
 132:          /// <summary>
 133:          ///
 134:          /// </summary>
 135:          [HttpGet]
 136:          public string AccessNameDequeue()
 137:          {
 138:              string accessName;
 139:              //Guid userId;
 140:              //Ia.Cl.Model.Result result;
 141:   
 142:              //result = new Ia.Cl.Model.Result();
 143:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 144:   
 145:              if (Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Count > 0) accessName = Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Dequeue;
 146:              else accessName = null;
 147:   
 148:              return accessName;
 149:          }
 150:   
 151:          ////////////////////////////////////////////////////////////////////////////
 152:   
 153:          /// <summary>
 154:          ///
 155:          /// </summary>
 156:          [HttpGet]
 157:          public long AccessNameCount()
 158:          {
 159:              //Guid userId;
 160:              //Ia.Cl.Model.Result result;
 161:   
 162:              //result = new Ia.Cl.Model.Result();
 163:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 164:   
 165:              return Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.Count;
 166:          }
 167:   
 168:          ////////////////////////////////////////////////////////////////////////////
 169:          ////////////////////////////////////////////////////////////////////////////
 170:   
 171:          /// <summary>
 172:          ///
 173:          /// </summary>
 174:          [HttpGet]
 175:          public bool GatewayIdEnqueue(int gatewayId)
 176:          {
 177:              bool isSuccessful;
 178:              //Guid userId;
 179:              //Ia.Cl.Model.Result result;
 180:   
 181:              //result = new Ia.Cl.Model.Result();
 182:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 183:   
 184:              if (gatewayId >= Ia.Ngn.Cl.Model.Business.Nokia.Ims.FirstGatewayId && gatewayId <= Ia.Ngn.Cl.Model.Business.Nokia.Ims.LastGatewayId)
 185:              {
 186:                  Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Enqueue(gatewayId);
 187:   
 188:                  isSuccessful = true;
 189:              }
 190:              else isSuccessful = false;
 191:   
 192:              return isSuccessful;
 193:          }
 194:   
 195:          ////////////////////////////////////////////////////////////////////////////
 196:   
 197:          /// <summary>
 198:          ///
 199:          /// </summary>
 200:          [HttpGet]
 201:          public int GatewayIdDequeue()
 202:          {
 203:              int gatewayId;
 204:              //Guid userId;
 205:              //Ia.Cl.Model.Result result;
 206:   
 207:              //result = new Ia.Cl.Model.Result();
 208:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 209:   
 210:              if (Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Count > 0) gatewayId = Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Dequeue;
 211:              else gatewayId = 0;
 212:   
 213:              return gatewayId;
 214:          }
 215:   
 216:          ////////////////////////////////////////////////////////////////////////////
 217:   
 218:          /// <summary>
 219:          ///
 220:          /// </summary>
 221:          [HttpGet]
 222:          public long GatewayIdCount()
 223:          {
 224:              //Guid userId;
 225:              //Ia.Cl.Model.Result result;
 226:   
 227:              //result = new Ia.Cl.Model.Result();
 228:              //userId = Ia.Ngn.Cl.Model.Business.Contact.GetStaffOrContactUserIdFromKey(key);
 229:   
 230:              return Ia.Ngn.Cl.Model.Data.Msmq.GatewayIdQueue.Count;
 231:          }
 232:   
 233:          ////////////////////////////////////////////////////////////////////////////
 234:          ////////////////////////////////////////////////////////////////////////////
 235:      }
 236:  }