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

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), Internet 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:          /// <summary/>
  40:          public int Pon { get; set; }
  41:          /// <summary/>
  42:          public int Ont { get; set; }
  43:          /// <summary/>
  44:          public string Odf { get; set; }
  45:          /// <summary/>
  46:          public int AreaId { get; set; }
  47:          /// <summary/>
  48:          public string Block { get; set; }
  49:          /// <summary/>
  50:          public string Street { get; set; }
  51:          /// <summary/>
  52:          public string PremisesOld { get; set; }
  53:          /// <summary/>
  54:          public string PremisesNew { get; set; }
  55:          /// <summary/>
  56:          public string Paci { get; set; }
  57:          /// <summary/>
  58:          public string Note { get; set; }
  59:          /// <summary/>
  60:          public DateTime Created { get; set; }
  61:          /// <summary/>
  62:          public DateTime Updated { get; set; }
  63:          /// <summary/>
  64:          public System.Guid UserId { get; set; }
  65:   
  66:          /// <summary/>
  67:          public virtual ICollection<Ont> Onts { get; set; }
  68:   
  69:          /// <summary/>
  70:          public virtual ICollection<Ia.Ngn.Cl.Model.Huawei.EmsOnt> EmsOnts { get; set; }
  71:   
  72:          /// <summary/>
  73:          [NotMapped]
  74:          public string Name
  75:          {
  76:              get
  77:              {
  78:                  return Ia.Ngn.Cl.Model.Business.Access.Name(this);
  79:              }
  80:          }
  81:   
  82:          /// <summary/>
  83:          [NotMapped]
  84:          public string Position
  85:          {
  86:              get
  87:              {
  88:                  string position;
  89:   
  90:                  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();
  91:   
  92:                  return position;
  93:              }
  94:          }
  95:   
  96:          /// <summary/>
  97:          [NotMapped]
  98:          public string Address
  99:          {
 100:              get
 101:              {
 102:                  string address;
 103:   
 104:                  address = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == this.AreaId select kna.Name).SingleOrDefault();
 105:   
 106:                  address += ", block " + this.Block + ", street " + this.Street + ", old premises " + this.PremisesOld + ", new premises " + this.PremisesNew;
 107:   
 108:                  return address;
 109:              }
 110:          }
 111:   
 112:          ////////////////////////////////////////////////////////////////////////////
 113:   
 114:          /// <summary>
 115:          ///
 116:          /// </summary>
 117:          public bool Update(Access updatedAccess)
 118:          {
 119:              // below: this will not update Id, Created
 120:              bool updated;
 121:   
 122:              updated = false;
 123:   
 124:              if (this.AreaId != updatedAccess.AreaId) { this.AreaId = updatedAccess.AreaId; updated = true; }
 125:              if (this.Block != updatedAccess.Block) { this.Block = updatedAccess.Block; updated = true; }
 126:              //if (this.Name != updatedAccess.Name) { this.Name = updatedAccess.Name; updated = true; }
 127:              if (this.Odf != updatedAccess.Odf) { this.Odf = updatedAccess.Odf; updated = true; }
 128:              if (this.Olt != updatedAccess.Olt) { this.Olt = updatedAccess.Olt; updated = true; }
 129:              if (this.Ont != updatedAccess.Ont) { this.Ont = updatedAccess.Ont; updated = true; }
 130:              if (this.Pon != updatedAccess.Pon) { this.Pon = updatedAccess.Pon; updated = true; }
 131:              //if (this.Position != updatedAccess.Position) { this.Position = updatedAccess.Position; updated = true; }
 132:              if (this.PremisesOld != updatedAccess.PremisesOld) { this.PremisesOld = updatedAccess.PremisesOld; updated = true; }
 133:              if (this.PremisesNew != updatedAccess.PremisesNew) { this.PremisesNew = updatedAccess.PremisesNew; updated = true; }
 134:              if (this.Paci != updatedAccess.Paci) { this.Paci = updatedAccess.Paci; updated = true; }
 135:              if (this.Note != updatedAccess.Note) { this.Note = updatedAccess.Note; updated = true; }
 136:              if (this.Street != updatedAccess.Street) { this.Street = updatedAccess.Street; updated = true; }
 137:              if (this.UserId != updatedAccess.UserId) { this.UserId = updatedAccess.UserId; updated = true; }
 138:   
 139:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 140:   
 141:              return updated;
 142:          }
 143:   
 144:          ////////////////////////////////////////////////////////////////////////////
 145:          ////////////////////////////////////////////////////////////////////////////
 146:   
 147:          /// <summary>
 148:          ///
 149:          /// </summary>
 150:          public string ToSimpleTextString()
 151:          {
 152:              return Ia.Ngn.Cl.Model.Data.Access.ToSimpleTextString(this);
 153:          }
 154:   
 155:          ////////////////////////////////////////////////////////////////////////////
 156:          ////////////////////////////////////////////////////////////////////////////
 157:      }
 158:   
 159:      ////////////////////////////////////////////////////////////////////////////
 160:      ////////////////////////////////////////////////////////////////////////////
 161:  }