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

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

Miscellaneous Entity Framework class for Fixed Telecommunications Network (FTN) entity model.

    1: using System;
    2: using System.ComponentModel.DataAnnotations.Schema;
    3: using System.Linq;
    4: using System.Threading;
    5: using System.Threading.Tasks;
    6:  
    7: namespace Ia.Ftn.Cl.Models
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Miscellaneous Entity Framework class for Fixed Telecommunications Network (FTN) entity model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     /// </remarks> 
   18:     public class Miscellaneous
   19:     {
   20:         /// <summary/>
   21:         public Miscellaneous() { }
   22:  
   23:         /// <summary/>
   24:         public long Id { get; set; }
   25:  
   26:         /// <summary/>
   27:         public int TypeId { get; set; }
   28:  
   29:         /// <summary/>
   30:         public string Name { get; set; }
   31:  
   32:         /// <summary/>
   33:         public bool Flag { get; set; }
   34:  
   35:         /// <summary/>
   36:         public string Value { get; set; }
   37:  
   38:         /// <summary/>
   39:         public DateTime Created { get; set; }
   40:  
   41:         /// <summary/>
   42:         public DateTime Updated { get; set; }
   43:  
   44:         /// <summary/>
   45:         [ForeignKey("StaffIdentityUser_Id")]
   46:         public virtual StaffIdentityUser StaffIdentityUser { get; set; }
   47:  
   48:         ////////////////////////////////////////////////////////////////////////////
   49:  
   50:         /// <summary>
   51:         ///
   52:         /// </summary>
   53:         public bool Equal(Miscellaneous item)
   54:         {
   55:             // below: this will not check the Id, Created, Updated fields
   56:             bool areEqual;
   57:  
   58:             if (this.TypeId != item.TypeId) areEqual = false;
   59:             else if (this.Name != item.Name) areEqual = false;
   60:             else if (this.Value != item.Value) areEqual = false;
   61:             else areEqual = true;
   62:  
   63:             return areEqual;
   64:         }
   65:  
   66:         ////////////////////////////////////////////////////////////////////////////
   67:  
   68:         /// <summary>
   69:         ///
   70:         /// </summary>
   71:         public bool Update(Miscellaneous item)
   72:         {
   73:             // below: this will not update Id, Created
   74:             bool updated;
   75:  
   76:             updated = false;
   77:  
   78:             if (this.Flag != item.Flag) { this.Flag = item.Flag; updated = true; }
   79:             if (this.TypeId != item.TypeId) { this.TypeId = item.TypeId; updated = true; }
   80:             if (this.Name != item.Name) { this.Name = item.Name; updated = true; }
   81:             if (this.Value != item.Value) { this.Value = item.Value; updated = true; }
   82:             if (this.StaffIdentityUser.Id != item.StaffIdentityUser.Id) { this.StaffIdentityUser.Id = item.StaffIdentityUser.Id; updated = true; }
   83:  
   84:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
   85:  
   86:             return updated;
   87:         }
   88:  
   89:         ////////////////////////////////////////////////////////////////////////////
   90:         ////////////////////////////////////////////////////////////////////////////
   91:     }
   92:  
   93:     ////////////////////////////////////////////////////////////////////////////
   94:     ////////////////////////////////////////////////////////////////////////////
   95: }