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

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

Network Design Document support class for Next Generation Network (NGN) UI model.

   1:  using System;
   2:  using System.Web;
   3:  using System.Xml;
   4:  using System.Xml.Linq;
   5:  using System.IO;
   6:  using System.Configuration;
   7:  using System.Text;
   8:  using System.Text.RegularExpressions;
   9:  using System.Data;
  10:  using System.Data.SqlClient;
  11:  using System.Web.UI;
  12:  using System.Web.UI.WebControls;
  13:  using System.Collections;
  14:  using System.Collections.Generic;
  15:  using System.Reflection;
  16:  using System.Linq;
  17:  using System.Runtime.Serialization;
  18:   
  19:  namespace Ia.Ngn.Cl.Model.Ui
  20:  {
  21:      ////////////////////////////////////////////////////////////////////////////
  22:   
  23:      /// <summary publish="true">
  24:      /// Network Design Document support class for Next Generation Network (NGN) UI model.
  25:      /// </summary>
  26:      /// 
  27:      /// <remarks> 
  28:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  29:      ///
  30:      /// 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
  31:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  32:      ///
  33:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  34:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  35:      /// 
  36:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  37:      /// 
  38:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  39:      /// </remarks> 
  40:      public partial class NetworkDesignDocument
  41:      {
  42:          ////////////////////////////////////////////////////////////////////////////
  43:   
  44:          /// <summary>
  45:          ///
  46:          /// </summary>
  47:          public NetworkDesignDocument() { }
  48:   
  49:          ////////////////////////////////////////////////////////////////////////////
  50:   
  51:          /// <summary>
  52:          /// 
  53:          /// </summary>
  54:          [DataContract(IsReference = true, Name = "apiOnt")]
  55:          public class Ont
  56:          {
  57:              /// <summary/>
  58:              [DataMember(Name = "id")]
  59:              public string Id { get; set; }
  60:   
  61:              /// <summary/>
  62:              [DataMember(Name = "rack")]
  63:              public int Rack { get; set; }
  64:   
  65:              /// <summary/>
  66:              [DataMember(Name = "sub")]
  67:              public int Sub { get; set; }
  68:   
  69:              /// <summary/>
  70:              [DataMember(Name = "card")]
  71:              public int Card { get; set; }
  72:   
  73:              /// <summary/>
  74:              [DataMember(Name = "port")]
  75:              public int Port { get; set; }
  76:   
  77:              /// <summary/>
  78:              [DataMember(Name = "number")]
  79:              public int Number { get; set; }
  80:   
  81:              /// <summary/>
  82:              [DataMember(Name = "position")]
  83:              public string Position { get; set; }
  84:   
  85:              /// <summary/>
  86:              [DataMember(Name = "ip")]
  87:              public string Ip { get; set; }
  88:   
  89:              /// <summary/>
  90:              [DataMember(Name = "mgcIp")]
  91:              public string MgcIp { get; set; }
  92:   
  93:              /// <summary/>
  94:              [DataMember(Name = "mgcSecondaryIp")]
  95:              public string MgcSecondaryIp { get; set; }
  96:   
  97:              /// <summary/>
  98:              [DataMember(Name = "mgcSubnetMask")]
  99:              public string MgcSubnetMask { get; set; }
 100:   
 101:              /// <summary/>
 102:              [DataMember(Name = "imsService")]
 103:              public int ImsService { get; set; }
 104:   
 105:              /// <summary/>
 106:              [DataMember(Name = "imsFsdb")]
 107:              public string ImsFsdb { get; set; }
 108:   
 109:              /// <summary/>
 110:              [DataMember(Name = "primarySwitch")]
 111:              public string PrimarySwitch { get; set; }
 112:   
 113:              /// <summary/>
 114:              [DataMember(Name = "ponName")]
 115:              public string PonName { get; set; }
 116:   
 117:              /// <summary/>
 118:              [DataMember(Name = "accessName")]
 119:              public string AccessName { get; set; }
 120:          }
 121:   
 122:          ////////////////////////////////////////////////////////////////////////////    
 123:   
 124:          /// <summary>
 125:          /// 
 126:          /// </summary>
 127:          public static string StructureDataTable()
 128:          {
 129:              int siteCount, routerCount, odfCount, msanCount, oltCount;
 130:              int siteOltCount, siteMsanCount, routerOltCount, routerMsanCount, odfOltCount, oltOltCount;
 131:              string htmlTable;
 132:   
 133:              siteCount = routerCount = odfCount = msanCount = oltCount = 0;
 134:              siteOltCount = siteMsanCount = routerOltCount = routerMsanCount = odfOltCount = oltOltCount = 0;
 135:   
 136:              htmlTable = @"<div id=""network-design-document-structure"">";
 137:   
 138:              htmlTable += "<table>";
 139:   
 140:              siteCount = 1;
 141:   
 142:              foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site site in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SiteList)
 143:              {
 144:                  siteOltCount = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Odf != null && o.Odf.Router != null && o.Odf.Router.Site == site select o).Count();
 145:                  siteMsanCount = (from m in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.MsanList where m.Router != null && m.Router.Site == site select m).Count();
 146:   
 147:                  if (site.Routers.Count > 0)
 148:                  {
 149:                      routerCount = 1;
 150:   
 151:                      foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Router router in site.Routers)
 152:                      {
 153:                          routerOltCount = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Odf != null && o.Odf.Router == router select o).Count();
 154:                          routerMsanCount = (from m in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.MsanList where m.Router == router select m).Count();
 155:   
 156:                          if (router.Odfs.Count > 0 || router.Msans.Count > 0)
 157:                          {
 158:                              odfCount = 1;
 159:   
 160:                              foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Odf odf in router.Odfs)
 161:                              {
 162:                                  odfOltCount = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Odf == odf select o).Count();
 163:   
 164:                                  oltCount = 1;
 165:   
 166:                                  foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt in odf.Olts)
 167:                                  {
 168:                                      oltOltCount = odf.Olts.Count;
 169:   
 170:                                      htmlTable += @"<tr class=site" + siteCount + ">";
 171:   
 172:                                      if (routerCount == 1 && odfCount == 1 && oltCount == 1) htmlTable += "<td class=site rowspan=" + (siteOltCount + siteMsanCount) + ">" + SiteStructureDataTable(site) + "</td>";
 173:                                      if (odfCount == 1 && oltCount == 1) htmlTable += "<td class=router rowspan=" + (routerOltCount + routerMsanCount) + ">" + RouterStructureDataTable(router) + "</td>";
 174:                                      if (oltCount == 1) htmlTable += "<td class=odf rowspan=" + odfOltCount + ">" + OdfStructureDataTable(odf) + "</td>";
 175:   
 176:                                      htmlTable += "<td class=olt>" + OltStructureDataTable(olt) + "</td>";
 177:   
 178:                                      htmlTable += @"</tr>";
 179:   
 180:                                      oltCount++;
 181:                                  }
 182:   
 183:                                  odfCount++;
 184:                              }
 185:   
 186:                              msanCount = 1;
 187:   
 188:                              foreach (Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Msan msan in router.Msans)
 189:                              {
 190:                                  htmlTable += @"<tr class=site" + siteCount + ">";
 191:   
 192:                                  if (routerCount == 1 && odfCount == 1 && msanCount == 1) htmlTable += "<td class=site rowspan=" + (siteOltCount + siteMsanCount) + ">" + SiteStructureDataTable(site) + "</td>";
 193:                                  if (odfCount == 1 && msanCount == 1) htmlTable += "<td class=router rowspan=" + (routerOltCount + routerMsanCount) + ">" + RouterStructureDataTable(router) + "</td>";
 194:                                  if (msanCount == 1) htmlTable += "<td class=msan rowspan=" + routerMsanCount + ">" + MsanStructureDataTable(msan) + "</td>";
 195:   
 196:                                  htmlTable += "<td class=cabinet>" + MsanCabinetStructureDataTable(msan) + "</td>";
 197:   
 198:                                  htmlTable += @"</tr>";
 199:   
 200:                                  msanCount++;
 201:                              }
 202:                          }
 203:                          else routerCount--;
 204:   
 205:                          routerCount++;
 206:                      }
 207:                  }
 208:   
 209:                  siteCount++;
 210:              }
 211:             
 212:              htmlTable += "</table>";
 213:   
 214:              htmlTable += "</div>";
 215:   
 216:              return htmlTable;
 217:          }
 218:   
 219:          ////////////////////////////////////////////////////////////////////////////    
 220:   
 221:          /// <summary>
 222:          /// 
 223:          /// </summary>
 224:          private static string SiteStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site site)
 225:          {
 226:              string content, kuwaitNgnAreas;
 227:   
 228:              kuwaitNgnAreas = "";
 229:   
 230:              foreach (Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea ka in site.KuwaitNgnAreas) kuwaitNgnAreas += ka.NameArabicName + "<br/>";
 231:   
 232:              kuwaitNgnAreas = kuwaitNgnAreas.Trim(',');
 233:   
 234:              content = site.NameArabicName;
 235:              content += @"<br/>" + site.AreaSymbolList;
 236:              content += @"<br/>" + kuwaitNgnAreas;
 237:   
 238:              return content;
 239:          }
 240:   
 241:          ////////////////////////////////////////////////////////////////////////////    
 242:   
 243:          /// <summary>
 244:          /// 
 245:          /// </summary>
 246:          private static string RouterStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Router router)
 247:          {
 248:              string content, domainList;
 249:   
 250:              domainList = "";
 251:   
 252:              foreach (int i in router.DomainList) domainList += i + ", ";
 253:   
 254:              domainList = domainList.Trim();
 255:              domainList = domainList.Trim(',');
 256:   
 257:              content = router.Vendor.Name;
 258:              content += @"<br/>" + domainList;
 259:   
 260:              return content;
 261:          }
 262:   
 263:          ////////////////////////////////////////////////////////////////////////////    
 264:   
 265:          /// <summary>
 266:          /// 
 267:          /// </summary>
 268:          private static string OdfStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Odf odf)
 269:          {
 270:              string content;
 271:   
 272:              content = odf.Name + @"<br/>" + odf.Vendor.Name;
 273:   
 274:              return content;
 275:          }
 276:   
 277:          ////////////////////////////////////////////////////////////////////////////    
 278:   
 279:          /// <summary>
 280:          /// 
 281:          /// </summary>
 282:          private static string MsanStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Msan msan)
 283:          {
 284:              string content;
 285:   
 286:              content = msan.Name + @"<br/>" + msan.Vendor.Name;
 287:   
 288:              return content;
 289:          }
 290:   
 291:          ////////////////////////////////////////////////////////////////////////////    
 292:   
 293:          /// <summary>
 294:          /// 
 295:          /// </summary>
 296:          private static string MsanCabinetStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Msan msan)
 297:          {
 298:              string content;
 299:   
 300:              content = "MSAN Cabinet *";
 301:   
 302:              return content;
 303:          }
 304:   
 305:          ////////////////////////////////////////////////////////////////////////////    
 306:   
 307:          /// <summary>
 308:          /// 
 309:          /// </summary>
 310:          private static string OltStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt)
 311:          {
 312:              string content;
 313:              List<int> ponlist, proposedPonList;
 314:   
 315:              ponlist = new List<int>();
 316:              proposedPonList = new List<int>();
 317:   
 318:              content = olt.Symbol;
 319:              content += @" (" + olt.AmsName + ") ";
 320:   
 321:              foreach (var ponGroup in olt.PonGroupList)
 322:              {
 323:                  foreach (int i in ponGroup.UsedPonInPonGroupList) if (i != 0) ponlist.Add(i);
 324:   
 325:                  if(ponGroup.HasNewProposedPonList) foreach (int i in ponGroup.UsedProposedPonInPonGroupList) if (i != 0) proposedPonList.Add(i);
 326:              }
 327:   
 328:              content += "<br/>";
 329:              content += @" PONs: " + Ia.Cl.Model.Default.ConvertNumberListToHyphenAndCommaSeperatedNumberString(ponlist) + " ";
 330:   
 331:              if (proposedPonList.Count > 0)
 332:              {
 333:                  content += "<br/>";
 334:                  content += @" <b>Proposed PONs: " + Ia.Cl.Model.Default.ConvertNumberListToHyphenAndCommaSeperatedNumberString(proposedPonList) + "</b>";
 335:              }
 336:   
 337:              //content += @" (" + olt.PonListString + ") ";
 338:   
 339:              return content;
 340:          }
 341:   
 342:          ////////////////////////////////////////////////////////////////////////////
 343:          ////////////////////////////////////////////////////////////////////////////    
 344:      }
 345:  }