Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » ServiceRequestHsi

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), Internet 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:          /// <summary/>
  42:          public int Card { get; set; }
  43:          /// <summary/>
  44:          public int Port { get; set; }
  45:          /// <summary/>
  46:          public int Service { get; set; }
  47:          /// <summary/>
  48:          public int UpstreamBandwidthProfileId { get; set; }
  49:          /// <summary/>
  50:          public int DownstreamBandwidthProfileId { get; set; }
  51:          /// <summary/>
  52:          public int PriorityQueueProfileId { get; set; }
  53:          /// <summary/>
  54:          public int IspId { get; set; }
  55:          /// <summary/>
  56:          public virtual Ont Ont { get; set; }
  57:   
  58:          /// <summary/>
  59:          public DateTime Created { get; set; }
  60:          /// <summary/>
  61:          public DateTime Updated { get; set; }
  62:   
  63:          /// <summary/>
  64:          [NotMapped]
  65:          public static Queue<ServiceRequestHsi> TriggeredInstanceQueue = new Queue<ServiceRequestHsi>();
  66:   
  67:          ////////////////////////////////////////////////////////////////////////////
  68:   
  69:          /// <summary>
  70:          ///
  71:          /// </summary>
  72:          public void Copy(ServiceRequestHsi serviceRequestHsi)
  73:          {
  74:              this.Id = serviceRequestHsi.Id;
  75:   
  76:              this.Card = serviceRequestHsi.Card;
  77:              this.Port = serviceRequestHsi.Port;
  78:              this.Service = serviceRequestHsi.Service;
  79:              this.UpstreamBandwidthProfileId = serviceRequestHsi.UpstreamBandwidthProfileId;
  80:              this.DownstreamBandwidthProfileId = serviceRequestHsi.DownstreamBandwidthProfileId;
  81:              this.PriorityQueueProfileId = serviceRequestHsi.PriorityQueueProfileId;
  82:              this.IspId = serviceRequestHsi.IspId;
  83:              this.Ont = serviceRequestHsi.Ont;
  84:   
  85:              this.Created = serviceRequestHsi.Created;
  86:              this.Updated = serviceRequestHsi.Updated;
  87:          }
  88:   
  89:          ////////////////////////////////////////////////////////////////////////////
  90:   
  91:          /// <summary>
  92:          ///
  93:          /// </summary>
  94:          public bool Update(ServiceRequestHsi updatedServiceRequestOnt)
  95:          {
  96:              // below: this will not update Id, Created
  97:              bool updated;
  98:   
  99:              updated = false;
 100:   
 101:              if (this.Card != updatedServiceRequestOnt.Card) { this.Card = updatedServiceRequestOnt.Card; updated = true; }
 102:              if (this.Port != updatedServiceRequestOnt.Port) { this.Port = updatedServiceRequestOnt.Port; updated = true; }
 103:              if (this.Service != updatedServiceRequestOnt.Service) { this.Service = updatedServiceRequestOnt.Service; updated = true; }
 104:              if (this.UpstreamBandwidthProfileId != updatedServiceRequestOnt.UpstreamBandwidthProfileId) { this.UpstreamBandwidthProfileId = updatedServiceRequestOnt.UpstreamBandwidthProfileId; updated = true; }
 105:              if (this.DownstreamBandwidthProfileId != updatedServiceRequestOnt.DownstreamBandwidthProfileId) { this.DownstreamBandwidthProfileId = updatedServiceRequestOnt.DownstreamBandwidthProfileId; updated = true; }
 106:              if (this.PriorityQueueProfileId != updatedServiceRequestOnt.PriorityQueueProfileId) { this.PriorityQueueProfileId = updatedServiceRequestOnt.PriorityQueueProfileId; updated = true; }
 107:              if (this.IspId != updatedServiceRequestOnt.IspId) { this.IspId = updatedServiceRequestOnt.IspId; updated = true; }
 108:   
 109:              if (this.Ont != updatedServiceRequestOnt.Ont) { this.Ont = updatedServiceRequestOnt.Ont; updated = true; }
 110:   
 111:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 112:   
 113:              return updated;
 114:          }
 115:   
 116:          ////////////////////////////////////////////////////////////////////////////
 117:          ////////////////////////////////////////////////////////////////////////////
 118:      }
 119:   
 120:      ////////////////////////////////////////////////////////////////////////////
 121:      ////////////////////////////////////////////////////////////////////////////
 122:  }