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

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

ONT-ONTPOTS support class for Fixed Telecommunications Network (FTN) Nokia data model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4: using System.Text;
    5: using System.Text.RegularExpressions;
    6:  
    7: namespace Ia.Ftn.Cl.Models.Data.Nokia
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// ONT-ONTPOTS support class for Fixed Telecommunications Network (FTN) Nokia data model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     /// </remarks> 
   18:     public class OntOntPots
   19:     {
   20:         /// <summary/>
   21:         public OntOntPots() { }
   22:  
   23:         ////////////////////////////////////////////////////////////////////////////
   24:  
   25:         /// <summary>
   26:         ///
   27:         /// </summary>
   28:         public static List<string> IdList()
   29:         {
   30:             var list = new List<string>();
   31:  
   32:             using (var db = new Ia.Ftn.Cl.Db())
   33:             {
   34:                 list = (from s in db.OntOntPots
   35:                         select s.Id).ToList();
   36:             }
   37:  
   38:             list.Sort();
   39:  
   40:             return list;
   41:         }
   42:  
   43:         ////////////////////////////////////////////////////////////////////////////
   44:  
   45:         /// <summary>
   46:         ///
   47:         /// </summary>
   48:         public static List<string> OntOntPotsNddIdForNonNullAccessList()
   49:         {
   50:             int card, port;
   51:             Match match;
   52:             Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType familyType;
   53:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
   54:  
   55:             var idToFamilyTypeIdOfNonNullAccessDictionary = Ia.Ftn.Cl.Models.Data.Nokia.Ont.IdToFamilyTypeIdOfNonNullAccessDictionary();
   56:  
   57:             var ontIdToOntDictionary = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntIdToOntDictionary;
   58:  
   59:             var list = new List<string>(ontIdToOntDictionary.Count * 4);
   60:  
   61:             foreach (KeyValuePair<string, int> ont in idToFamilyTypeIdOfNonNullAccessDictionary)
   62:             {
   63:                 familyType = (Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)ont.Value;
   64:  
   65:                 if (ontIdToOntDictionary.ContainsKey(ont.Key))
   66:                 {
   67:                     nddOnt = ontIdToOntDictionary[ont.Key];
   68:  
   69:                     foreach (string ontPotsCardPort in Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossiblePotsCardPortConfigurationForOntFamilyTypeList(familyType))
   70:                     {
   71:                         match = Regex.Match(ontPotsCardPort, @"(\d+)-(\d+)");
   72:  
   73:                         if (match.Success)
   74:                         {
   75:                             card = int.Parse(match.Groups[1].Value);
   76:                             port = int.Parse(match.Groups[2].Value);
   77:  
   78:                             var ontOntPotsId = Ia.Ftn.Cl.Models.Business.Nokia.OntOntPots.OntOntPotsId(ont.Key, card, port);
   79:  
   80:                             list.Add(ontOntPotsId);
   81:                         }
   82:                         else
   83:                         {
   84:                             throw new ArgumentOutOfRangeException(@"Match did not succeed. ontPostsCardPort: " + ontPotsCardPort);
   85:                         }
   86:                     }
   87:                 }
   88:             }
   89:  
   90:             list.Sort();
   91:  
   92:             return list;
   93:         }
   94:  
   95:         /*
   96:         ////////////////////////////////////////////////////////////////////////////
   97: 
   98:         /// <summary>
   99:         ///
  100:         /// </summary>
  101:         public static List<Ia.Ftn.Cl.Model.OntOntPots> ReadListBySerial(string serial)
  102:         {
  103:             List<Ia.Ftn.Cl.Model.OntOntPots> list;
  104: 
  105:             using (var db = new Ia.Ftn.Cl.Model.Ftn())
  106:             {
  107:                 list = (from q in db.Onts where q.Serial == serial select q).ToList();
  108:             }
  109: 
  110:             return list;
  111:         }
  112:          */
  113:  
  114:         ////////////////////////////////////////////////////////////////////////////
  115:  
  116:         /// <summary>
  117:         ///
  118:         /// </summary>
  119:         public static Dictionary<string, string> IdToOntIdDictionary
  120:         {
  121:             get
  122:             {
  123:                 Dictionary<string, string> dictionary;
  124:  
  125:                 using (var db = new Ia.Ftn.Cl.Db())
  126:                 {
  127:                     dictionary = (from s in db.OntOntPots select new { s.Id, OntId = s.Ont.Id }).ToDictionary(u => u.Id, u => u.OntId);
  128:                 }
  129:  
  130:                 return dictionary.ToDictionary(u => u.Key, u => u.Value);
  131:             }
  132:         }
  133:  
  134:         ////////////////////////////////////////////////////////////////////////////
  135:         ////////////////////////////////////////////////////////////////////////////
  136:  
  137:         /// <summary>
  138:         ///
  139:         /// </summary>
  140:         public static string ToSimpleTextString(Ia.Ftn.Cl.Models.OntOntPots ontOntPots)
  141:         {
  142:             StringBuilder sb;
  143:  
  144:             sb = new StringBuilder();
  145:  
  146:             //sb.AppendLine("Vendor: " + Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia.Name);
  147:             sb.AppendLine("State: " + ontOntPots.State);
  148:             sb.AppendLine("Card: " + ontOntPots.Card);
  149:             sb.AppendLine("Port: " + ontOntPots.Port);
  150:             sb.AppendLine("Termination: " + ontOntPots.Termination);
  151:             //sb.AppendLine("Tn: " + ontOntPots.Tn);
  152:             //sb.AppendLine("Svlan: " + ontOntPots.Svlan);
  153:             //sb.AppendLine("VoipClientIp: " + ontOntPots.VoipClientIp);
  154:             sb.AppendLine("Customer: " + ontOntPots.Customer);
  155:  
  156:             return sb.ToString();
  157:         }
  158:  
  159:         ////////////////////////////////////////////////////////////////////////////
  160:         ////////////////////////////////////////////////////////////////////////////
  161:     }
  162:  
  163:     ////////////////////////////////////////////////////////////////////////////
  164:     ////////////////////////////////////////////////////////////////////////////
  165: }