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

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 Next Generation Network (NGN) entity model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.ComponentModel.DataAnnotations;
   4:  using System.ComponentModel.DataAnnotations.Schema;
   5:   
   6:  namespace Ia.Ngn.Cl.Model
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// Service Request History Entity Framework class for Next Generation Network (NGN) entity model.
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2019-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// 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
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      public partial class ServiceRequestHistory //: ITriggerable
  28:      {
  29:          /// <summary/>
  30:          public ServiceRequestHistory()
  31:          {
  32:              //this.Triggers().Inserting += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
  33:              //this.Triggers().Updating += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
  34:              //this.Triggers().Deleting += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
  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:          /// <summary/>
  76:          [NotMapped]
  77:          public static Queue<ServiceRequestHistory> TriggeredInstanceQueue = new Queue<ServiceRequestHistory>();
  78:   
  79:          ////////////////////////////////////////////////////////////////////////////
  80:   
  81:          /// <summary>
  82:          ///
  83:          /// </summary>
  84:          public bool UpdateSkipServiceRequestService(ServiceRequestHistory updatedServiceRequestHistory)
  85:          {
  86:              return Update(updatedServiceRequestHistory, true);
  87:          }
  88:   
  89:          ////////////////////////////////////////////////////////////////////////////
  90:   
  91:          /// <summary>
  92:          ///
  93:          /// </summary>
  94:          public bool Update(ServiceRequestHistory updatedServiceRequestHistory)
  95:          {
  96:              return Update(updatedServiceRequestHistory, false);
  97:          }
  98:   
  99:          ////////////////////////////////////////////////////////////////////////////
 100:   
 101:          /// <summary>
 102:          ///
 103:          /// </summary>
 104:          private bool Update(ServiceRequestHistory updatedServiceRequestHistory, bool skipServiceRequestService)
 105:          {
 106:              // below: this will not update Id, Created
 107:              bool updated;
 108:   
 109:              updated = false;
 110:   
 111:              if (this.Number != updatedServiceRequestHistory.Number) { this.Number = updatedServiceRequestHistory.Number; updated = true; }
 112:              if (this.Serial != updatedServiceRequestHistory.Serial) { this.Serial = updatedServiceRequestHistory.Serial; updated = true; }
 113:              if (this.Status != updatedServiceRequestHistory.Status) { this.Status = updatedServiceRequestHistory.Status; updated = true; }
 114:              if (this.StartDateTime != updatedServiceRequestHistory.StartDateTime) { this.StartDateTime = updatedServiceRequestHistory.StartDateTime; updated = true; }
 115:              if (this.EndDateTime != updatedServiceRequestHistory.EndDateTime) { this.EndDateTime = updatedServiceRequestHistory.EndDateTime; updated = true; }
 116:   
 117:              if (this.ServiceDateTime != updatedServiceRequestHistory.ServiceDateTime) { this.ServiceDateTime = updatedServiceRequestHistory.ServiceDateTime; updated = true; }
 118:              if (this.ServiceId != updatedServiceRequestHistory.ServiceId) { this.ServiceId = updatedServiceRequestHistory.ServiceId; updated = true; }
 119:              if (this.ServiceCategoryId != updatedServiceRequestHistory.ServiceCategoryId) { this.ServiceCategoryId = updatedServiceRequestHistory.ServiceCategoryId; updated = true; }
 120:   
 121:              if (!skipServiceRequestService) if (this.ServiceRequestService != updatedServiceRequestHistory.ServiceRequestService) { this.ServiceRequestService = updatedServiceRequestHistory.ServiceRequestService; updated = true; }
 122:   
 123:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 124:   
 125:              return updated;
 126:          }
 127:   
 128:          ////////////////////////////////////////////////////////////////////////////
 129:          ////////////////////////////////////////////////////////////////////////////
 130:   
 131:          /// <summary>
 132:          ///
 133:          /// </summary>
 134:          public string ToSimpleTextString()
 135:          {
 136:              return Ia.Ngn.Cl.Model.Data.ServiceRequestHistory.ToSimpleTextString(this);
 137:          }
 138:   
 139:          ////////////////////////////////////////////////////////////////////////////
 140:          ////////////////////////////////////////////////////////////////////////////
 141:      }
 142:   
 143:      ////////////////////////////////////////////////////////////////////////////
 144:      ////////////////////////////////////////////////////////////////////////////
 145:  }