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