Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » Access

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

Access support class for Next Generation Network (NGN) ui model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.Security;
   6:  using System.Text.RegularExpressions;
   7:  using System.Data;
   8:  using System.Data.Entity;
   9:   
  10:  namespace Ia.Ngn.Cl.Model.Ui
  11:  {
  12:      ////////////////////////////////////////////////////////////////////////////
  13:   
  14:      /// <summary publish="true">
  15:      /// Access support class for Next Generation Network (NGN) ui model.
  16:      /// </summary>
  17:      /// 
  18:      /// <remarks> 
  19:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  20:      ///
  21:      /// 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
  22:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  23:      ///
  24:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  25:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  26:      /// 
  27:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  28:      /// 
  29:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  30:      /// </remarks> 
  31:      public partial class Access
  32:      {
  33:          /// <summary/>
  34:          public Access() { }
  35:   
  36:          ////////////////////////////////////////////////////////////////////////////
  37:   
  38:          /// <summary>
  39:          ///
  40:          /// </summary>
  41:          public static DataTable ReadListWithOntListProvisionedAndReadyButDoNotExistInCustomerDepartmentDatabaseDataTable()
  42:          {
  43:              return ReadListWithOntListProvisionedAndReadyButDoNotExistInCustomerDepartmentDatabaseDataTable(99999);
  44:          }
  45:   
  46:          ////////////////////////////////////////////////////////////////////////////
  47:   
  48:          /// <summary>
  49:          ///
  50:          /// </summary>
  51:          public static DataTable ReadListWithOntListProvisionedAndReadyButDoNotExistInCustomerDepartmentDatabaseDataTable(int numberOfFirstRowsToTake)
  52:          {
  53:              bool familyExists;
  54:              int c, possibleNumberOfTd, possibleNumberOfEthernet;
  55:              string /*accessId, ponNumber, ontNumber,*/ areaSymbol, areaName, accessOntOnuFamilyTypeCapacityString;
  56:              DataRow dr;
  57:              DataTable dt;
  58:              List<Ia.Ngn.Cl.Model.Access> accessList;
  59:              Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea kuwaitNgnArea;
  60:   
  61:              familyExists = false;
  62:              c = 0;
  63:              possibleNumberOfTd = possibleNumberOfEthernet = 0;
  64:   
  65:              dt = new DataTable("");
  66:              dt.Columns.Add("Id");
  67:              dt.Columns.Add("Pon");
  68:              dt.Columns.Add("Ont");
  69:              dt.Columns.Add("Name");
  70:              dt.Columns.Add("FamilyType");
  71:              dt.Columns.Add("AreaSymbol");
  72:              dt.Columns.Add("Area");
  73:              dt.Columns.Add("Block");
  74:              dt.Columns.Add("Street");
  75:              dt.Columns.Add("PremisesOld");
  76:              dt.Columns.Add("PremisesNew");
  77:              dt.Columns.Add("Paci");
  78:              dt.Columns.Add("Note");
  79:              dt.Columns.Add("PossibleNumberOfTd");
  80:              dt.Columns.Add("PossibleNumberOfEthernet");
  81:   
  82:              accessList = Ia.Ngn.Cl.Model.Data.Access.ListOfAccessesWithProvisionedAndReadyOntsAndOnusAndEmsOntsButDoNotExistInCustomerDepartmentDatabase();
  83:   
  84:              accessList = accessList.OrderByDescending(a => a.Created).ToList();
  85:   
  86:              foreach (Ia.Ngn.Cl.Model.Access access in accessList)
  87:              {
  88:                  familyExists = false;
  89:                  possibleNumberOfTd = possibleNumberOfEthernet = 0;
  90:   
  91:                  if (access.Onts != null && access.Onts.Count > 0)
  92:                  {
  93:                      accessOntOnuFamilyTypeCapacityString = Ia.Ngn.Cl.Model.Data.Nokia.Ont.FamilyTypeFromId(access.Onts.FirstOrDefault().FamilyTypeId);
  94:   
  95:                      possibleNumberOfTd = Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType(access.Onts.FirstOrDefault().FamilyTypeId);
  96:                      possibleNumberOfEthernet = Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfHsiCardPortServiceConfigurationForOntFamilyType(access.Onts.FirstOrDefault().FamilyTypeId);
  97:   
  98:                      accessOntOnuFamilyTypeCapacityString += " (" + possibleNumberOfTd + ")";
  99:   
 100:                      familyExists = true;
 101:                  }
 102:                  else if (access.EmsOnts != null && access.EmsOnts.Count > 0)
 103:                  {
 104:                      accessOntOnuFamilyTypeCapacityString = Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyTypeStringFromEquipmentType(access.EmsOnts.FirstOrDefault().EquipmentType);
 105:   
 106:                      possibleNumberOfTd = Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleNumberOfTdForOntEquipmentType(access.EmsOnts.FirstOrDefault().EquipmentType);
 107:                      possibleNumberOfEthernet = Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleNumberOfHsiServiceForOntEquipmentType(access.EmsOnts.FirstOrDefault().EquipmentType);
 108:   
 109:                      accessOntOnuFamilyTypeCapacityString += " (" + possibleNumberOfTd + ")";
 110:   
 111:                      familyExists = true;
 112:                  }
 113:                  else if (access.Onus != null && access.Onus.Count > 0)
 114:                  {
 115:                      accessOntOnuFamilyTypeCapacityString = Ia.Ngn.Cl.Model.Data.Huawei.Onu.FamilyTypeFromId(access.Onus.FirstOrDefault().FamilyTypeId);
 116:   
 117:                      possibleNumberOfTd = Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleNumberOfTdForOntEquipmentType(access.Onus.FirstOrDefault().FamilyTypeId);
 118:                      possibleNumberOfEthernet = Ia.Ngn.Cl.Model.Business.Huawei.Ems.PossibleNumberOfHsiServiceForOntEquipmentType(access.Onus.FirstOrDefault().FamilyTypeId);
 119:   
 120:                      accessOntOnuFamilyTypeCapacityString += " (" + possibleNumberOfTd + ")";
 121:   
 122:                      familyExists = true;
 123:                  }
 124:                  else accessOntOnuFamilyTypeCapacityString = "";
 125:   
 126:                  if (familyExists)
 127:                  {
 128:                      c++;
 129:   
 130:                      dr = dt.NewRow();
 131:   
 132:                      dr["Id"] = access.Id;
 133:                      dr["Pon"] = access.Pon;
 134:                      dr["Ont"] = access.Ont;
 135:                      dr["Name"] = access.Name;
 136:                      dr["Paci"] = access.Paci;
 137:                      dr["Note"] = access.Note;
 138:   
 139:                      dr["FamilyType"] = accessOntOnuFamilyTypeCapacityString;
 140:   
 141:                      kuwaitNgnArea = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == access.AreaId select kna).SingleOrDefault();
 142:   
 143:                      areaName = kuwaitNgnArea.Name;
 144:                      areaSymbol = kuwaitNgnArea.Symbol;
 145:   
 146:                      dr["AreaSymbol"] = areaSymbol;
 147:                      dr["Area"] = areaName;
 148:   
 149:                      dr["Block"] = access.Block;
 150:                      dr["Street"] = access.Street;
 151:                      dr["PremisesOld"] = access.PremisesOld;
 152:                      dr["PremisesNew"] = access.PremisesNew;
 153:   
 154:                      dr["PossibleNumberOfTd"] = possibleNumberOfTd;
 155:                      dr["PossibleNumberOfEthernet"] = possibleNumberOfEthernet;
 156:   
 157:                      dt.Rows.Add(dr);
 158:   
 159:                      if (c >= numberOfFirstRowsToTake) break;
 160:                  }
 161:                  else
 162:                  {
 163:   
 164:                  }
 165:              }
 166:   
 167:              return dt;
 168:          }
 169:   
 170:          ////////////////////////////////////////////////////////////////////////////
 171:          ////////////////////////////////////////////////////////////////////////////
 172:      }
 173:   
 174:      ////////////////////////////////////////////////////////////////////////////
 175:      ////////////////////////////////////////////////////////////////////////////
 176:  }