)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation LinksHome » Code Library » OntOntPots

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

ONT-ONTPOTS support class for Optical Fiber Network (OFN) 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.Ngn.Cl.Model.Data.Nokia
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// ONT-ONTPOTS support class for Optical Fiber Network (OFN) 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:     ///
   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 OntOntPots
   29:     {
   30:         /// <summary/>
   31:         public OntOntPots() { }
   32:  
   33:         ////////////////////////////////////////////////////////////////////////////
   34:  
   35:         /// <summary>
   36:         ///
   37:         /// </summary>
   38:         public static List<string> IdList()
   39:         {
   40:             var list = new List<string>();
   41:  
   42:             using (var db = new Ia.Ngn.Cl.Model.Ngn())
   43:             {
   44:                 list = (from s in db.OntOntPots
   45:                         select s.Id).ToList();
   46:             }
   47:  
   48:             list.Sort();
   49:  
   50:             return list;
   51:         }
   52:  
   53:         ////////////////////////////////////////////////////////////////////////////
   54:  
   55:         /// <summary>
   56:         ///
   57:         /// </summary>
   58:         public static List<string> OntOntPotsNddIdForNonNullAccessList()
   59:         {
   60:             int card, port;
   61:             Match match;
   62:             Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType familyType;
   63:             Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
   64:  
   65:             var idToFamilyTypeIdOfNonNullAccessDictionary = Ia.Ngn.Cl.Model.Data.Nokia.Ont.IdToFamilyTypeIdOfNonNullAccessDictionary();
   66:  
   67:             var ontIdToOntDictionary = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntIdToOntDictionary;
   68:  
   69:             var list = new List<string>(ontIdToOntDictionary.Count * 4);
   70:  
   71:             foreach (KeyValuePair<string, int> ont in idToFamilyTypeIdOfNonNullAccessDictionary)
   72:             {
   73:                 familyType = (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)ont.Value;
   74:  
   75:                 if (ontIdToOntDictionary.ContainsKey(ont.Key))
   76:                 {
   77:                     nddOnt = ontIdToOntDictionary[ont.Key];
   78:  
   79:                     foreach (string ontPotsCardPort in Ia.Ngn.Cl.Model.Business.Nokia.Ont.PossiblePotsCardPortConfigurationForOntFamilyTypeList(familyType))
   80:                     {
   81:                         match = Regex.Match(ontPotsCardPort, @"(\d+)-(\d+)");
   82:  
   83:                         if (match.Success)
   84:                         {
   85:                             card = int.Parse(match.Groups[1].Value);
   86:                             port = int.Parse(match.Groups[2].Value);
   87:  
   88:                             var ontOntPotsId = Ia.Ngn.Cl.Model.Business.Nokia.OntOntPots.OntOntPotsId(ont.Key, card, port);
   89:  
   90:                             list.Add(ontOntPotsId);
   91:                         }
   92:                         else
   93:                         {
   94:                             throw new ArgumentOutOfRangeException(@"Match did not succeed. ontPostsCardPort: " + ontPotsCardPort);
   95:                         }
   96:                     }
   97:                 }
   98:             }
   99:  
  100:             list.Sort();
  101:  
  102:             return list;
  103:         }
  104:  
  105:         /*
  106:         ////////////////////////////////////////////////////////////////////////////
  107: 
  108:         /// <summary>
  109:         ///
  110:         /// </summary>
  111:         public static List<Ia.Ngn.Cl.Model.OntOntPots> ReadListBySerial(string serial)
  112:         {
  113:             List<Ia.Ngn.Cl.Model.OntOntPots> list;
  114: 
  115:             using (var db = new Ia.Ngn.Cl.Model.Ngn())
  116:             {
  117:                 list = (from q in db.Onts where q.Serial == serial select q).ToList();
  118:             }
  119: 
  120:             return list;
  121:         }
  122:          */
  123:  
  124:         ////////////////////////////////////////////////////////////////////////////
  125:  
  126:         /// <summary>
  127:         ///
  128:         /// </summary>
  129:         public static Dictionary<string, string> IdToOntIdDictionary
  130:         {
  131:             get
  132:             {
  133:                 Dictionary<string, string> dictionary;
  134:  
  135:                 using (var db = new Ia.Ngn.Cl.Model.Ngn())
  136:                 {
  137:                     dictionary = (from s in db.OntOntPots select new { s.Id, OntId = s.Ont.Id }).ToDictionary(u => u.Id, u => u.OntId);
  138:                 }
  139:  
  140:                 return dictionary.ToDictionary(u => u.Key, u => u.Value);
  141:             }
  142:         }
  143:  
  144:         ////////////////////////////////////////////////////////////////////////////
  145:         ////////////////////////////////////////////////////////////////////////////
  146:  
  147:         /// <summary>
  148:         ///
  149:         /// </summary>
  150:         public static string ToSimpleTextString(Ia.Ngn.Cl.Model.OntOntPots ontOntPots)
  151:         {
  152:             StringBuilder sb;
  153:  
  154:             sb = new StringBuilder();
  155:  
  156:             //sb.AppendLine("Vendor: " + Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia.Name);
  157:             sb.AppendLine("State: " + ontOntPots.State);
  158:             sb.AppendLine("Card: " + ontOntPots.Card);
  159:             sb.AppendLine("Port: " + ontOntPots.Port);
  160:             sb.AppendLine("Termination: " + ontOntPots.Termination);
  161:             //sb.AppendLine("Tn: " + ontOntPots.Tn);
  162:             //sb.AppendLine("Svlan: " + ontOntPots.Svlan);
  163:             //sb.AppendLine("VoipClientIp: " + ontOntPots.VoipClientIp);
  164:             sb.AppendLine("Customer: " + ontOntPots.Customer);
  165:  
  166:             return sb.ToString();
  167:         }
  168:  
  169:         ////////////////////////////////////////////////////////////////////////////
  170:         ////////////////////////////////////////////////////////////////////////////
  171:     }
  172:  
  173:     ////////////////////////////////////////////////////////////////////////////
  174:     ////////////////////////////////////////////////////////////////////////////
  175: }