)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Access (Ia.Ftn.Cl.Models)

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

Access Entity Framework class for Fixed Telecommunications Network (FTN) 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: using System.Threading;
    7: using System.Threading.Tasks;
    8:  
    9: namespace Ia.Ftn.Cl.Models
   10: {
   11:     ////////////////////////////////////////////////////////////////////////////
   12:  
   13:     /// <summary publish="true">
   14:     /// Access Entity Framework class for Fixed Telecommunications Network (FTN) entity model.
   15:     /// </summary>
   16:     /// 
   17:     /// <remarks> 
   18:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   19:     /// </remarks> 
   20:     public class Access
   21:     {
   22:         /// <summary/>
   23:         public Access() { }
   24:  
   25:         /// <summary/>
   26:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   27:         public string Id { get; set; }
   28:  
   29:         /// <summary/>
   30:         public int Olt { get; set; }
   31:  
   32:         /// <summary/>
   33:         public int Pon { get; set; }
   34:  
   35:         /// <summary/>
   36:         public int Ont { get; set; }
   37:  
   38:         /// <summary/>
   39:         public string Odf { get; set; }
   40:  
   41:         /// <summary/>
   42:         public int AreaId { get; set; }
   43:  
   44:         /// <summary/>
   45:         public string Block { get; set; }
   46:  
   47:         /// <summary/>
   48:         public string Street { get; set; }
   49:  
   50:         /// <summary/>
   51:         public string PremisesOld { get; set; }
   52:  
   53:         /// <summary/>
   54:         public string PremisesNew { get; set; }
   55:  
   56:         /// <summary/>
   57:         public string Paci { get; set; }
   58:  
   59:         /// <summary/>
   60:         public string Note { get; set; }
   61:  
   62:         /// <summary/>
   63:         public DateTime Created { get; set; }
   64:  
   65:         /// <summary/>
   66:         public DateTime Updated { get; set; }
   67:  
   68:         /// <summary/>
   69:         [ForeignKey("StaffIdentityUser_Id")]
   70:         public virtual StaffIdentityUser StaffIdentityUser { get; set; }
   71:  
   72:         /// <summary/>
   73:         public virtual ICollection<Ont> Onts { get; set; }
   74:  
   75:         /// <summary/>
   76:         public virtual ICollection<Ia.Ftn.Cl.Models.Huawei.EmsOnt> EmsOnts { get; set; }
   77:  
   78:         /// <summary/>
   79:         public virtual ICollection<Ia.Ftn.Cl.Models.Huawei.EmsDev> EmsDevs { get; set; }
   80:  
   81:         /// <summary/>
   82:         [NotMapped]
   83:         public string Name
   84:         {
   85:             get
   86:             {
   87:                 return Ia.Ftn.Cl.Models.Business.Access.Name(this);
   88:             }
   89:         }
   90:  
   91:         /// <summary/>
   92:         [NotMapped]
   93:         public string Position
   94:         {
   95:             get
   96:             {
   97:                 string position;
   98:  
   99:                 position = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList
  100:                             where o.Pon.PonGroup.Olt.Id == this.Olt && o.Pon.Number == this.Pon && o.Number == this.Ont
  101:                             select o.Position).SingleOrDefault();
  102:  
  103:                 return position;
  104:             }
  105:         }
  106:  
  107:         ////////////////////////////////////////////////////////////////////////////
  108:  
  109:         /// <summary>
  110:         ///
  111:         /// </summary>
  112:         [NotMapped]
  113:         public string Address
  114:         {
  115:             get
  116:             {
  117:                 string address;
  118:  
  119:                 var kuwaitFtnArea = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaById(this.AreaId);
  120:  
  121:                 if (kuwaitFtnArea != null)
  122:                 {
  123:                     address = kuwaitFtnArea.Name + ", block " + this.Block + ", street " + this.Street + ", old premises " + this.PremisesOld + ", new premises " + this.PremisesNew;
  124:                 }
  125:                 else address = string.Empty;
  126:  
  127:                 return address;
  128:             }
  129:         }
  130:  
  131:         ////////////////////////////////////////////////////////////////////////////
  132:  
  133:         /// <summary>
  134:         ///
  135:         /// </summary>
  136:         [NotMapped]
  137:         public string ArabicAddress
  138:         {
  139:             get
  140:             {
  141:                 string address;
  142:  
  143:                 var kuwaitFtnArea = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaById(this.AreaId);
  144:  
  145:                 if (kuwaitFtnArea != null)
  146:                 {
  147:                     address = kuwaitFtnArea.ArabicName + ", قطعة " + this.Block + ", شارع " + this.Street + ", قسيمة " + this.PremisesOld + ", منزل " + this.PremisesNew;
  148:                 }
  149:                 else address = string.Empty;
  150:  
  151:                 return address;
  152:             }
  153:         }
  154:  
  155:         ////////////////////////////////////////////////////////////////////////////
  156:  
  157:         /// <summary>
  158:         ///
  159:         /// </summary>
  160:         public bool Update(Access updatedAccess)
  161:         {
  162:             // below: this will not update Id, Created
  163:             bool updated;
  164:  
  165:             updated = false;
  166:  
  167:             if (this.AreaId != updatedAccess.AreaId) { this.AreaId = updatedAccess.AreaId; updated = true; }
  168:             if (this.Block != updatedAccess.Block) { this.Block = updatedAccess.Block; updated = true; }
  169:             //if (this.Name != updatedAccess.Name) { this.Name = updatedAccess.Name; updated = true; }
  170:             if (this.Odf != updatedAccess.Odf) { this.Odf = updatedAccess.Odf; updated = true; }
  171:             if (this.Olt != updatedAccess.Olt) { this.Olt = updatedAccess.Olt; updated = true; }
  172:             if (this.Ont != updatedAccess.Ont) { this.Ont = updatedAccess.Ont; updated = true; }
  173:             if (this.Pon != updatedAccess.Pon) { this.Pon = updatedAccess.Pon; updated = true; }
  174:             //if (this.Position != updatedAccess.Position) { this.Position = updatedAccess.Position; updated = true; }
  175:             if (this.PremisesOld != updatedAccess.PremisesOld) { this.PremisesOld = updatedAccess.PremisesOld; updated = true; }
  176:             if (this.PremisesNew != updatedAccess.PremisesNew) { this.PremisesNew = updatedAccess.PremisesNew; updated = true; }
  177:             if (this.Paci != updatedAccess.Paci) { this.Paci = updatedAccess.Paci; updated = true; }
  178:             if (this.Note != updatedAccess.Note) { this.Note = updatedAccess.Note; updated = true; }
  179:             if (this.Street != updatedAccess.Street) { this.Street = updatedAccess.Street; updated = true; }
  180:             if (this.StaffIdentityUser.Id != updatedAccess.StaffIdentityUser.Id) { this.StaffIdentityUser.Id = updatedAccess.StaffIdentityUser.Id; updated = true; }
  181:  
  182:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  183:  
  184:             return updated;
  185:         }
  186:  
  187:         ////////////////////////////////////////////////////////////////////////////
  188:         ////////////////////////////////////////////////////////////////////////////
  189:  
  190:         /// <summary>
  191:         ///
  192:         /// </summary>
  193:         public string ToSimpleTextString()
  194:         {
  195:             return Ia.Ftn.Cl.Models.Data.Access.ToSimpleTextString(this);
  196:         }
  197:  
  198:         ////////////////////////////////////////////////////////////////////////////
  199:         ////////////////////////////////////////////////////////////////////////////
  200:     }
  201:  
  202:     ////////////////////////////////////////////////////////////////////////////
  203:     ////////////////////////////////////////////////////////////////////////////
  204: }