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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » ServiceRequest

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

Service Request 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 Entity Framework class for Next Generation Network (NGN) entity model.
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2006-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 ServiceRequest //: ITriggerable
  28:      {
  29:          /// <summary/>
  30:          public ServiceRequest()
  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 int 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 RequestDateTime { get; set; }
  52:   
  53:          /// <summary/>
  54:          public int CustomerId { get; set; }
  55:   
  56:          /// <summary/>
  57:          public string CustomerName { get; set; }
  58:   
  59:          /// <summary/>
  60:          public int CustomerCategoryId { get; set; }
  61:   
  62:          /// <summary/>
  63:          public string CustomerAddress { get; set; }
  64:   
  65:          /// <summary/>
  66:          public int AreaId { get; set; }
  67:   
  68:          /// <summary/>
  69:          public int ServiceId { get; set; }
  70:   
  71:          /// <summary/>
  72:          public int ServiceCategoryId { get; set; }
  73:   
  74:          /// <summary/>
  75:          public double Balance { get; set; }
  76:   
  77:          /// <summary/>
  78:          public DateTime Created { get; set; }
  79:   
  80:          /// <summary/>
  81:          public DateTime Updated { get; set; }
  82:   
  83:          /// <summary/>
  84:          public System.Guid UserId { get; set; }
  85:   
  86:          /// <summary/>
  87:          [ForeignKey("ServiceRequestService_Id")]
  88:          public virtual ServiceRequestService ServiceRequestService { get; set; }
  89:   
  90:          /// <summary/>
  91:          public virtual ICollection<ServiceRequestType> ServiceRequestTypes { get; set; }
  92:   
  93:          /// <summary/>
  94:          //public virtual ICollection<ServiceRequestOnt> ServiceRequestOnts { get; set; }
  95:   
  96:          /// <summary/>
  97:          [NotMapped]
  98:          public static Queue<ServiceRequest> TriggeredInstanceQueue = new Queue<ServiceRequest>();
  99:   
 100:          ////////////////////////////////////////////////////////////////////////////
 101:   
 102:          /// <summary>
 103:          ///
 104:          /// </summary>
 105:          public bool UpdateSkipServiceRequestService(ServiceRequest updatedServiceRequest)
 106:          {
 107:              return Update(updatedServiceRequest, true);
 108:          }
 109:   
 110:          ////////////////////////////////////////////////////////////////////////////
 111:   
 112:          /// <summary>
 113:          ///
 114:          /// </summary>
 115:          public bool Update(ServiceRequest updatedServiceRequest)
 116:          {
 117:              return Update(updatedServiceRequest, false);
 118:          }
 119:   
 120:          ////////////////////////////////////////////////////////////////////////////
 121:   
 122:          /// <summary>
 123:          ///
 124:          /// </summary>
 125:          private bool Update(ServiceRequest updatedServiceRequest, bool skipServiceRequestService)
 126:          {
 127:              // below: this will not update Id, Created
 128:              bool updated;
 129:   
 130:              updated = false;
 131:   
 132:              if (this.CustomerAddress != updatedServiceRequest.CustomerAddress) { this.CustomerAddress = updatedServiceRequest.CustomerAddress; updated = true; }
 133:              if (this.AreaId != updatedServiceRequest.AreaId) { this.AreaId = updatedServiceRequest.AreaId; updated = true; }
 134:              if (this.CustomerCategoryId != updatedServiceRequest.CustomerCategoryId) { this.CustomerCategoryId = updatedServiceRequest.CustomerCategoryId; updated = true; }
 135:              if (this.CustomerId != updatedServiceRequest.CustomerId) { this.CustomerId = updatedServiceRequest.CustomerId; updated = true; }
 136:              if (this.CustomerName != updatedServiceRequest.CustomerName) { this.CustomerName = updatedServiceRequest.CustomerName; updated = true; }
 137:              if (this.Number != updatedServiceRequest.Number) { this.Number = updatedServiceRequest.Number; updated = true; }
 138:              if (this.RequestDateTime != updatedServiceRequest.RequestDateTime) { this.RequestDateTime = updatedServiceRequest.RequestDateTime; updated = true; }
 139:              if (this.Serial != updatedServiceRequest.Serial) { this.Serial = updatedServiceRequest.Serial; updated = true; }
 140:              if (this.ServiceCategoryId != updatedServiceRequest.ServiceCategoryId) { this.ServiceCategoryId = updatedServiceRequest.ServiceCategoryId; updated = true; }
 141:              if (this.ServiceId != updatedServiceRequest.ServiceId) { this.ServiceId = updatedServiceRequest.ServiceId; updated = true; }
 142:   
 143:              if (!skipServiceRequestService) if (this.ServiceRequestService != updatedServiceRequest.ServiceRequestService) { this.ServiceRequestService = updatedServiceRequest.ServiceRequestService; updated = true; }
 144:              //if (this.ServiceRequestOnts != updatedServiceRequest.ServiceRequestOnts) { this.ServiceRequestOnts = updatedServiceRequest.ServiceRequestOnts; updated = true; }
 145:              //if (this.ServiceRequestTypes != updatedServiceRequest.ServiceRequestTypes) { this.ServiceRequestTypes = updatedServiceRequest.ServiceRequestTypes; updated = true; }
 146:   
 147:              if (this.Status != updatedServiceRequest.Status) { this.Status = updatedServiceRequest.Status; updated = true; }
 148:              if (this.Balance != updatedServiceRequest.Balance) { this.Balance = updatedServiceRequest.Balance; updated = true; }
 149:   
 150:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 151:   
 152:              return updated;
 153:          }
 154:   
 155:          ////////////////////////////////////////////////////////////////////////////
 156:          ////////////////////////////////////////////////////////////////////////////
 157:   
 158:          /// <summary>
 159:          ///
 160:          /// </summary>
 161:          public string ToSimpleTextString()
 162:          {
 163:              return Ia.Ngn.Cl.Model.Data.ServiceRequest.ToSimpleTextString(this);
 164:          }
 165:   
 166:          ////////////////////////////////////////////////////////////////////////////
 167:          ////////////////////////////////////////////////////////////////////////////
 168:      }
 169:   
 170:      ////////////////////////////////////////////////////////////////////////////
 171:      ////////////////////////////////////////////////////////////////////////////
 172:  }