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

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

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

    1: using Microsoft.EntityFrameworkCore.Metadata.Internal;
    2: using System;
    3: using System.Collections.Generic;
    4: using System.ComponentModel.DataAnnotations;
    5: using System.ComponentModel.DataAnnotations.Schema;
    6: using System.Linq;
    7: using System.Runtime.Serialization;
    8: using System.Threading;
    9: using System.Threading.Tasks;
   10:  
   11: namespace Ia.Ftn.Cl.Models
   12: {
   13:     ////////////////////////////////////////////////////////////////////////////
   14:  
   15:     /// <summary publish="true">
   16:     /// Service Request Entity Framework class for Fixed Telecommunications Network (FTN) entity model.
   17:     /// </summary>
   18:     /// 
   19:     /// <remarks> 
   20:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   21:     /// </remarks> 
   22:     [DataContract(IsReference = true, Namespace = "kw.com.ia.ftn.api", Name = "ServiceRequest")]
   23:     public class ServiceRequest
   24:     {
   25:         /// <summary/>
   26:         public ServiceRequest()
   27:         {
   28:         }
   29:  
   30:         /// <summary/>
   31:         [DataMember]
   32:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   33:         public int Id { get; set; }
   34:  
   35:         /// <summary/>
   36:         [DataMember]
   37:         public int Number { get; set; }
   38:  
   39:         /// <summary/>
   40:         [DataMember]
   41:         public int Serial { get; set; }
   42:  
   43:         /// <summary/>
   44:         [DataMember]
   45:         public int Status { get; set; }
   46:  
   47:         /// <summary/>
   48:         [DataMember]
   49:         public DateTime RequestDateTime { get; set; }
   50:  
   51:         /// <summary/>
   52:         [DataMember]
   53:         public int CustomerId { get; set; }
   54:  
   55:         /// <summary/>
   56:         [DataMember]
   57:         public string CustomerName { get; set; }
   58:  
   59:         /// <summary/>
   60:         [DataMember]
   61:         public int CustomerCategoryId { get; set; }
   62:  
   63:         /// <summary/>
   64:         [DataMember]
   65:         public string CustomerAddress { get; set; }
   66:  
   67:         /// <summary/>
   68:         [DataMember]
   69:         public int AreaId { get; set; }
   70:  
   71:         /// <summary/>
   72:         [DataMember]
   73:         public int ServiceId { get; set; }
   74:  
   75:         /// <summary/>
   76:         [DataMember]
   77:         public int ServiceCategoryId { get; set; }
   78:  
   79:         /// <summary/>
   80:         [DataMember]
   81:         public double Balance { get; set; }
   82:  
   83:         /// <summary/>
   84:         [DataMember]
   85:         public DateTime Created { get; set; }
   86:  
   87:         /// <summary/>
   88:         [DataMember]
   89:         public DateTime Updated { get; set; }
   90:  
   91:         /// <summary/>
   92:         [ForeignKey("ServiceRequestService_Id")]
   93:         public virtual ServiceRequestService ServiceRequestService { get; set; }
   94:  
   95:         /// <summary/>
   96:         public virtual ICollection<ServiceRequestType> ServiceRequestTypes { get; set; }
   97:  
   98:         /// <summary/>
   99:         //public virtual ICollection<ServiceRequestOnt> ServiceRequestOnts { get; set; }
  100:  
  101:         ////////////////////////////////////////////////////////////////////////////
  102:  
  103:         /// <summary>
  104:         ///
  105:         /// </summary>
  106:         public bool UpdateSkipServiceRequestServiceAndCheckIfOnlyBalanceWasUpdated(ServiceRequest updatedServiceRequest, out bool onlyBalanceWasUpdated)
  107:         {
  108:             return Update(updatedServiceRequest, true, out onlyBalanceWasUpdated);
  109:         }
  110:  
  111:         ////////////////////////////////////////////////////////////////////////////
  112:  
  113:         /// <summary>
  114:         ///
  115:         /// </summary>
  116:         public bool UpdateSkipServiceRequestService(ServiceRequest updatedServiceRequest)
  117:         {
  118:             return Update(updatedServiceRequest, true, out _);
  119:         }
  120:  
  121:         ////////////////////////////////////////////////////////////////////////////
  122:  
  123:         /// <summary>
  124:         ///
  125:         /// </summary>
  126:         public bool Update(ServiceRequest updatedServiceRequest)
  127:         {
  128:             return Update(updatedServiceRequest, false, out _);
  129:         }
  130:  
  131:         ////////////////////////////////////////////////////////////////////////////
  132:  
  133:         /// <summary>
  134:         ///
  135:         /// </summary>
  136:         private bool Update(ServiceRequest updatedServiceRequest, bool skipServiceRequestService, out bool onlyBalanceWasUpdated)
  137:         {
  138:             // below: this will not update Id, Created
  139:             bool updated, balanceWasUpdated;
  140:  
  141:             updated = false;
  142:             balanceWasUpdated = false;
  143:  
  144:             if (this.CustomerAddress != updatedServiceRequest.CustomerAddress) { this.CustomerAddress = updatedServiceRequest.CustomerAddress; updated = true; }
  145:             if (this.AreaId != updatedServiceRequest.AreaId) { this.AreaId = updatedServiceRequest.AreaId; updated = true; }
  146:             if (this.CustomerCategoryId != updatedServiceRequest.CustomerCategoryId) { this.CustomerCategoryId = updatedServiceRequest.CustomerCategoryId; updated = true; }
  147:             if (this.CustomerId != updatedServiceRequest.CustomerId) { this.CustomerId = updatedServiceRequest.CustomerId; updated = true; }
  148:             if (this.CustomerName != updatedServiceRequest.CustomerName) { this.CustomerName = updatedServiceRequest.CustomerName; updated = true; }
  149:             if (this.Number != updatedServiceRequest.Number) { this.Number = updatedServiceRequest.Number; updated = true; }
  150:             if (this.RequestDateTime != updatedServiceRequest.RequestDateTime) { this.RequestDateTime = updatedServiceRequest.RequestDateTime; updated = true; }
  151:             if (this.Serial != updatedServiceRequest.Serial) { this.Serial = updatedServiceRequest.Serial; updated = true; }
  152:             if (this.ServiceCategoryId != updatedServiceRequest.ServiceCategoryId) { this.ServiceCategoryId = updatedServiceRequest.ServiceCategoryId; updated = true; }
  153:             if (this.ServiceId != updatedServiceRequest.ServiceId) { this.ServiceId = updatedServiceRequest.ServiceId; updated = true; }
  154:  
  155:             if (!skipServiceRequestService) if (this.ServiceRequestService != updatedServiceRequest.ServiceRequestService) { this.ServiceRequestService = updatedServiceRequest.ServiceRequestService; updated = true; }
  156:             //if (this.ServiceRequestOnts != updatedServiceRequest.ServiceRequestOnts) { this.ServiceRequestOnts = updatedServiceRequest.ServiceRequestOnts; updated = true; }
  157:             //if (this.ServiceRequestTypes != updatedServiceRequest.ServiceRequestTypes) { this.ServiceRequestTypes = updatedServiceRequest.ServiceRequestTypes; updated = true; }
  158:  
  159:             if (this.Status != updatedServiceRequest.Status) { this.Status = updatedServiceRequest.Status; updated = true; }
  160:             if (this.Balance != updatedServiceRequest.Balance) { this.Balance = updatedServiceRequest.Balance; balanceWasUpdated = true; }
  161:  
  162:             if (updated || balanceWasUpdated) this.Updated = DateTime.UtcNow.AddHours(3);
  163:  
  164:             onlyBalanceWasUpdated = balanceWasUpdated && !updated;
  165:  
  166:             return updated;
  167:         }
  168:  
  169:         ////////////////////////////////////////////////////////////////////////////
  170:         ////////////////////////////////////////////////////////////////////////////
  171:  
  172:         /// <summary>
  173:         ///
  174:         /// </summary>
  175:         public string ToSimpleTextString()
  176:         {
  177:             return Ia.Ftn.Cl.Models.Data.ServiceRequest.ToSimpleTextString(this);
  178:         }
  179:  
  180:         ////////////////////////////////////////////////////////////////////////////
  181:         ////////////////////////////////////////////////////////////////////////////
  182:     }
  183:  
  184:     ////////////////////////////////////////////////////////////////////////////
  185:     ////////////////////////////////////////////////////////////////////////////
  186: }