)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
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:     ///
   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:         [ForeignKey("Access_Id")]
   80:         public virtual Access Access { get; set; }
   81:  
   82:         /// <summary/>
   83:         //public virtual ICollection<OntServiceHsi> OntServiceHsis { get; set; }
   84:  
   85:         /// <summary/>
   86:         public virtual ICollection<OntServiceVoip> OntServiceVoips { get; set; }
   87:  
   88:         /// <summary/>
   89:         public virtual ICollection<OntOntPots> OntOntPotses { get; set; }
   90:  
   91:         /// <summary/>
   92:         public virtual ICollection<Event> Events { get; set; }
   93:  
   94:         ////////////////////////////////////////////////////////////////////////////
   95:  
   96:         /// <summary>
   97:         ///
   98:         /// </summary>
   99:         [NotMapped]
  100:         public string State
  101:         {
  102:             get
  103:             {
  104:                 return Ia.Ftn.Cl.Models.Data.Nokia.Ams.BellcoreStateFromId(this.StateId);
  105:             }
  106:         }
  107:  
  108:         ////////////////////////////////////////////////////////////////////////////
  109:  
  110:         /// <summary>
  111:         ///
  112:         /// </summary>
  113:         [NotMapped]
  114:         public Ia.Ftn.Cl.Models.Business.Nokia.Ont.EquipmentType EquipmentType
  115:         {
  116:             get
  117:             {
  118:                 Ia.Ftn.Cl.Models.Business.Nokia.Ont.EquipmentType equipmentType;
  119:  
  120:                 equipmentType = Ia.Ftn.Cl.Models.Business.Nokia.Ont.EquipmentTypeFromActiveSoftware(this.ActiveSoftware);
  121:  
  122:                 return equipmentType;
  123:             }
  124:         }
  125:  
  126:         ////////////////////////////////////////////////////////////////////////////
  127:  
  128:         /// <summary>
  129:         ///
  130:         /// </summary>
  131:         [NotMapped]
  132:         public Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType FamilyType
  133:         {
  134:             get
  135:             {
  136:                 return (Ia.Ftn.Cl.Models.Business.Nokia.Ont.FamilyType)this.FamilyTypeId;
  137:             }
  138:         }
  139:  
  140:         ////////////////////////////////////////////////////////////////////////////
  141:  
  142:         /// <summary>
  143:         ///
  144:         /// </summary>
  145:         public bool Equal(Ia.Ftn.Cl.Models.Ont b)
  146:         {
  147:             // below: this will not check the Id, Created, Updated fields
  148:             bool areEqual;
  149:  
  150:             if (this.BatteryBackupAvailable != b.BatteryBackupAvailable) areEqual = false;
  151:             else areEqual = true;
  152:  
  153:             return areEqual;
  154:         }
  155:  
  156:         ////////////////////////////////////////////////////////////////////////////
  157:  
  158:         /// <summary>
  159:         ///
  160:         /// </summary>
  161:         public bool Update(Ia.Ftn.Cl.Models.Ont updatedItem)
  162:         {
  163:             // below: this will not update Id, Created
  164:             bool updated;
  165:  
  166:             updated = false;
  167:  
  168:             if (this.StateId != updatedItem.StateId) { this.StateId = updatedItem.StateId; updated = true; }
  169:             if (this.FamilyTypeId != updatedItem.FamilyTypeId) { this.FamilyTypeId = updatedItem.FamilyTypeId; updated = true; }
  170:             if (this.Serial != updatedItem.Serial) { this.Serial = updatedItem.Serial; updated = true; }
  171:             if (this.EquipmentId != updatedItem.EquipmentId) { this.EquipmentId = updatedItem.EquipmentId; updated = true; }
  172:             if (this.VendorId != updatedItem.VendorId) { this.VendorId = updatedItem.VendorId; updated = true; }
  173:             if (this.ActiveSoftware != updatedItem.ActiveSoftware) { this.ActiveSoftware = updatedItem.ActiveSoftware; updated = true; }
  174:             if (this.PassiveSoftware != updatedItem.PassiveSoftware) { this.PassiveSoftware = updatedItem.PassiveSoftware; updated = true; }
  175:  
  176:             if (this.PlannedSoftware != updatedItem.PlannedSoftware) { this.PlannedSoftware = updatedItem.PlannedSoftware; updated = true; }
  177:             if (this.BatteryBackupAvailable != updatedItem.BatteryBackupAvailable) { this.BatteryBackupAvailable = updatedItem.BatteryBackupAvailable; updated = true; }
  178:             if (this.Description1 != updatedItem.Description1) { this.Description1 = updatedItem.Description1; updated = true; }
  179:             if (this.Description2 != updatedItem.Description2) { this.Description2 = updatedItem.Description2; updated = true; }
  180:             if (this.Access != updatedItem.Access) { this.Access = updatedItem.Access; updated = true; }
  181:  
  182:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  183:  
  184:             return updated;
  185:         }
  186:  
  187:         ////////////////////////////////////////////////////////////////////////////
  188:         ////////////////////////////////////////////////////////////////////////////
  189:  
  190:         /// <summary>
  191:         ///
  192:         /// </summary>
  193:         public string ToSimpleTextString()
  194:         {
  195:             return Ia.Ftn.Cl.Models.Data.Nokia.Ont.ToSimpleTextString(this);
  196:         }
  197:  
  198:         ////////////////////////////////////////////////////////////////////////////
  199:         ////////////////////////////////////////////////////////////////////////////
  200:     }
  201:  
  202:     ////////////////////////////////////////////////////////////////////////////
  203:     ////////////////////////////////////////////////////////////////////////////
  204: }