شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة ش.ش.و.

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » ServiceRequestHistory

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

Service Request History Entity Framework class for Optical Fiber Network (OFN) 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.Ngn.Cl.Model
  10:  {
  11:      ////////////////////////////////////////////////////////////////////////////
  12:   
  13:      /// <summary publish="true">
  14:      /// Service Request History Entity Framework class for Optical Fiber Network (OFN) 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:      ///
  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 ServiceRequestHistory
  31:      {
  32:          /// <summary/>
  33:          public ServiceRequestHistory()
  34:          {
  35:          }
  36:   
  37:          /// <summary/>
  38:          [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
  39:          public string Id { get; set; }
  40:   
  41:          /// <summary/>
  42:          public int Number { get; set; }
  43:   
  44:          /// <summary/>
  45:          public int Serial { get; set; }
  46:   
  47:          /// <summary/>
  48:          public int Status { get; set; }
  49:   
  50:          /// <summary/>
  51:          public DateTime StartDateTime { get; set; }
  52:   
  53:          /// <summary/>
  54:          public DateTime EndDateTime { get; set; }
  55:   
  56:          /// <summary/>
  57:          public DateTime ServiceDateTime { get; set; }
  58:   
  59:          /// <summary/>
  60:          public int ServiceId { get; set; }
  61:   
  62:          /// <summary/>
  63:          public int ServiceCategoryId { get; set; }
  64:   
  65:          /// <summary/>
  66:          public DateTime Created { get; set; }
  67:   
  68:          /// <summary/>
  69:          public DateTime Updated { get; set; }
  70:   
  71:          /// <summary/>
  72:          [ForeignKey("ServiceRequestService_Id")]
  73:          public virtual ServiceRequestService ServiceRequestService { get; set; }
  74:   
  75:          ////////////////////////////////////////////////////////////////////////////
  76:   
  77:          /// <summary>
  78:          ///
  79:          /// </summary>
  80:          public bool UpdateSkipServiceRequestService(ServiceRequestHistory updatedServiceRequestHistory)
  81:          {
  82:              return Update(updatedServiceRequestHistory, true);
  83:          }
  84:   
  85:          ////////////////////////////////////////////////////////////////////////////
  86:   
  87:          /// <summary>
  88:          ///
  89:          /// </summary>
  90:          public bool Update(ServiceRequestHistory updatedServiceRequestHistory)
  91:          {
  92:              return Update(updatedServiceRequestHistory, false);
  93:          }
  94:   
  95:          ////////////////////////////////////////////////////////////////////////////
  96:   
  97:          /// <summary>
  98:          ///
  99:          /// </summary>
 100:          private bool Update(ServiceRequestHistory updatedServiceRequestHistory, bool skipServiceRequestService)
 101:          {
 102:              // below: this will not update Id, Created
 103:              bool updated;
 104:   
 105:              updated = false;
 106:   
 107:              if (this.Number != updatedServiceRequestHistory.Number) { this.Number = updatedServiceRequestHistory.Number; updated = true; }
 108:              if (this.Serial != updatedServiceRequestHistory.Serial) { this.Serial = updatedServiceRequestHistory.Serial; updated = true; }
 109:              if (this.Status != updatedServiceRequestHistory.Status) { this.Status = updatedServiceRequestHistory.Status; updated = true; }
 110:              if (this.StartDateTime != updatedServiceRequestHistory.StartDateTime) { this.StartDateTime = updatedServiceRequestHistory.StartDateTime; updated = true; }
 111:              if (this.EndDateTime != updatedServiceRequestHistory.EndDateTime) { this.EndDateTime = updatedServiceRequestHistory.EndDateTime; updated = true; }
 112:   
 113:              if (this.ServiceDateTime != updatedServiceRequestHistory.ServiceDateTime) { this.ServiceDateTime = updatedServiceRequestHistory.ServiceDateTime; updated = true; }
 114:              if (this.ServiceId != updatedServiceRequestHistory.ServiceId) { this.ServiceId = updatedServiceRequestHistory.ServiceId; updated = true; }
 115:              if (this.ServiceCategoryId != updatedServiceRequestHistory.ServiceCategoryId) { this.ServiceCategoryId = updatedServiceRequestHistory.ServiceCategoryId; updated = true; }
 116:   
 117:              if (!skipServiceRequestService) if (this.ServiceRequestService != updatedServiceRequestHistory.ServiceRequestService) { this.ServiceRequestService = updatedServiceRequestHistory.ServiceRequestService; updated = true; }
 118:   
 119:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 120:   
 121:              return updated;
 122:          }
 123:   
 124:          ////////////////////////////////////////////////////////////////////////////
 125:          ////////////////////////////////////////////////////////////////////////////
 126:   
 127:          /// <summary>
 128:          ///
 129:          /// </summary>
 130:          public string ToSimpleTextString()
 131:          {
 132:              return Ia.Ngn.Cl.Model.Data.ServiceRequestHistory.ToSimpleTextString(this);
 133:          }
 134:   
 135:          ////////////////////////////////////////////////////////////////////////////
 136:          ////////////////////////////////////////////////////////////////////////////
 137:      }
 138:   
 139:      ////////////////////////////////////////////////////////////////////////////
 140:      ////////////////////////////////////////////////////////////////////////////
 141:  }