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

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), Internet 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:          /// <summary/>
  36:          public int StateId { get; set; }
  37:          /// <summary/>
  38:          public int FamilyTypeId { get; set; }
  39:          /// <summary/>
  40:          public string Serial { get; set; }
  41:          /// <summary/>
  42:          public string EquipmentId { get; set; }
  43:          /// <summary/>
  44:          public int VendorId { get; set; }
  45:          /// <summary/>
  46:          public string ActiveSoftware { get; set; }
  47:          /// <summary/>
  48:          public string PassiveSoftware { get; set; }
  49:          /// <summary/>
  50:          public string PlannedSoftware { get; set; }
  51:          /// <summary/>
  52:          public bool BatteryBackupAvailable { get; set; }
  53:          /// <summary/>
  54:          public string Description1 { get; set; }
  55:          /// <summary/>
  56:          public string Description2 { get; set; }
  57:          /// <summary/>
  58:          public DateTime Created { get; set; }
  59:          /// <summary/>
  60:          public DateTime Updated { get; set; }
  61:          /// <summary/>
  62:          public System.Guid UserId { get; set; }
  63:   
  64:          /// <summary/>
  65:          public virtual Access Access { get; set; }
  66:          /// <summary/>
  67:          //public virtual ICollection<OntServiceHsi> OntServiceHsis { get; set; }
  68:          /// <summary/>
  69:          public virtual ICollection<OntServiceVoip> OntServiceVoips { get; set; }
  70:          /// <summary/>
  71:          public virtual ICollection<OntOntPots> OntOntPotses { get; set; }
  72:   
  73:          ////////////////////////////////////////////////////////////////////////////
  74:   
  75:          /// <summary>
  76:          ///
  77:          /// </summary>
  78:          [NotMapped]
  79:          public string State
  80:          {
  81:              get
  82:              {
  83:                  return Ia.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(this.StateId);
  84:              }
  85:          }
  86:   
  87:          ////////////////////////////////////////////////////////////////////////////
  88:   
  89:          /// <summary>
  90:          ///
  91:          /// </summary>
  92:          [NotMapped]
  93:          public Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyType
  94:          {
  95:              get
  96:              {
  97:                  return Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyTypeFromString(this.EquipmentId);
  98:              }
  99:          }
 100:   
 101:          ////////////////////////////////////////////////////////////////////////////
 102:   
 103:          /// <summary>
 104:          ///
 105:          /// </summary>
 106:          public bool Equal(Ia.Ngn.Cl.Model.Ont b)
 107:          {
 108:              // below: this will not check the Id, Created, Updated fields
 109:              bool areEqual;
 110:   
 111:              if (this.BatteryBackupAvailable != b.BatteryBackupAvailable) areEqual = false;
 112:              else areEqual = true;
 113:   
 114:              return areEqual;
 115:          }
 116:   
 117:          ////////////////////////////////////////////////////////////////////////////
 118:   
 119:          /// <summary>
 120:          ///
 121:          /// </summary>
 122:          public bool Update(Ia.Ngn.Cl.Model.Ont updatedItem)
 123:          {
 124:              // below: this will not update Id, Created
 125:              bool updated;
 126:   
 127:              updated = false;
 128:   
 129:              if (this.StateId != updatedItem.StateId) { this.StateId = updatedItem.StateId; updated = true; }
 130:              if (this.FamilyTypeId != updatedItem.FamilyTypeId) { this.FamilyTypeId = updatedItem.FamilyTypeId; updated = true; }
 131:              if (this.Serial != updatedItem.Serial) { this.Serial = updatedItem.Serial; updated = true; }
 132:              if (this.EquipmentId != updatedItem.EquipmentId) { this.EquipmentId = updatedItem.EquipmentId; updated = true; }
 133:              if (this.VendorId != updatedItem.VendorId) { this.VendorId = updatedItem.VendorId; updated = true; }
 134:              if (this.ActiveSoftware != updatedItem.ActiveSoftware) { this.ActiveSoftware = updatedItem.ActiveSoftware; updated = true; }
 135:              if (this.PassiveSoftware != updatedItem.PassiveSoftware) { this.PassiveSoftware = updatedItem.PassiveSoftware; updated = true; }
 136:   
 137:              if (this.PlannedSoftware != updatedItem.PlannedSoftware) { this.PlannedSoftware = updatedItem.PlannedSoftware; updated = true; }
 138:              if (this.BatteryBackupAvailable != updatedItem.BatteryBackupAvailable) { this.BatteryBackupAvailable = updatedItem.BatteryBackupAvailable; updated = true; }
 139:              if (this.Description1 != updatedItem.Description1) { this.Description1 = updatedItem.Description1; updated = true; }
 140:              if (this.Description2 != updatedItem.Description2) { this.Description2 = updatedItem.Description2; updated = true; }
 141:              if (this.UserId != updatedItem.UserId) { this.UserId = updatedItem.UserId; updated = true; }
 142:              if (this.Access != updatedItem.Access) { this.Access = updatedItem.Access; updated = true; }
 143:   
 144:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 145:   
 146:              return updated;
 147:          }
 148:   
 149:          ////////////////////////////////////////////////////////////////////////////
 150:          ////////////////////////////////////////////////////////////////////////////
 151:   
 152:          /// <summary>
 153:          ///
 154:          /// </summary>
 155:          public string ToSimpleTextString()
 156:          {
 157:              return Ia.Ngn.Cl.Model.Data.Nokia.Ont.ToSimpleTextString(this);
 158:          }
 159:   
 160:          ////////////////////////////////////////////////////////////////////////////
 161:          ////////////////////////////////////////////////////////////////////////////
 162:      }
 163:   
 164:      ////////////////////////////////////////////////////////////////////////////
 165:      ////////////////////////////////////////////////////////////////////////////
 166:  }