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