)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation Links

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

Service Request Hsi 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: using EntityFramework.Triggers;
    6:  
    7: namespace Ia.Ngn.Cl.Model
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Service Request Hsi Entity Framework class for Next Generation Network (NGN) entity model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     ///
   18:     /// 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
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     public class ServiceRequestHsi : ITriggerable
   29:     {
   30:         /// <summary/>
   31:         public ServiceRequestHsi()
   32:         {
   33:             this.Triggers().Inserting += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
   34:             this.Triggers().Updating += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
   35:             this.Triggers().Deleting += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
   36:         }
   37:  
   38:         /// <summary/>
   39:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   40:         public string Id { get; set; }
   41:  
   42:         /// <summary/>
   43:         public int Card { get; set; }
   44:  
   45:         /// <summary/>
   46:         public int Port { get; set; }
   47:  
   48:         /// <summary/>
   49:         public int Service { get; set; }
   50:  
   51:         /// <summary/>
   52:         public int UpstreamBandwidthProfileId { get; set; }
   53:  
   54:         /// <summary/>
   55:         public int DownstreamBandwidthProfileId { get; set; }
   56:  
   57:         /// <summary/>
   58:         public int PriorityQueueProfileId { get; set; }
   59:  
   60:         /// <summary/>
   61:         public int IspId { get; set; }
   62:  
   63:         /// <summary/>
   64:         public virtual Ont Ont { get; set; }
   65:  
   66:         /// <summary/>
   67:         public DateTime Created { get; set; }
   68:  
   69:         /// <summary/>
   70:         public DateTime Updated { get; set; }
   71:  
   72:         /// <summary/>
   73:         [NotMapped]
   74:         public static Queue<ServiceRequestHsi> TriggeredInstanceQueue = new Queue<ServiceRequestHsi>();
   75:  
   76:         ////////////////////////////////////////////////////////////////////////////
   77:  
   78:         /// <summary>
   79:         ///
   80:         /// </summary>
   81:         public void Copy(ServiceRequestHsi serviceRequestHsi)
   82:         {
   83:             this.Id = serviceRequestHsi.Id;
   84:  
   85:             this.Card = serviceRequestHsi.Card;
   86:             this.Port = serviceRequestHsi.Port;
   87:             this.Service = serviceRequestHsi.Service;
   88:             this.UpstreamBandwidthProfileId = serviceRequestHsi.UpstreamBandwidthProfileId;
   89:             this.DownstreamBandwidthProfileId = serviceRequestHsi.DownstreamBandwidthProfileId;
   90:             this.PriorityQueueProfileId = serviceRequestHsi.PriorityQueueProfileId;
   91:             this.IspId = serviceRequestHsi.IspId;
   92:             this.Ont = serviceRequestHsi.Ont;
   93:  
   94:             this.Created = serviceRequestHsi.Created;
   95:             this.Updated = serviceRequestHsi.Updated;
   96:         }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:  
  100:         /// <summary>
  101:         ///
  102:         /// </summary>
  103:         public bool Update(ServiceRequestHsi updatedServiceRequestOnt)
  104:         {
  105:             // below: this will not update Id, Created
  106:             bool updated;
  107:  
  108:             updated = false;
  109:  
  110:             if (this.Card != updatedServiceRequestOnt.Card) { this.Card = updatedServiceRequestOnt.Card; updated = true; }
  111:             if (this.Port != updatedServiceRequestOnt.Port) { this.Port = updatedServiceRequestOnt.Port; updated = true; }
  112:             if (this.Service != updatedServiceRequestOnt.Service) { this.Service = updatedServiceRequestOnt.Service; updated = true; }
  113:             if (this.UpstreamBandwidthProfileId != updatedServiceRequestOnt.UpstreamBandwidthProfileId) { this.UpstreamBandwidthProfileId = updatedServiceRequestOnt.UpstreamBandwidthProfileId; updated = true; }
  114:             if (this.DownstreamBandwidthProfileId != updatedServiceRequestOnt.DownstreamBandwidthProfileId) { this.DownstreamBandwidthProfileId = updatedServiceRequestOnt.DownstreamBandwidthProfileId; updated = true; }
  115:             if (this.PriorityQueueProfileId != updatedServiceRequestOnt.PriorityQueueProfileId) { this.PriorityQueueProfileId = updatedServiceRequestOnt.PriorityQueueProfileId; updated = true; }
  116:             if (this.IspId != updatedServiceRequestOnt.IspId) { this.IspId = updatedServiceRequestOnt.IspId; updated = true; }
  117:  
  118:             if (this.Ont != updatedServiceRequestOnt.Ont) { this.Ont = updatedServiceRequestOnt.Ont; updated = true; }
  119:  
  120:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  121:  
  122:             return updated;
  123:         }
  124:  
  125:         ////////////////////////////////////////////////////////////////////////////
  126:         ////////////////////////////////////////////////////////////////////////////
  127:     }
  128:  
  129:     ////////////////////////////////////////////////////////////////////////////
  130:     ////////////////////////////////////////////////////////////////////////////
  131: }