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

Integrated Applications Programming Company

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:                                      // field type color
 162:                                      if (olt.FieldType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.FieldType.Green)
 163:                                          htmlTable += @"<td style=""background-color:green""> </td><td class=olt>" + OltStructureDataTable(olt) + "</td>";
 164:                                      else /*if (olt.FieldType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.FieldType.Brown)*/
 165:                                          htmlTable += @"<td style=""background-color:brown""> </td><td class=olt>" + OltStructureDataTable(olt) + "</td>";
 166:   
 167:                                      htmlTable += @"</tr>";
 168:   
 169:                                      oltCount++;
 170:                                  }
 171:   
 172:                                  odfCount++;
 173:                              }
 174:                          }
 175:                          else routerCount--;
 176:   
 177:                          routerCount++;
 178:                      }
 179:                  }
 180:   
 181:                  siteCount++;
 182:              }
 183:   
 184:              htmlTable += "</table>";
 185:   
 186:              htmlTable += "</div>";
 187:   
 188:              return htmlTable;
 189:          }
 190:   
 191:          ////////////////////////////////////////////////////////////////////////////    
 192:   
 193:          /// <summary>
 194:          /// 
 195:          /// </summary>
 196:          private static string SiteStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site site)
 197:          {
 198:              string content, kuwaitNgnAreas;
 199:   
 200:              kuwaitNgnAreas = "";
 201:   
 202:              foreach (Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea ka in site.KuwaitNgnAreas) kuwaitNgnAreas += ka.NameArabicName + "<br/>";
 203:   
 204:              kuwaitNgnAreas = kuwaitNgnAreas.Trim(',');
 205:   
 206:              content = site.NameArabicName;
 207:              content += @"<br/>" + string.Join(", ", site.AreaSymbolList);
 208:              content += @"<br/>" + kuwaitNgnAreas;
 209:   
 210:              return content;
 211:          }
 212:   
 213:          ////////////////////////////////////////////////////////////////////////////    
 214:   
 215:          /// <summary>
 216:          /// 
 217:          /// </summary>
 218:          private static string RouterStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Router router)
 219:          {
 220:              string content, domainList;
 221:   
 222:              domainList = "";
 223:   
 224:              foreach (int i in router.DomainList) domainList += i + ", ";
 225:   
 226:              domainList = domainList.Trim();
 227:              domainList = domainList.Trim(',');
 228:   
 229:              content = router.Vendor.Name;
 230:              content += @"<br/>" + domainList;
 231:   
 232:              return content;
 233:          }
 234:   
 235:          ////////////////////////////////////////////////////////////////////////////    
 236:   
 237:          /// <summary>
 238:          /// 
 239:          /// </summary>
 240:          private static string OdfStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Odf odf)
 241:          {
 242:              string content;
 243:   
 244:              content = odf.Name + @"<br/>" + odf.Vendor.Name;
 245:   
 246:              return content;
 247:          }
 248:   
 249:          ////////////////////////////////////////////////////////////////////////////    
 250:   
 251:          /// <summary>
 252:          /// 
 253:          /// </summary>
 254:          private static string OltStructureDataTable(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt)
 255:          {
 256:              string content;
 257:              List<int> ponlist, proposedPonList;
 258:   
 259:              ponlist = new List<int>();
 260:              proposedPonList = new List<int>();
 261:   
 262:              content = olt.Symbol;
 263:              content += @" (" + olt.AmsName + ") ";
 264:   
 265:              foreach (var ponGroup in olt.PonGroupList)
 266:              {
 267:                  foreach (int i in ponGroup.UsedPonInPonGroupList) if (i != 0) ponlist.Add(i);
 268:   
 269:                  if (ponGroup.HasNewProposedPonList) foreach (int i in ponGroup.UsedProposedPonInPonGroupList) if (i != 0) proposedPonList.Add(i);
 270:              }
 271:   
 272:              content += "<br/>";
 273:              content += @" SIP?: " + Ia.Cl.Model.Default.YesNo(olt.IsSip) + " ";
 274:   
 275:              content += "<br/>";
 276:              content += @" PONs: " + Ia.Cl.Model.Default.ConvertNumberListToHyphenAndCommaSeperatedNumberString(ponlist) + " ";
 277:   
 278:              if (proposedPonList.Count > 0)
 279:              {
 280:                  content += "<br/>";
 281:                  content += @" <b>Proposed PONs: " + Ia.Cl.Model.Default.ConvertNumberListToHyphenAndCommaSeperatedNumberString(proposedPonList) + "</b>";
 282:              }
 283:   
 284:              //content += @" (" + olt.PonListString + ") ";
 285:   
 286:              return content;
 287:          }
 288:   
 289:          ////////////////////////////////////////////////////////////////////////////
 290:          ////////////////////////////////////////////////////////////////////////////    
 291:      }
 292:  }