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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » NetworkDesignDocumentController

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

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

   1:  using System.Collections.Generic;
   2:  using System.Linq;
   3:  using System.Web.Http;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Api.Controller
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// NetworkDesignDocument 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), Internet 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 NetworkDesignDocumentController : ApiController
  27:      {
  28:          ////////////////////////////////////////////////////////////////////////////
  29:   
  30:          /// <summary>
  31:          /// Create an access
  32:          /// </summary>
  33:          [HttpGet]
  34:          public List<Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont> OntList(string key)
  35:          {
  36:              Ia.Cl.Model.Result result;
  37:              Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont nddOnt;
  38:              Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact;
  39:              List<Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont> nddOntList;
  40:   
  41:              result = new Ia.Cl.Model.Result();
  42:              nddOntList = new List<Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont>();
  43:   
  44:              staffContact = (from s in Ia.Ngn.Cl.Model.Data.Administration.StaffContactList where s.ApiKey == key select s).SingleOrDefault();
  45:   
  46:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteNetworkDesignDocument(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Read, staffContact))
  47:              {
  48:                  foreach (var n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList)
  49:                  {
  50:                      nddOnt = new Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont()
  51:                      {
  52:                          AccessName = n.Access.Name,
  53:                          Card = n.CardSlot,
  54:                          PrimarySwitch = n.PrimarySwitch,
  55:                          Id = n.Id,
  56:                          ImsFsdb = n.ImsFsdb,
  57:                          ImsService = n.ImsService,
  58:                          Ip = n.Ip,
  59:                          MgcIp = n.MgcIp,
  60:                          MgcSecondaryIp = n.MgcSecondaryIp,
  61:                          MgcSubnetMask = n.MgcSubnetMask,
  62:                          Number = n.Number,
  63:                          PonName = n.Pon.Name,
  64:                          Port = n.Port,
  65:                          Position = n.Position,
  66:                          Rack = n.Rack,
  67:                          Sub = n.Sub
  68:                      };
  69:   
  70:                      nddOntList.Add(nddOnt);
  71:                  }
  72:              }
  73:              else
  74:              {
  75:                  result.AddError("You are not authorized to modify this value (لست مخولاً بتعديل هذه القيمة). ");
  76:              }
  77:   
  78:              return nddOntList;
  79:          }
  80:   
  81:          ////////////////////////////////////////////////////////////////////////////
  82:   
  83:          /// <summary>
  84:          /// Create an access
  85:          /// </summary>
  86:          [HttpGet]
  87:          public List<Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont> OntList(string key, string oltName)
  88:          {
  89:              Ia.Cl.Model.Result result;
  90:              Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont nddOnt;
  91:              Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact;
  92:              List<Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont> nddOntList;
  93:   
  94:              result = new Ia.Cl.Model.Result();
  95:              nddOntList = new List<Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont>();
  96:   
  97:              staffContact = (from s in Ia.Ngn.Cl.Model.Data.Administration.StaffContactList where s.ApiKey == key select s).SingleOrDefault();
  98:   
  99:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteNetworkDesignDocument(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Read, staffContact))
 100:              {
 101:                  if (!string.IsNullOrEmpty(oltName))
 102:                  {
 103:                      oltName = oltName.ToUpper();
 104:   
 105:                      foreach (var n in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList.Where(u => u.Pon.PonGroup.Olt.Name == oltName))
 106:                      {
 107:                          nddOnt = new Ia.Ngn.Cl.Model.Ui.NetworkDesignDocument.Ont()
 108:                          {
 109:                              AccessName = n.Access.Name,
 110:                              Card = n.CardSlot,
 111:                              PrimarySwitch = n.PrimarySwitch,
 112:                              Id = n.Id,
 113:                              ImsFsdb = n.ImsFsdb,
 114:                              ImsService = n.ImsService,
 115:                              Ip = n.Ip,
 116:                              MgcIp = n.MgcIp,
 117:                              MgcSecondaryIp = n.MgcSecondaryIp,
 118:                              MgcSubnetMask = n.MgcSubnetMask,
 119:                              Number = n.Number,
 120:                              PonName = n.Pon.Name,
 121:                              Port = n.Port,
 122:                              Position = n.Position,
 123:                              Rack = n.Rack,
 124:                              Sub = n.Sub
 125:                          };
 126:   
 127:                          nddOntList.Add(nddOnt);
 128:                      }
 129:                  }
 130:              }
 131:              else
 132:              {
 133:                  result.AddError("You are not authorized to modify this value (لست مخولاً بتعديل هذه القيمة). ");
 134:              }
 135:   
 136:              return nddOntList;
 137:          }
 138:   
 139:          ////////////////////////////////////////////////////////////////////////////
 140:          ////////////////////////////////////////////////////////////////////////////
 141:      }
 142:  }