)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation Links

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

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

   1:  using System.Linq;
   2:  using System.Runtime.Serialization;
   3:  using System.Web.Http;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Api.Controller
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Access API Controller class of Next Generation Network'a (NGN's) model.
  11:      /// </summary>
  12:      /// 
  13:      /// <remarks> 
  14:      /// Copyright © 2006-2017 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 AccessController : ApiController
  27:      {
  28:          ////////////////////////////////////////////////////////////////////////////
  29:   
  30:          /// <summary>
  31:          /// 
  32:          /// </summary>
  33:          [DataContract(IsReference = true, Name = "apiResult")]
  34:          public class Result
  35:          {
  36:              [DataMember(Name = "isSuccessful")]
  37:              public bool IsSuccessful { get; set; }
  38:   
  39:              [DataMember(Name = "message")]
  40:              public string Message { get; set; }
  41:          }
  42:   
  43:          ////////////////////////////////////////////////////////////////////////////
  44:   
  45:          /// <summary>
  46:          /// Create an access
  47:          /// </summary>
  48:          [HttpPost]
  49:          [Route("api/accesses/{key}/{accessName}/{kuwaitAreaName}/{block}/{street}/{premisesOld}/{premisesNew}/{paci}/{note}")]
  50:          public Result Create(string key, string accessName, string kuwaitNgnAreaSymbol, string block, string street, string premisesOld, string premisesNew, string odf, string paci, string note)
  51:          {
  52:              Ia.Cl.Model.Result result;
  53:              Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact;
  54:   
  55:              result = new Ia.Cl.Model.Result();
  56:   
  57:              staffContact = (from s in Ia.Ngn.Cl.Model.Data.Administration.StaffContactList where s.ApiKey == key select s).SingleOrDefault();
  58:   
  59:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
  60:              {
  61:                  Ia.Ngn.Cl.Model.Business.Access.Create(accessName, kuwaitNgnAreaSymbol, block, street, premisesOld, premisesNew, odf, paci, note, staffContact.UserId, out result);
  62:   
  63:                  Ia.Ngn.Cl.Model.Data.Msmq.AccessNameQueue.ProvisionAccessQueue.Enqueue(accessName);
  64:              }
  65:              else
  66:              {
  67:                  result.AddError("You are not authorized to modify this value (لست مخولاً بتعديل هذه القيمة). ");
  68:              }
  69:   
  70:              return new Result() { IsSuccessful = result.IsSuccessful, Message = result.Message };
  71:          }
  72:   
  73:          ////////////////////////////////////////////////////////////////////////////
  74:   
  75:          /// <summary>
  76:          /// Delete an access
  77:          /// </summary>
  78:          [HttpDelete]
  79:          [Route("api/accesses/{key}/{accessName}")]
  80:          public Result Delete(string key, string accessName)
  81:          {
  82:              Ia.Cl.Model.Result result;
  83:              Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact;
  84:   
  85:              result = new Ia.Cl.Model.Result();
  86:              staffContact = (from s in Ia.Ngn.Cl.Model.Data.Administration.StaffContactList where s.ApiKey == key select s).SingleOrDefault();
  87:   
  88:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Delete, staffContact))
  89:              {
  90:                  Ia.Ngn.Cl.Model.Business.Access.Delete(accessName, staffContact.UserId, out result);
  91:              }
  92:              else
  93:              {
  94:                  result.AddError("You are not authorized to modify this value (لست مخولاً بتعديل هذه القيمة). ");
  95:              }
  96:   
  97:              return new Result() { IsSuccessful = result.IsSuccessful, Message = result.Message };
  98:          }
  99:   
 100:          ////////////////////////////////////////////////////////////////////////////
 101:          ////////////////////////////////////////////////////////////////////////////
 102:      }
 103:  }