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