شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة ش.ش.و.

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 Next Generation Network (NGN) entity model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.ComponentModel.DataAnnotations;
   4:  using System.ComponentModel.DataAnnotations.Schema;
   5:   
   6:  namespace Ia.Ngn.Cl.Model
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// ONT Entity Framework class for Next Generation Network (NGN) entity model.
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// 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
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      public partial class Ont
  28:      {
  29:          /// <summary/>
  30:          public Ont() { }
  31:   
  32:          /// <summary/>
  33:          [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
  34:          public string Id { get; set; }
  35:   
  36:          /// <summary/>
  37:          public int StateId { get; set; }
  38:   
  39:          /// <summary/>
  40:          public int FamilyTypeId { get; set; }
  41:   
  42:          /// <summary/>
  43:          public string Serial { get; set; }
  44:   
  45:          /// <summary/>
  46:          public string EquipmentId { get; set; }
  47:   
  48:          /// <summary/>
  49:          public int VendorId { get; set; }
  50:   
  51:          /// <summary/>
  52:          public string ActiveSoftware { get; set; }
  53:   
  54:          /// <summary/>
  55:          public string PassiveSoftware { get; set; }
  56:   
  57:          /// <summary/>
  58:          public string PlannedSoftware { get; set; }
  59:   
  60:          /// <summary/>
  61:          public bool BatteryBackupAvailable { get; set; }
  62:   
  63:          /// <summary/>
  64:          public string Description1 { get; set; }
  65:   
  66:          /// <summary/>
  67:          public string Description2 { get; set; }
  68:   
  69:          /// <summary/>
  70:          public DateTime Created { get; set; }
  71:   
  72:          /// <summary/>
  73:          public DateTime Updated { get; set; }
  74:   
  75:          /// <summary/>
  76:          public System.Guid UserId { 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.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(this.StateId);
 105:              }
 106:          }
 107:   
 108:          ////////////////////////////////////////////////////////////////////////////
 109:   
 110:          /// <summary>
 111:          ///
 112:          /// </summary>
 113:          [NotMapped]
 114:          public Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentType EquipmentType
 115:          {
 116:              get
 117:              {
 118:                  Ia.Ngn.Cl.Model.Business.Nokia.Ont.EquipmentType equipmentType;
 119:   
 120:                  equipmentType = Ia.Ngn.Cl.Model.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.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyType
 133:          {
 134:              get
 135:              {
 136:                  return (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)this.FamilyTypeId;
 137:              }
 138:          }
 139:   
 140:          ////////////////////////////////////////////////////////////////////////////
 141:   
 142:          /// <summary>
 143:          ///
 144:          /// </summary>
 145:          public bool Equal(Ia.Ngn.Cl.Model.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.Ngn.Cl.Model.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.UserId != updatedItem.UserId) { this.UserId = updatedItem.UserId; updated = true; }
 181:              if (this.Access != updatedItem.Access) { this.Access = updatedItem.Access; updated = true; }
 182:   
 183:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 184:   
 185:              return updated;
 186:          }
 187:   
 188:          ////////////////////////////////////////////////////////////////////////////
 189:          ////////////////////////////////////////////////////////////////////////////
 190:   
 191:          /// <summary>
 192:          ///
 193:          /// </summary>
 194:          public string ToSimpleTextString()
 195:          {
 196:              return Ia.Ngn.Cl.Model.Data.Nokia.Ont.ToSimpleTextString(this);
 197:          }
 198:   
 199:          ////////////////////////////////////////////////////////////////////////////
 200:          ////////////////////////////////////////////////////////////////////////////
 201:      }
 202:   
 203:      ////////////////////////////////////////////////////////////////////////////
 204:      ////////////////////////////////////////////////////////////////////////////
 205:  }