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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Access

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

Access 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:  using System.Linq;
   6:   
   7:  namespace Ia.Ngn.Cl.Model
   8:  {
   9:      ////////////////////////////////////////////////////////////////////////////
  10:   
  11:      /// <summary publish="true">
  12:      /// Access Entity Framework class for Next Generation Network (NGN) entity model.
  13:      /// </summary>
  14:      /// 
  15:      /// <remarks> 
  16:      /// Copyright © 2006-2018 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  17:      ///
  18:      /// 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
  19:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  20:      ///
  21:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  22:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  23:      /// 
  24:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  25:      /// 
  26:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  27:      /// </remarks> 
  28:      public partial class Access
  29:      {
  30:          /// <summary/>
  31:          public Access() { }
  32:   
  33:          /// <summary/>
  34:          [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
  35:          public string Id { get; set; }
  36:   
  37:          /// <summary/>
  38:          public int Olt { get; set; }
  39:   
  40:          /// <summary/>
  41:          public int Pon { get; set; }
  42:   
  43:          /// <summary/>
  44:          public int Ont { get; set; }
  45:   
  46:          /// <summary/>
  47:          public string Odf { get; set; }
  48:   
  49:          /// <summary/>
  50:          public int AreaId { get; set; }
  51:   
  52:          /// <summary/>
  53:          public string Block { get; set; }
  54:   
  55:          /// <summary/>
  56:          public string Street { get; set; }
  57:   
  58:          /// <summary/>
  59:          public string PremisesOld { get; set; }
  60:   
  61:          /// <summary/>
  62:          public string PremisesNew { get; set; }
  63:   
  64:          /// <summary/>
  65:          public string Paci { get; set; }
  66:   
  67:          /// <summary/>
  68:          public string Note { get; set; }
  69:   
  70:          /// <summary/>
  71:          public DateTime Created { get; set; }
  72:   
  73:          /// <summary/>
  74:          public DateTime Updated { get; set; }
  75:   
  76:          /// <summary/>
  77:          public System.Guid UserId { get; set; }
  78:   
  79:          /// <summary/>
  80:          public virtual ICollection<Ont> Onts { get; set; }
  81:   
  82:          /// <summary/>
  83:          public virtual ICollection<Ia.Ngn.Cl.Model.Huawei.EmsOnt> EmsOnts { get; set; }
  84:   
  85:          /// <summary/>
  86:          public virtual ICollection<Ia.Ngn.Cl.Model.Huawei.EmsDev> EmsDevs { get; set; }
  87:   
  88:          /// <summary/>
  89:          [NotMapped]
  90:          public string Name
  91:          {
  92:              get
  93:              {
  94:                  return Ia.Ngn.Cl.Model.Business.Access.Name(this);
  95:              }
  96:          }
  97:   
  98:          /// <summary/>
  99:          [NotMapped]
 100:          public string Position
 101:          {
 102:              get
 103:              {
 104:                  string position;
 105:   
 106:                  position = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Pon.PonGroup.Olt.Id == this.Olt && o.Pon.Number == this.Pon && o.Number == this.Ont select o.Position).SingleOrDefault();
 107:   
 108:                  return position;
 109:              }
 110:          }
 111:   
 112:          ////////////////////////////////////////////////////////////////////////////
 113:   
 114:          /// <summary>
 115:          ///
 116:          /// </summary>
 117:          [NotMapped]
 118:          public string Address
 119:          {
 120:              get
 121:              {
 122:                  string address;
 123:   
 124:                  address = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == this.AreaId select kna.Name).SingleOrDefault();
 125:   
 126:                  address += ", block " + this.Block + ", street " + this.Street + ", old premises " + this.PremisesOld + ", new premises " + this.PremisesNew;
 127:   
 128:                  return address;
 129:              }
 130:          }
 131:   
 132:          ////////////////////////////////////////////////////////////////////////////
 133:   
 134:          /// <summary>
 135:          ///
 136:          /// </summary>
 137:          [NotMapped]
 138:          public string ArabicAddress
 139:          {
 140:              get
 141:              {
 142:                  string address;
 143:   
 144:                  address = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList 
 145:                             where kna.Id == this.AreaId 
 146:                             select kna.ArabicName).SingleOrDefault();
 147:   
 148:                  address += ", قطعة " + this.Block + ", شارع " + this.Street + ", قسيمة " + this.PremisesOld + ", منزل " + this.PremisesNew;
 149:   
 150:                  return address;
 151:              }
 152:          }
 153:   
 154:          ////////////////////////////////////////////////////////////////////////////
 155:   
 156:          /// <summary>
 157:          ///
 158:          /// </summary>
 159:          public bool Update(Access updatedAccess)
 160:          {
 161:              // below: this will not update Id, Created
 162:              bool updated;
 163:   
 164:              updated = false;
 165:   
 166:              if (this.AreaId != updatedAccess.AreaId) { this.AreaId = updatedAccess.AreaId; updated = true; }
 167:              if (this.Block != updatedAccess.Block) { this.Block = updatedAccess.Block; updated = true; }
 168:              //if (this.Name != updatedAccess.Name) { this.Name = updatedAccess.Name; updated = true; }
 169:              if (this.Odf != updatedAccess.Odf) { this.Odf = updatedAccess.Odf; updated = true; }
 170:              if (this.Olt != updatedAccess.Olt) { this.Olt = updatedAccess.Olt; updated = true; }
 171:              if (this.Ont != updatedAccess.Ont) { this.Ont = updatedAccess.Ont; updated = true; }
 172:              if (this.Pon != updatedAccess.Pon) { this.Pon = updatedAccess.Pon; updated = true; }
 173:              //if (this.Position != updatedAccess.Position) { this.Position = updatedAccess.Position; updated = true; }
 174:              if (this.PremisesOld != updatedAccess.PremisesOld) { this.PremisesOld = updatedAccess.PremisesOld; updated = true; }
 175:              if (this.PremisesNew != updatedAccess.PremisesNew) { this.PremisesNew = updatedAccess.PremisesNew; updated = true; }
 176:              if (this.Paci != updatedAccess.Paci) { this.Paci = updatedAccess.Paci; updated = true; }
 177:              if (this.Note != updatedAccess.Note) { this.Note = updatedAccess.Note; updated = true; }
 178:              if (this.Street != updatedAccess.Street) { this.Street = updatedAccess.Street; updated = true; }
 179:              if (this.UserId != updatedAccess.UserId) { this.UserId = updatedAccess.UserId; updated = true; }
 180:   
 181:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 182:   
 183:              return updated;
 184:          }
 185:   
 186:          ////////////////////////////////////////////////////////////////////////////
 187:          ////////////////////////////////////////////////////////////////////////////
 188:   
 189:          /// <summary>
 190:          ///
 191:          /// </summary>
 192:          public string ToSimpleTextString()
 193:          {
 194:              return Ia.Ngn.Cl.Model.Data.Access.ToSimpleTextString(this);
 195:          }
 196:   
 197:          ////////////////////////////////////////////////////////////////////////////
 198:          ////////////////////////////////////////////////////////////////////////////
 199:      }
 200:   
 201:      ////////////////////////////////////////////////////////////////////////////
 202:      ////////////////////////////////////////////////////////////////////////////
 203:  }