)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » NetworkDesignDocument (Ia.Ftn.Cl.Models.Business)

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

Network Design Document support class for Fixed Telecommunications Network (FTN) business model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Data;
    4: using System.Linq;
    5: using System.Text;
    6:  
    7: namespace Ia.Ftn.Cl.Models.Business
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Network Design Document support class for Fixed Telecommunications Network (FTN) business model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     ///
   18:     /// 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
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     public class NetworkDesignDocument
   29:     {
   30:         /// <summary/>
   31:         public const int PrecautionaryHardCodedNumberOfOntRecords = 223544;
   32:  
   33:         /// <summary/>
   34:         public enum FieldType { Green = 1, Brown = 2 };
   35:  
   36:         /// <summary/>
   37:         public enum PstnExchangeType { EricssonAxe = 1, SiemensEwsd = 2, NortelMeridian = 3 };
   38:  
   39:         ////////////////////////////////////////////////////////////////////////////
   40:  
   41:         /// <summary>
   42:         ///
   43:         /// </summary>
   44:         public NetworkDesignDocument() { }
   45:  
   46:         ////////////////////////////////////////////////////////////////////////////
   47:  
   48:         /// <summary>
   49:         ///
   50:         /// </summary>
   51:         public static string FieldTypeColoredString(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldType fieldType)
   52:         {
   53:             string fieldTypeColoredString;
   54:  
   55:             switch (fieldType)
   56:             {
   57:                 case FieldType.Green: fieldTypeColoredString = "<span style=\"color:green\">Green</span>"; break;
   58:                 case FieldType.Brown: fieldTypeColoredString = "<span style=\"color:brown\">Brown</span>"; break;
   59:                 default: fieldTypeColoredString = string.Empty; break;
   60:             }
   61:  
   62:             return fieldTypeColoredString;
   63:         }
   64:  
   65:         ////////////////////////////////////////////////////////////////////////////
   66:  
   67:         /// <summary>
   68:         ///
   69:         /// </summary>
   70:         public static string FieldTypeString(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldType fieldType)
   71:         {
   72:             string fieldTypeColoredString;
   73:  
   74:             switch (fieldType)
   75:             {
   76:                 case FieldType.Green: fieldTypeColoredString = "Green"; break;
   77:                 case FieldType.Brown: fieldTypeColoredString = "Brown"; break;
   78:                 default: fieldTypeColoredString = string.Empty; break;
   79:             }
   80:  
   81:             return fieldTypeColoredString;
   82:         }
   83:  
   84:         ////////////////////////////////////////////////////////////////////////////
   85:  
   86:         /// <summary>
   87:         ///
   88:         /// </summary>
   89:         public class Vendor
   90:         {
   91:             /// <summary/>
   92:             public int Id { get; set; }
   93:  
   94:             /// <summary/>
   95:             public string Name { get; set; }
   96:  
   97:             /// <summary/>
   98:             public string ShortName { get; set; }
   99:  
  100:             /// <summary/>
  101:             public string ArabicName { get; set; }
  102:  
  103:             /// <summary/>
  104:             public string ImageUrl { get; set; }
  105:  
  106:             /// <summary/>
  107:             public Vendor(int id, string name, string shortName, string arabicName, string imageUrl)
  108:             {
  109:                 this.Id = id;
  110:                 this.Name = name;
  111:                 this.ShortName = shortName;
  112:                 this.ArabicName = arabicName;
  113:                 this.ImageUrl = imageUrl;
  114:             }
  115:  
  116:             /// <summary/>
  117:             public virtual ICollection<Router> Routers
  118:             {
  119:                 get
  120:                 {
  121:                     return (from r in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.RouterList where r.Vendor == this select r).ToList();
  122:                 }
  123:             }
  124:  
  125:             /// <summary/>
  126:             public virtual ICollection<Odf> Odfs
  127:             {
  128:                 get
  129:                 {
  130:                     return (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OdfList where o.Vendor == this select o).ToList();
  131:                 }
  132:             }
  133:  
  134:             /// <summary/>
  135:             public static Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor Nokia
  136:             {
  137:                 get
  138:                 {
  139:                     return (from v in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.VendorList where v.ShortName == "No" select v).Single();
  140:                 }
  141:             }
  142:  
  143:             /// <summary/>
  144:             public static Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor Huawei
  145:             {
  146:                 get
  147:                 {
  148:                     return (from v in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.VendorList where v.ShortName == "Hu" select v).Single();
  149:                 }
  150:             }
  151:  
  152:             /// <summary/>
  153:             public static Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor Ericsson
  154:             {
  155:                 get
  156:                 {
  157:                     return (from v in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.VendorList where v.ShortName == "Er" select v).Single();
  158:                 }
  159:             }
  160:  
  161:             /// <summary/>
  162:             public static Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor Siemens
  163:             {
  164:                 get
  165:                 {
  166:                     return (from v in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.VendorList where v.ShortName == "Si" select v).Single();
  167:                 }
  168:             }
  169:  
  170:             /// <summary/>
  171:             public static Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor Undefined
  172:             {
  173:                 get
  174:                 {
  175:                     return (from v in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.VendorList where v.ShortName == "Un" select v).Single();
  176:                 }
  177:             }
  178:  
  179:             ////////////////////////////////////////////////////////////////////////////
  180:  
  181:             /// <summary>
  182:             ///
  183:             /// </summary>
  184:             public static string VendorNameFromId(int id)
  185:             {
  186:                 return (from v in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.VendorList where v.Id == id select v.Name).SingleOrDefault();
  187:             }
  188:  
  189:             ////////////////////////////////////////////////////////////////////////////
  190:  
  191:             /// <summary>
  192:             ///
  193:             /// </summary>
  194:             public static int VendorIdFromName(string name)
  195:             {
  196:                 int id;
  197:  
  198:                 switch (name)
  199:                 {
  200:                     case "Nokia": id = 1; break;
  201:                     case "ALCL": id = 1; break;
  202:                     case "Huawei": id = 2; break;
  203:                     case "Nokia-Siemens": id = 3; break;
  204:                     default: id = 0; break;
  205:                 }
  206:  
  207:                 return id;
  208:             }
  209:  
  210:             ////////////////////////////////////////////////////////////////////////////
  211:             ////////////////////////////////////////////////////////////////////////////
  212:         }
  213:  
  214:         ////////////////////////////////////////////////////////////////////////////
  215:  
  216:         /// <summary>
  217:         ///
  218:         /// </summary>
  219:         public class Network
  220:         {
  221:             /// <summary/>
  222:             public int Id { get; set; }
  223:  
  224:             /// <summary/>
  225:             public string Name { get; set; }
  226:  
  227:             /// <summary/>
  228:             public Network(int id, string name)
  229:             {
  230:                 this.Id = id;
  231:                 this.Name = name;
  232:             }
  233:  
  234:             /// <summary/>
  235:             public virtual ICollection<Site> Sites
  236:             {
  237:                 get
  238:                 {
  239:                     return (from s in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.SiteList where s.Network == this select s).ToList();
  240:                 }
  241:             }
  242:         }
  243:  
  244:         ////////////////////////////////////////////////////////////////////////////
  245:  
  246:         /// <summary>
  247:         ///
  248:         /// </summary>
  249:         public class Site
  250:         {
  251:             /// <summary/>
  252:             public int Id { get; set; }
  253:  
  254:             /// <summary/>
  255:             public string Name { get; set; }
  256:  
  257:             /// <summary/>
  258:             public string ArabicName { get; set; }
  259:  
  260:             /// <summary/>
  261:             public string NameArabicName
  262:             {
  263:                 get
  264:                 {
  265:                     return Name + " (" + ArabicName + ")";
  266:                 }
  267:             }
  268:  
  269:             /// <summary/>
  270:             public List<string> AreaSymbolList
  271:             {
  272:                 get
  273:                 {
  274:                     var list = this.Routers.SelectMany(u => u.Odfs.SelectMany(v => v.Olts.Select(w => w.Symbol))).Distinct().ToList();
  275:                     list.Remove("SSR");
  276:  
  277:                     return list;
  278:                 }
  279:             }
  280:  
  281:             /// <summary/>
  282:             public virtual Network Network { get; set; }
  283:  
  284:             /// <summary/>
  285:             public virtual ICollection<Pstn> Pstns
  286:             {
  287:                 get
  288:                 {
  289:                     if (this.Network.Id == 1)
  290:                     {
  291:                         // <network id="1" name="Fixed Telecommunications Network">
  292:  
  293:                         return (from p in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PstnList
  294:                                 where p.Site == this
  295:                                 select p).ToList();
  296:                     }
  297:                     else //if (this.Network.Id == 2)
  298:                     {
  299:                         // <network id="2" name="Legacy">
  300:  
  301:                         return (from p in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.LegacyPstnList
  302:                                 where p.Site == this
  303:                                 select p).ToList();
  304:                     }
  305:                 }
  306:             }
  307:  
  308:             /// <summary/>
  309:             public virtual ICollection<Msan> Msans
  310:             {
  311:                 get
  312:                 {
  313:                     return (from m in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.MsanList
  314:                             where m.Site == this
  315:                             select m).ToList();
  316:                 }
  317:             }
  318:  
  319:             /// <summary/>
  320:             public virtual ICollection<SoftX> SoftXes
  321:             {
  322:                 get
  323:                 {
  324:                     return (from s in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.SoftXList
  325:                             where s.Site == this
  326:                             select s).ToList();
  327:                 }
  328:             }
  329:  
  330:             /// <summary/>
  331:             public virtual ICollection<Router> Routers
  332:             {
  333:                 get
  334:                 {
  335:                     return (from r in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.RouterList
  336:                             where r.Site == this
  337:                             select r).ToList();
  338:                 }
  339:             }
  340:  
  341:             /// <summary/>
  342:             public virtual ICollection<Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea> KuwaitFtnAreas
  343:             {
  344:                 get
  345:                 {
  346:                     ICollection<Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea> ic;
  347:  
  348:                     ic = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList
  349:                           where this.AreaSymbolList.Contains(kna.Symbol)
  350:                           select kna).ToList();
  351:  
  352:                     return ic;
  353:                 }
  354:             }
  355:  
  356:             /// <summary/>
  357:             public List<int> DomainList
  358:             {
  359:                 get
  360:                 {
  361:                     if (this.Network.Id == 1)
  362:                     {
  363:                         // <network id="1" name="Fixed Telecommunications Network">
  364:  
  365:                         var siteRouterDomainList = (from r in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.RouterList
  366:                                                     where r.Site.Id == this.Id
  367:                                                     select r).SelectMany(z => z.DomainList).ToList();
  368:  
  369:                         return siteRouterDomainList;
  370:                     }
  371:                     else //if (this.Network.Id == 2)
  372:                     {
  373:                         // <network id="2" name="Legacy">
  374:  
  375:                         var legacySitePstnDomainListList = (from p in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.LegacyPstnList
  376:                                                             where p.Site.Id == this.Id
  377:                                                             select p).SelectMany(z => z.DomainList).ToList();
  378:  
  379:                         return legacySitePstnDomainListList;
  380:                     }
  381:                 }
  382:             }
  383:  
  384:             /// <summary/>
  385:             public int NumberOfPossibleServicesWithinDomainList
  386:             {
  387:                 get
  388:                 {
  389:                     return Ia.Ftn.Cl.Models.Data.Service.NumberOfPossibleServicesWithinDomainList(this.DomainList);
  390:                 }
  391:             }
  392:  
  393:             /// <summary/>
  394:             public Site() { }
  395:  
  396:             /// <summary/>
  397:             public int SiteId(int networkId, int siteId)
  398:             {
  399:                 return networkId * 100 + siteId;
  400:             }
  401:         }
  402:  
  403:         ////////////////////////////////////////////////////////////////////////////
  404:  
  405:         /// <summary>
  406:         ///
  407:         /// </summary>
  408:         public class Pstn
  409:         {
  410:             /// <summary/>
  411:             public int Id { get; set; }
  412:  
  413:             /// <summary/>
  414:             public string Name { get; set; }
  415:  
  416:             /// <summary/>
  417:             public string ArabicName { get; set; }
  418:  
  419:             /// <summary/>
  420:             public PstnExchangeType PstnExchangeType { get; set; }
  421:  
  422:             /// <summary/>
  423:             public bool UsesNpServer { get; set; }
  424:  
  425:             /// <summary/>
  426:             public string DomainListString { get; set; }
  427:  
  428:             /// <summary/>
  429:             public List<int> DomainList { get; set; }
  430:  
  431:             /// <summary/>
  432:             public virtual Site Site { get; set; }
  433:  
  434:             /// <summary/>
  435:             public Pstn() { }
  436:  
  437:             /// <summary/>
  438:             public int PstnId(int siteId, int pstnId)
  439:             {
  440:                 return siteId * 100 + pstnId;
  441:             }
  442:         }
  443:  
  444:         ////////////////////////////////////////////////////////////////////////////
  445:  
  446:         /// <summary>
  447:         ///
  448:         /// </summary>
  449:         public class Msan
  450:         {
  451:             private static int fixedLengthOfMsanId = 3 + 1;
  452:  
  453:             /// <summary/>
  454:             public static int FixedLengthOfMsanId { get { return fixedLengthOfMsanId; } }
  455:  
  456:             /// <summary/>
  457:             public string Id { get; set; }
  458:  
  459:             /// <summary/>
  460:             public string NameSymbol { get; set; }
  461:  
  462:             /// <summary/>
  463:             public bool UsesNpServer { get; set; }
  464:  
  465:             /// <summary/>
  466:             public string DomainListString { get; set; }
  467:  
  468:             /// <summary/>
  469:             public List<int> DomainList { get; set; }
  470:  
  471:             /// <summary/>
  472:             public virtual Site Site { get; set; }
  473:  
  474:             /// <summary/>
  475:             public Msan() { }
  476:  
  477:             /// <summary/>
  478:             public Msan(int id, string nameSymbol, Site site)
  479:             {
  480:                 Id = MsanId(site.Id, id);
  481:                 NameSymbol = nameSymbol;
  482:                 Site = site;
  483:             }
  484:  
  485:             /// <summary/>
  486:             public string MsanId(int siteId, int msanId)
  487:             {
  488:                 var id = siteId.ToString() + msanId;
  489:  
  490:                 if (id.Length != fixedLengthOfMsanId)
  491:                 {
  492:                     throw new ArgumentOutOfRangeException(@"MsanId(): Id length is not " + fixedLengthOfMsanId);
  493:                 }
  494:  
  495:                 return id;
  496:             }
  497:         }
  498:  
  499:         ////////////////////////////////////////////////////////////////////////////
  500:  
  501:         /// <summary>
  502:         ///
  503:         /// </summary>
  504:         public class SoftX
  505:         {
  506:             /// <summary/>
  507:             public string Id { get; set; }
  508:  
  509:             /// <summary/>
  510:             public string DomainListString { get; set; }
  511:  
  512:             /// <summary/>
  513:             public List<int> DomainList { get; set; }
  514:  
  515:             /// <summary/>
  516:             public virtual Site Site { get; set; }
  517:  
  518:             /// <summary/>
  519:             public SoftX() { }
  520:  
  521:             /// <summary/>
  522:             public string SoftXId(int siteId, int softXId)
  523:             {
  524:                 return siteId.ToString().PadLeft(2, '0') + softXId;
  525:             }
  526:         }
  527:  
  528:         ////////////////////////////////////////////////////////////////////////////
  529:  
  530:         /// <summary>
  531:         ///
  532:         /// </summary>
  533:         public class Router
  534:         {
  535:             /// <summary/>
  536:             public int Id { get; set; }
  537:  
  538:             /// <summary/>
  539:             public string Name { get; set; }
  540:  
  541:             /// <summary/>
  542:             public string Type { get; set; }
  543:  
  544:             /// <summary/>
  545:             public string DomainListString { get; set; }
  546:  
  547:             /// <summary/>
  548:             public List<int> DomainList { get; set; }
  549:  
  550:             /// <summary/>
  551:             public virtual Vendor Vendor { get; set; }
  552:  
  553:             /// <summary/>
  554:             public virtual Site Site { get; set; }
  555:  
  556:             /// <summary/>
  557:             public virtual ICollection<Oam> Oams
  558:             {
  559:                 get
  560:                 {
  561:                     return (from r in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OamList where r.Router == this select r).ToList();
  562:                 }
  563:             }
  564:  
  565:             /// <summary/>
  566:             public virtual ICollection<Odf> Odfs
  567:             {
  568:                 get
  569:                 {
  570:                     return (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OdfList where o.Router == this select o).ToList();
  571:                 }
  572:             }
  573:  
  574:             /// <summary/>
  575:             public Router() { }
  576:  
  577:             /// <summary/>
  578:             public int RouterId(int siteId, int routerId)
  579:             {
  580:                 return siteId * 100 + routerId;
  581:             }
  582:         }
  583:  
  584:         ////////////////////////////////////////////////////////////////////////////
  585:  
  586:         /// <summary>
  587:         ///
  588:         /// </summary>
  589:         public class Oam
  590:         {
  591:             /// <summary/>
  592:             public int Id { get; set; }
  593:  
  594:             /// <summary/>
  595:             public string Network { get; set; }
  596:  
  597:             /// <summary/>
  598:             public string Gateway { get; set; }
  599:  
  600:             /// <summary/>
  601:             public int Vlan { get; set; }
  602:  
  603:             /// <summary/>
  604:             public int Vpls { get; set; }
  605:  
  606:             /// <summary/>
  607:             public string FtpIp { get; set; }
  608:  
  609:             /// <summary/>
  610:             public string ConfigFile { get; set; }
  611:  
  612:             /// <summary/>
  613:             public virtual Router Router { get; set; }
  614:  
  615:             /// <summary/>
  616:             public Oam() { }
  617:  
  618:             /// <summary/>
  619:             public int OamId(int routerId, int oamId)
  620:             {
  621:                 return routerId * 100 + oamId;
  622:             }
  623:         }
  624:  
  625:         ////////////////////////////////////////////////////////////////////////////
  626:  
  627:         /// <summary>
  628:         ///
  629:         /// </summary>
  630:         public class Odf
  631:         {
  632:             /// <summary/>
  633:             public int Id { get; set; }
  634:  
  635:             /// <summary/>
  636:             public string Name { get; set; }
  637:  
  638:             /// <summary/>
  639:             public string GatewayIp { get; set; }
  640:  
  641:             /// <summary/>
  642:             public string MgcIp { get; set; }
  643:  
  644:             /// <summary/>
  645:             public virtual Vendor Vendor { get; set; }
  646:  
  647:             /// <summary/>
  648:             public virtual Router Router { get; set; }
  649:  
  650:             /// <summary/>
  651:             public virtual ICollection<Olt> Olts
  652:             {
  653:                 get
  654:                 {
  655:                     return (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList where o.Odf == this select o).ToList();
  656:                 }
  657:             }
  658:  
  659:             /// <summary/>
  660:             public Odf() { }
  661:  
  662:             /// <summary/>
  663:             public int OdfId(int routerId, int odfId)
  664:             {
  665:                 return routerId * 100 + odfId;
  666:             }
  667:         }
  668:  
  669:         ////////////////////////////////////////////////////////////////////////////
  670:  
  671:         /// <summary>
  672:         ///
  673:         /// </summary>
  674:         public class Olt
  675:         {
  676:             /// <summary/>
  677:             public int Id { get; set; }
  678:  
  679:             /// <summary/>
  680:             public string Type { get; set; }
  681:  
  682:             /// <summary/>
  683:             //public int StateId { get; set; }
  684:  
  685:             /// <summary/>
  686:             public bool IsSip { get; set; }
  687:  
  688:             /// <summary/>
  689:             public int Rack { get; set; }
  690:  
  691:             /// <summary/>
  692:             public int Sub { get; set; }
  693:  
  694:             /// <summary/>
  695:             public string GatewayIp { get; set; }
  696:  
  697:             /// <summary/>
  698:             public string MgcIp { get; set; }
  699:  
  700:             /// <summary/>
  701:             public string Name { get; set; }
  702:  
  703:             /// <summary/>
  704:             public string AmsName { get; set; }
  705:  
  706:             /// <summary/>
  707:             public string EmsName
  708:             {
  709:                 get
  710:                 {
  711:                     return this.AmsName;
  712:                 }
  713:  
  714:                 set
  715:                 {
  716:                     this.AmsName = value;
  717:                 }
  718:             }
  719:  
  720:             /// <summary/>
  721:             public int Did { get; set; }
  722:  
  723:             /// <summary/>
  724:             public Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldType FieldType { get; set; }
  725:  
  726:             /// <summary/>
  727:             public string Symbol { get; set; }
  728:  
  729:             /// <summary/>
  730:             public int NumberOfLts { get; set; }
  731:  
  732:             /// <summary/>
  733:             public int NumberOfPonsPerLt { get; set; }
  734:  
  735:             /// <summary/>
  736:             public int NumberOfPons { get; set; }
  737:  
  738:             /// <summary/>
  739:             public int NumberOfOntsInPon { get; set; }
  740:  
  741:             /// <summary/>
  742:             public int NumberOfFirstSlot { get; set; }
  743:  
  744:             /// <summary/>
  745:             public virtual Odf Odf { get; set; }
  746:  
  747:             /// <summary/>
  748:             public virtual ICollection<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.PonGroup> PonGroupList
  749:             {
  750:                 get
  751:                 {
  752:                     return (from l in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PonGroupList where l.Olt == this select l).ToList();
  753:                 }
  754:             }
  755:  
  756:             /// <summary/>
  757:             public Olt() { }
  758:  
  759:             /// <summary/>
  760:             public int OltId(int odfId, int oltId)
  761:             {
  762:                 return odfId * 100 + oltId;
  763:             }
  764:         }
  765:  
  766:         ////////////////////////////////////////////////////////////////////////////
  767:  
  768:         /// <summary>
  769:         ///
  770:         /// </summary>
  771:         public class PonGroup
  772:         {
  773:             /// <summary/>
  774:             public long Id { get; set; }
  775:  
  776:             /// <summary/>
  777:             public string Symbol { get; set; }
  778:  
  779:             /// <summary/>
  780:             public int Number { get; set; }
  781:  
  782:             /// <summary/>
  783:             public string PonListString { get; set; }
  784:  
  785:             /// <summary/>
  786:             //public string ProposedPonListString { get; set; }
  787:  
  788:             /// <summary/>
  789:             public List<int> UsedPonInPonGroupList { get; set; }
  790:  
  791:             /// <summary/>
  792:             //public List<int> UsedProposedPonInPonGroupList { get; set; }
  793:  
  794:             /// <summary/>
  795:             public string NetworkNumber { get; set; }
  796:  
  797:             /// <summary/>
  798:             public string GatewayIp { get; set; }
  799:  
  800:             /// <summary/>
  801:             public string MgcIp { get; set; }
  802:  
  803:             /// <summary/>
  804:             public virtual Olt Olt { get; set; }
  805:  
  806:             /// <summary/>
  807:             public virtual ICollection<Pon> PonList
  808:             {
  809:                 get
  810:                 {
  811:                     return (from p in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PonList where p.PonGroup == this select p).ToList();
  812:                 }
  813:             }
  814:  
  815:             /*
  816:             /// <summary/>
  817:             public bool HasNewProposedPonList
  818:             {
  819:                 get
  820:                 {
  821:                     return !string.IsNullOrEmpty(this.ProposedPonListString) && this.ProposedPonListString != this.PonListString;
  822:                 }
  823:             }
  824:             */
  825:  
  826:             /// <summary/>
  827:             public PonGroup() { }
  828:  
  829:             /// <summary/>
  830:             public long PonGroupId(int oltId, int ponGroupId)
  831:             {
  832:                 return (long)oltId * 100 + ponGroupId;
  833:             }
  834:         }
  835:  
  836:         ////////////////////////////////////////////////////////////////////////////
  837:  
  838:         /// <summary>
  839:         ///
  840:         /// </summary>
  841:         public class Pon
  842:         {
  843:             private const int FixedLengthOfId = 14;
  844:  
  845:             /// <summary/>
  846:             public string Id { get; set; }
  847:  
  848:             /// <summary/>
  849:             public int Index { get; set; }
  850:  
  851:             /// <summary/>
  852:             public int PonGroupPonIndex { get; set; }
  853:  
  854:             /// <summary/>
  855:             public int Rack { get; set; }
  856:  
  857:             /// <summary/>
  858:             public int Sub { get; set; }
  859:  
  860:             /// <summary/>
  861:             public int CardSlot { get; set; }
  862:  
  863:             /// <summary/>
  864:             public int Port { get; set; }
  865:  
  866:             /// <summary/>
  867:             public int Number { get; set; }
  868:  
  869:             /// <summary/>
  870:             //public int ProposedNumber { get; set; }
  871:  
  872:             /// <summary/>
  873:             public string Position { get; set; }
  874:  
  875:             /// <summary/>
  876:             public string Name { get; set; }
  877:  
  878:             /// <summary/>
  879:             //public string ProposedName { get; set; }
  880:  
  881:             /// <summary/>
  882:             public virtual PonGroup PonGroup { get; set; }
  883:  
  884:             /// <summary/>
  885:             public virtual ICollection<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont> OntList
  886:             {
  887:                 get
  888:                 {
  889:                     return (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList where o.Pon == this select o).ToList();
  890:                 }
  891:             }
  892:  
  893:             /// <summary/>
  894:             public string RxSxLtxPonx
  895:             {
  896:                 get
  897:                 {
  898:                     int ltNumber, ponNumber;
  899:                     string rxSxLtxPonx;
  900:  
  901:                     ltNumber = this.Number / this.PonGroup.Olt.NumberOfPonsPerLt + 1;
  902:                     ponNumber = this.Number - (ltNumber - 1) * this.PonGroup.Olt.NumberOfPonsPerLt;
  903:  
  904:                     rxSxLtxPonx = "R1.S1.LT" + ltNumber + ".PON" + ponNumber;
  905:  
  906:                     //rxSxLtxPonx = "R1.S1.LT7.PON1";
  907:  
  908:                     return rxSxLtxPonx;
  909:                 }
  910:             }
  911:  
  912:             /// <summary/>
  913:             public Pon() { }
  914:  
  915:             /// <summary/>
  916:             public string PonId(int oltId, int oltPonIndex)
  917:             {
  918:                 string id;
  919:  
  920:                 // "01" to indicate PonGroup 1. I will keep it even though it mignt not be nessessary because PON numbers are distinct
  921:                 id = oltId.ToString() + "01" + oltPonIndex.ToString().PadLeft(3, '0');
  922:  
  923:                 if (id.Length != FixedLengthOfId)
  924:                 {
  925:                     throw new ArgumentOutOfRangeException(@"PonId(): Id length is not " + FixedLengthOfId);
  926:                 }
  927:  
  928:                 return id;
  929:             }
  930:         }
  931:  
  932:         ////////////////////////////////////////////////////////////////////////////
  933:  
  934:         /// <summary>
  935:         ///
  936:         /// </summary>
  937:         public class Ont
  938:         {
  939:             /// <summary/>
  940:             public string Id { get; set; }
  941:  
  942:             /// <summary/>
  943:             public int Rack { get; set; }
  944:  
  945:             /// <summary/>
  946:             public int Sub { get; set; }
  947:  
  948:             /// <summary/>
  949:             public int CardSlot { get; set; }
  950:  
  951:             /// <summary/>
  952:             public int Port { get; set; }
  953:  
  954:             /// <summary/>
  955:             public int Number { get; set; }
  956:  
  957:             /// <summary/>
  958:             public int InternalNumber { get; set; }
  959:  
  960:             /// <summary/>
  961:             public string Position { get; set; }
  962:  
  963:             /// <summary/>
  964:             public string Ip { get; set; }
  965:  
  966:             /// <summary/>
  967:             public Ia.Ftn.Cl.Models.Business.Ims.ImsBasicService ImsBasicService { get; set; }
  968:  
  969:             /// <summary/>
  970:             public string MgcIp
  971:             {
  972:                 get
  973:                 {
  974:                     return ImsBasicService.MgcIp;
  975:                 }
  976:             }
  977:  
  978:             /// <summary/>
  979:             public string MgcSecondaryIp
  980:             {
  981:                 get
  982:                 {
  983:                     return ImsBasicService.MgcSecondaryIp;
  984:                 }
  985:             }
  986:  
  987:             /// <summary/>
  988:             public string MgcSubnetMask
  989:             {
  990:                 get
  991:                 {
  992:                     return ImsBasicService.MgcSubnetMask;
  993:                 }
  994:             }
  995:  
  996:             /// <summary/>
  997:             public int ImsService
  998:             {
  999:                 get
 1000:                 {
 1001:                     return ImsBasicService.Service;
 1002:                 }
 1003:             }
 1004:  
 1005:             /// <summary/>
 1006:             public string ImsFsdb
 1007:             {
 1008:                 get
 1009:                 {
 1010:                     return ImsBasicService.Fsdb;
 1011:                 }
 1012:             }
 1013:  
 1014:             /// <summary/>
 1015:             public string PrimarySwitch
 1016:             {
 1017:                 get
 1018:                 {
 1019:                     return ImsBasicService.PrimarySwitch;
 1020:                 }
 1021:             }
 1022:  
 1023:             /// <summary/>
 1024:             public virtual Pon Pon { get; set; }
 1025:  
 1026:             /// <summary/>
 1027:             public virtual Access Access { get; set; }
 1028:  
 1029:             /// <summary/>
 1030:             public Ont() { }
 1031:  
 1032:             ////////////////////////////////////////////////////////////////////////////
 1033:  
 1034:             /// <summary>
 1035:             ///
 1036:             /// </summary>
 1037:             public string ToSimpleTextString()
 1038:             {
 1039:                 StringBuilder sb;
 1040:                 Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor switchVendor, accessVendor;
 1041:  
 1042:                 sb = new StringBuilder();
 1043:  
 1044:                 switchVendor = this.Pon.PonGroup.Olt.Odf.Router.Vendor;
 1045:                 accessVendor = this.Pon.PonGroup.Olt.Odf.Vendor;
 1046:  
 1047:                 sb.AppendLine("SwitchVendor: " + switchVendor.Name);
 1048:                 sb.AppendLine("AccessVendor: " + accessVendor.Name);
 1049:                 sb.AppendLine("AccessName: " + ((this.Access != null) ? this.Access.Name : string.Empty));
 1050:                 sb.AppendLine("Position: " + this.Position);
 1051:                 sb.AppendLine("Ip: " + this.Ip);
 1052:                 sb.AppendLine("Site Name: " + this.Pon.PonGroup.Olt.Odf.Router.Site.Name);
 1053:                 sb.AppendLine("PrimarySwitch: " + this.PrimarySwitch);
 1054:                 sb.AppendLine("Olt Field Type: " + Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldTypeString(this.Pon.PonGroup.Olt.FieldType));
 1055:                 sb.AppendLine("Olt IsSip: " + Ia.Cl.Models.Default.YesNoText(this.Pon.PonGroup.Olt.IsSip));
 1056:                 sb.AppendLine("NetworkNumber: " + this.Pon.PonGroup.NetworkNumber);
 1057:                 sb.AppendLine("GatewayIp: " + this.Pon.PonGroup.GatewayIp);
 1058:                 sb.AppendLine("MgcIp: " + this.MgcIp);
 1059:                 sb.AppendLine("MgcSecondaryIp: " + this.MgcSecondaryIp);
 1060:                 sb.AppendLine("ImsService: " + this.ImsService);
 1061:                 sb.AppendLine("ImsFsdb: " + this.ImsFsdb);
 1062:  
 1063:                 return sb.ToString();
 1064:             }
 1065:         }
 1066:  
 1067:         ////////////////////////////////////////////////////////////////////////////
 1068:  
 1069:         /// <summary>
 1070:         ///
 1071:         /// </summary>
 1072:         public class Access
 1073:         {
 1074:             /// <summary/>
 1075:             public string Id { get; set; }
 1076:  
 1077:             /// <summary/>
 1078:             public string Name { get; set; }
 1079:  
 1080:             /// <summary/>
 1081:             //public string ProposedName { get; set; }
 1082:  
 1083:             /// <summary/>
 1084:             public int Ont { get; set; }
 1085:  
 1086:             /// <summary/>
 1087:             public int Pon { get; set; }
 1088:  
 1089:             /// <summary/>
 1090:             //public int ProposedPon { get; set; }
 1091:  
 1092:             /// <summary/>
 1093:             public string Symbol { get; set; }
 1094:  
 1095:             /// <summary/>
 1096:             public Access() { }
 1097:  
 1098:             /// <summary/>
 1099:             public string AccessId(int oltId, int ponNumber, int ontNumber)
 1100:             {
 1101:                 return Ia.Ftn.Cl.Models.Business.Access.AccessId(oltId, ponNumber, ontNumber);
 1102:             }
 1103:         }
 1104:  
 1105:         ////////////////////////////////////////////////////////////////////////////
 1106:         ////////////////////////////////////////////////////////////////////////////    
 1107:     }
 1108: }