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

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

ONT Entity Framework class for Optical Fiber Network (OFN) entity model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.ComponentModel.DataAnnotations;
    4: using System.ComponentModel.DataAnnotations.Schema;
    5: using System.Linq;
    6: using System.Threading;
    7: using System.Threading.Tasks;
    8:  
    9: namespace Ia.Ngn.Cl.Model
   10: {
   11:     ////////////////////////////////////////////////////////////////////////////
   12:  
   13:     /// <summary publish="true">
   14:     /// ONT Entity Framework class for Optical Fiber Network (OFN) entity model.
   15:     /// </summary>
   16:     /// 
   17:     /// <remarks> 
   18:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   19:     ///
   20:     /// 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
   21:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   22:     ///
   23:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   24:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   25:     /// 
   26:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   27:     /// 
   28:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   29:     /// </remarks> 
   30:     public class Ont
   31:     {
   32:         /// <summary/>
   33:         public Ont() { }
   34:  
   35:         /// <summary/>
   36:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   37:         public string Id { get; set; }
   38:  
   39:         /// <summary/>
   40:         public int StateId { get; set; }
   41:  
   42:         /// <summary/>
   43:         public int FamilyTypeId { get; set; }
   44:  
   45:         /// <summary/>
   46:         public string Serial { get; set; }
   47:  
   48:         /// <summary/>
   49:         public string EquipmentId { get; set; }
   50:  
   51:         /// <summary/>
   52:         public int VendorId { get; set; }
   53:  
   54:         /// <summary/>
   55:         public string ActiveSoftware { get; set; }
   56:  
   57:         /// <summary/>
   58:         public string PassiveSoftware { get; set; }
   59:  
   60:         /// <summary/>
   61:         public string PlannedSoftware { get; set; }
   62:  
   63:         /// <summary/>
   64:         public bool BatteryBackupAvailable { get; set; }
   65:  
   66:         /// <summary/>
   67:         public string Description1 { get; set; }
   68:  
   69:         /// <summary/>
   70:         public string Description2 { get; set; }
   71:  
   72:         /// <summary/>
   73:         public DateTime Created { get; set; }
   74:  
   75:         /// <summary/>
   76:         public DateTime Updated { get; set; }
   77:  
   78:         /// <summary/>
   79:         public System.Guid UserId { get; set; }
   80:  
   81:         /// <summary/>
   82:         [ForeignKey("Access_Id")]
   83:         public virtual Access Access { get; set; }
   84:  
   85:         /// <summary/>
   86:         //public virtual ICollection<OntServiceHsi> OntServiceHsis { get; set; }
   87:  
   88:         /// <summary/>
   89:         public virtual ICollection<OntServiceVoip> OntServiceVoips { get; set; }
   90:  
   91:         /// <summary/>
   92:         public virtual ICollection<OntOntPots> OntOntPotses { get; set; }
   93:  
   94:         /// <summary/>
   95:         public virtual ICollection<Event> Events { get; set; }
   96:  
   97:         ////////////////////////////////////////////////////////////////////////////
   98:  
   99:         /// <summary>
  100:         ///
  101:         /// </summary>
  102:         [NotMapped]
  103:         public string State
  104:         {
  105:             get
  106:             {
  107:                 return Ia.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(this.StateId);
  108:             }
  109:         }
  110:  
  111:         ////////////////////////////////////////////////////////////////////////////
  112:  
  113:         /// <summary>
  114:         ///
  115:         /// </summary>
  116:         [NotMapped]
  117:         public Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentType EquipmentType
  118:         {
  119:             get
  120:             {
  121:                 Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentType equipmentType;
  122:  
  123:                 equipmentType = Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentTypeFromActiveSoftware(this.ActiveSoftware);
  124:  
  125:                 return equipmentType;
  126:             }
  127:         }
  128:  
  129:         ////////////////////////////////////////////////////////////////////////////
  130:  
  131:         /// <summary>
  132:         ///
  133:         /// </summary>
  134:         [NotMapped]
  135:         public Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyType
  136:         {
  137:             get
  138:             {
  139:                 return (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)this.FamilyTypeId;
  140:             }
  141:         }
  142:  
  143:         ////////////////////////////////////////////////////////////////////////////
  144:  
  145:         /// <summary>
  146:         ///
  147:         /// </summary>
  148:         public bool Equal(Ia.Ngn.Cl.Model.Ont b)
  149:         {
  150:             // below: this will not check the Id, Created, Updated fields
  151:             bool areEqual;
  152:  
  153:             if (this.BatteryBackupAvailable != b.BatteryBackupAvailable) areEqual = false;
  154:             else areEqual = true;
  155:  
  156:             return areEqual;
  157:         }
  158:  
  159:         ////////////////////////////////////////////////////////////////////////////
  160:  
  161:         /// <summary>
  162:         ///
  163:         /// </summary>
  164:         public bool Update(Ia.Ngn.Cl.Model.Ont updatedItem)
  165:         {
  166:             // below: this will not update Id, Created
  167:             bool updated;
  168:  
  169:             updated = false;
  170:  
  171:             if (this.StateId != updatedItem.StateId) { this.StateId = updatedItem.StateId; updated = true; }
  172:             if (this.FamilyTypeId != updatedItem.FamilyTypeId) { this.FamilyTypeId = updatedItem.FamilyTypeId; updated = true; }
  173:             if (this.Serial != updatedItem.Serial) { this.Serial = updatedItem.Serial; updated = true; }
  174:             if (this.EquipmentId != updatedItem.EquipmentId) { this.EquipmentId = updatedItem.EquipmentId; updated = true; }
  175:             if (this.VendorId != updatedItem.VendorId) { this.VendorId = updatedItem.VendorId; updated = true; }
  176:             if (this.ActiveSoftware != updatedItem.ActiveSoftware) { this.ActiveSoftware = updatedItem.ActiveSoftware; updated = true; }
  177:             if (this.PassiveSoftware != updatedItem.PassiveSoftware) { this.PassiveSoftware = updatedItem.PassiveSoftware; updated = true; }
  178:  
  179:             if (this.PlannedSoftware != updatedItem.PlannedSoftware) { this.PlannedSoftware = updatedItem.PlannedSoftware; updated = true; }
  180:             if (this.BatteryBackupAvailable != updatedItem.BatteryBackupAvailable) { this.BatteryBackupAvailable = updatedItem.BatteryBackupAvailable; updated = true; }
  181:             if (this.Description1 != updatedItem.Description1) { this.Description1 = updatedItem.Description1; updated = true; }
  182:             if (this.Description2 != updatedItem.Description2) { this.Description2 = updatedItem.Description2; updated = true; }
  183:             if (this.UserId != updatedItem.UserId) { this.UserId = updatedItem.UserId; updated = true; }
  184:             if (this.Access != updatedItem.Access) { this.Access = updatedItem.Access; updated = true; }
  185:  
  186:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  187:  
  188:             return updated;
  189:         }
  190:  
  191:         ////////////////////////////////////////////////////////////////////////////
  192:         ////////////////////////////////////////////////////////////////////////////
  193:  
  194:         /// <summary>
  195:         ///
  196:         /// </summary>
  197:         public string ToSimpleTextString()
  198:         {
  199:             return Ia.Ngn.Cl.Model.Data.Nokia.Ont.ToSimpleTextString(this);
  200:         }
  201:  
  202:         ////////////////////////////////////////////////////////////////////////////
  203:         ////////////////////////////////////////////////////////////////////////////
  204:     }
  205:  
  206:     ////////////////////////////////////////////////////////////////////////////
  207:     ////////////////////////////////////////////////////////////////////////////
  208: }