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