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

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

Service Request History 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:     /// Service Request History Entity Framework class for Fixed Telecommunications Network (FTN) entity model.
   15:     /// </summary>
   16:     /// 
   17:     /// <remarks> 
   18:     /// Copyright © 2019-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   19:     /// </remarks> 
   20:     public class ServiceRequestHistory
   21:     {
   22:         /// <summary/>
   23:         public ServiceRequestHistory()
   24:         {
   25:         }
   26:  
   27:         /// <summary/>
   28:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   29:         public string Id { get; set; }
   30:  
   31:         /// <summary/>
   32:         public int Number { get; set; }
   33:  
   34:         /// <summary/>
   35:         public int Serial { get; set; }
   36:  
   37:         /// <summary/>
   38:         public int Status { get; set; }
   39:  
   40:         /// <summary/>
   41:         public DateTime StartDateTime { get; set; }
   42:  
   43:         /// <summary/>
   44:         public DateTime EndDateTime { get; set; }
   45:  
   46:         /// <summary/>
   47:         public DateTime ServiceDateTime { get; set; }
   48:  
   49:         /// <summary/>
   50:         public int ServiceId { get; set; }
   51:  
   52:         /// <summary/>
   53:         public int ServiceCategoryId { get; set; }
   54:  
   55:         /// <summary/>
   56:         public DateTime Created { get; set; }
   57:  
   58:         /// <summary/>
   59:         public DateTime Updated { get; set; }
   60:  
   61:         /// <summary/>
   62:         [ForeignKey("ServiceRequestService_Id")]
   63:         public virtual ServiceRequestService ServiceRequestService { get; set; }
   64:  
   65:         ////////////////////////////////////////////////////////////////////////////
   66:  
   67:         /// <summary>
   68:         ///
   69:         /// </summary>
   70:         public bool UpdateSkipServiceRequestService(ServiceRequestHistory updatedServiceRequestHistory)
   71:         {
   72:             return Update(updatedServiceRequestHistory, true);
   73:         }
   74:  
   75:         ////////////////////////////////////////////////////////////////////////////
   76:  
   77:         /// <summary>
   78:         ///
   79:         /// </summary>
   80:         public bool Update(ServiceRequestHistory updatedServiceRequestHistory)
   81:         {
   82:             return Update(updatedServiceRequestHistory, false);
   83:         }
   84:  
   85:         ////////////////////////////////////////////////////////////////////////////
   86:  
   87:         /// <summary>
   88:         ///
   89:         /// </summary>
   90:         private bool Update(ServiceRequestHistory updatedServiceRequestHistory, bool skipServiceRequestService)
   91:         {
   92:             // below: this will not update Id, Created
   93:             bool updated;
   94:  
   95:             updated = false;
   96:  
   97:             if (this.Number != updatedServiceRequestHistory.Number) { this.Number = updatedServiceRequestHistory.Number; updated = true; }
   98:             if (this.Serial != updatedServiceRequestHistory.Serial) { this.Serial = updatedServiceRequestHistory.Serial; updated = true; }
   99:             if (this.Status != updatedServiceRequestHistory.Status) { this.Status = updatedServiceRequestHistory.Status; updated = true; }
  100:             if (this.StartDateTime != updatedServiceRequestHistory.StartDateTime) { this.StartDateTime = updatedServiceRequestHistory.StartDateTime; updated = true; }
  101:             if (this.EndDateTime != updatedServiceRequestHistory.EndDateTime) { this.EndDateTime = updatedServiceRequestHistory.EndDateTime; updated = true; }
  102:  
  103:             if (this.ServiceDateTime != updatedServiceRequestHistory.ServiceDateTime) { this.ServiceDateTime = updatedServiceRequestHistory.ServiceDateTime; updated = true; }
  104:             if (this.ServiceId != updatedServiceRequestHistory.ServiceId) { this.ServiceId = updatedServiceRequestHistory.ServiceId; updated = true; }
  105:             if (this.ServiceCategoryId != updatedServiceRequestHistory.ServiceCategoryId) { this.ServiceCategoryId = updatedServiceRequestHistory.ServiceCategoryId; updated = true; }
  106:  
  107:             if (!skipServiceRequestService) if (this.ServiceRequestService != updatedServiceRequestHistory.ServiceRequestService) { this.ServiceRequestService = updatedServiceRequestHistory.ServiceRequestService; updated = true; }
  108:  
  109:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  110:  
  111:             return updated;
  112:         }
  113:  
  114:         ////////////////////////////////////////////////////////////////////////////
  115:         ////////////////////////////////////////////////////////////////////////////
  116:  
  117:         /// <summary>
  118:         ///
  119:         /// </summary>
  120:         public string ToSimpleTextString()
  121:         {
  122:             return Ia.Ftn.Cl.Models.Data.ServiceRequestHistory.ToSimpleTextString(this);
  123:         }
  124:  
  125:         ////////////////////////////////////////////////////////////////////////////
  126:         ////////////////////////////////////////////////////////////////////////////
  127:     }
  128:  
  129:     ////////////////////////////////////////////////////////////////////////////
  130:     ////////////////////////////////////////////////////////////////////////////
  131: }