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

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

ONT Entity Framework class for Fixed Telecommunications Network (FTN) 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.Ftn.Cl.Models
   10: {
   11:     ////////////////////////////////////////////////////////////////////////////
   12:  
   13:     /// <summary publish="true">
   14:     /// ONT Entity Framework class for Fixed Telecommunications Network (FTN) 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:     /// </remarks> 
   20:     public class Ont
   21:     {
   22:         /// <summary/>
   23:         public Ont() { }
   24:  
   25:         /// <summary/>
   26:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   27:         public string Id { get; set; }
   28:  
   29:         /// <summary/>
   30:         public int StateId { get; set; }
   31:  
   32:         /// <summary/>
   33:         public int FamilyTypeId { get; set; }
   34:  
   35:         /// <summary/>
   36:         public string Serial { get; set; }
   37:  
   38:         /// <summary/>
   39:         public string EquipmentId { get; set; }
   40:  
   41:         /// <summary/>
   42:         public int VendorId { get; set; }
   43:  
   44:         /// <summary/>
   45:         public string ActiveSoftware { get; set; }
   46:  
   47:         /// <summary/>
   48:         public string PassiveSoftware { get; set; }
   49:  
   50:         /// <summary/>
   51:         public string PlannedSoftware { get; set; }
   52:  
   53:         /// <summary/>
   54:         public bool BatteryBackupAvailable { get; set; }
   55:  
   56:         /// <summary/>
   57:         public string Description1 { get; set; }
   58:  
   59:         /// <summary/>
   60:         public string Description2 { get; set; }
   61:  
   62:         /// <summary/>
   63:         public DateTime Created { get; set; }
   64:  
   65:         /// <summary/>
   66:         public DateTime Updated { get; set; }
   67:  
   68:         /// <summary/>
   69:         [ForeignKey("Access_Id")]
   70:         public virtual Access Access { get; set; }
   71:  
   72:         /// <summary/>
   73:         //public virtual ICollection<OntServiceHsi> OntServiceHsis { get; set; }
   74:  
   75:         /// <summary/>
   76:         public virtual ICollection<OntServiceVoip> OntServiceVoips { get; set; }
   77:  
   78:         /// <summary/>
   79:         public virtual ICollection<OntOntPots> OntOntPotses { get; set; }
   80:  
   81:         /// <summary/>
   82:         public virtual ICollection<Event> Events { get; set; }
   83:  
   84:         ////////////////////////////////////////////////////////////////////////////
   85:  
   86:         /// <summary>
   87:         ///
   88:         /// </summary>
   89:         [NotMapped]
   90:         public string State
   91:         {
   92:             get
   93:             {
   94:                 return Ia.Ftn.Cl.Models.Data.Nokia.Ams.BellcoreStateFromId(this.StateId);
   95:             }
   96:         }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:  
  100:         /// <summary>
  101:         ///
  102:         /// </summary>
  103:         [NotMapped]
  104:         public Ia.Ftn.Cl.Models.Business.Nokia.Ont.EquipmentType EquipmentType
  105:         {
  106:             get
  107:             {
  108:                 Ia.Ftn.Cl.Models.Business.Nokia.Ont.EquipmentType equipmentType;
  109:  
  110:                 equipmentType = Ia.Ftn.Cl.Models.Business.Nokia.Ont.EquipmentTypeFromActiveSoftware(this.ActiveSoftware);
  111:  
  112:                 return equipmentType;
  113:             }
  114:         }
  115:  
  116:         ////////////////////////////////////////////////////////////////////////////
  117:  
  118:         /// <summary>
  119:         ///
  120:         /// </summary>
  121:         [NotMapped]
  122:         public Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType FamilyType
  123:         {
  124:             get
  125:             {
  126:                 return (Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)this.FamilyTypeId;
  127:             }
  128:         }
  129:  
  130:         ////////////////////////////////////////////////////////////////////////////
  131:  
  132:         /// <summary>
  133:         ///
  134:         /// </summary>
  135:         public bool Equal(Ia.Ftn.Cl.Models.Ont b)
  136:         {
  137:             // below: this will not check the Id, Created, Updated fields
  138:             bool areEqual;
  139:  
  140:             if (this.BatteryBackupAvailable != b.BatteryBackupAvailable) areEqual = false;
  141:             else areEqual = true;
  142:  
  143:             return areEqual;
  144:         }
  145:  
  146:         ////////////////////////////////////////////////////////////////////////////
  147:  
  148:         /// <summary>
  149:         ///
  150:         /// </summary>
  151:         public bool Update(Ia.Ftn.Cl.Models.Ont updatedItem)
  152:         {
  153:             // below: this will not update Id, Created
  154:             bool updated;
  155:  
  156:             updated = false;
  157:  
  158:             if (this.StateId != updatedItem.StateId) { this.StateId = updatedItem.StateId; updated = true; }
  159:             if (this.FamilyTypeId != updatedItem.FamilyTypeId) { this.FamilyTypeId = updatedItem.FamilyTypeId; updated = true; }
  160:             if (this.Serial != updatedItem.Serial) { this.Serial = updatedItem.Serial; updated = true; }
  161:             if (this.EquipmentId != updatedItem.EquipmentId) { this.EquipmentId = updatedItem.EquipmentId; updated = true; }
  162:             if (this.VendorId != updatedItem.VendorId) { this.VendorId = updatedItem.VendorId; updated = true; }
  163:             if (this.ActiveSoftware != updatedItem.ActiveSoftware) { this.ActiveSoftware = updatedItem.ActiveSoftware; updated = true; }
  164:             if (this.PassiveSoftware != updatedItem.PassiveSoftware) { this.PassiveSoftware = updatedItem.PassiveSoftware; updated = true; }
  165:  
  166:             if (this.PlannedSoftware != updatedItem.PlannedSoftware) { this.PlannedSoftware = updatedItem.PlannedSoftware; updated = true; }
  167:             if (this.BatteryBackupAvailable != updatedItem.BatteryBackupAvailable) { this.BatteryBackupAvailable = updatedItem.BatteryBackupAvailable; updated = true; }
  168:             if (this.Description1 != updatedItem.Description1) { this.Description1 = updatedItem.Description1; updated = true; }
  169:             if (this.Description2 != updatedItem.Description2) { this.Description2 = updatedItem.Description2; updated = true; }
  170:             if (this.Access != updatedItem.Access) { this.Access = updatedItem.Access; updated = true; }
  171:  
  172:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  173:  
  174:             return updated;
  175:         }
  176:  
  177:         ////////////////////////////////////////////////////////////////////////////
  178:         ////////////////////////////////////////////////////////////////////////////
  179:  
  180:         /// <summary>
  181:         ///
  182:         /// </summary>
  183:         public string ToSimpleTextString()
  184:         {
  185:             return Ia.Ftn.Cl.Models.Data.Nokia.Ont.ToSimpleTextString(this);
  186:         }
  187:  
  188:         ////////////////////////////////////////////////////////////////////////////
  189:         ////////////////////////////////////////////////////////////////////////////
  190:     }
  191:  
  192:     ////////////////////////////////////////////////////////////////////////////
  193:     ////////////////////////////////////////////////////////////////////////////
  194: }