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

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

Service Request Ont 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 Ont 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 ServiceRequestOnt : ITriggerable
  29:      {
  30:          /// <summary/>
  31:          public ServiceRequestOnt()
  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 Pon { get; set; }
  43:          /// <summary/>
  44:          public int Ont { get; set; }
  45:          /// <summary/>
  46:          public string AreaSymbol { get; set; }
  47:          /// <summary/>
  48:          public string Block { get; set; }
  49:          /// <summary/>
  50:          public string Street { get; set; }
  51:          /// <summary/>
  52:          public string PremisesOld { get; set; }
  53:          /// <summary/>
  54:          public string PremisesNew { get; set; }
  55:          /// <summary/>
  56:          public string Paci { get; set; }
  57:          /// <summary/>
  58:          public int PossibleNumberOfTd { get; set; }
  59:          /// <summary/>
  60:          public int PossibleNumberOfEthernet { get; set; }
  61:   
  62:          /// <summary/>
  63:          public DateTime Created { get; set; }
  64:          /// <summary/>
  65:          public DateTime Updated { get; set; }
  66:   
  67:          /// <summary/>
  68:          public virtual Access Access { get; set; }
  69:   
  70:          /// <summary/>
  71:          [NotMapped]
  72:          public static Queue<ServiceRequestOnt> TriggeredInstanceQueue = new Queue<ServiceRequestOnt>();
  73:   
  74:          /// <summary/>
  75:          [NotMapped]
  76:          public string Name
  77:          {
  78:              get
  79:              {
  80:                  string s;
  81:   
  82:                  s = this.AreaSymbol + "." + this.Pon + "." + this.Ont;
  83:   
  84:                  return s;
  85:              }
  86:          }
  87:   
  88:          ////////////////////////////////////////////////////////////////////////////
  89:   
  90:          /// <summary>
  91:          ///
  92:          /// </summary>
  93:          public void Copy(ServiceRequestOnt serviceRequestOnt)
  94:          {
  95:              this.Access = serviceRequestOnt.Access;
  96:              this.Id = serviceRequestOnt.Id;
  97:              this.Created = serviceRequestOnt.Created;
  98:              this.Updated = serviceRequestOnt.Updated;
  99:   
 100:              this.Pon = serviceRequestOnt.Pon;
 101:              this.Ont = serviceRequestOnt.Ont;
 102:              this.AreaSymbol = serviceRequestOnt.AreaSymbol;
 103:              this.Block = serviceRequestOnt.Block;
 104:              this.Street = serviceRequestOnt.Street;
 105:              this.PremisesOld = serviceRequestOnt.PremisesOld;
 106:              this.PremisesNew = serviceRequestOnt.PremisesNew;
 107:              this.Paci = serviceRequestOnt.Paci;
 108:              this.PossibleNumberOfTd = serviceRequestOnt.PossibleNumberOfTd;
 109:              this.PossibleNumberOfEthernet = serviceRequestOnt.PossibleNumberOfEthernet;
 110:          }
 111:   
 112:          ////////////////////////////////////////////////////////////////////////////
 113:   
 114:          /// <summary>
 115:          ///
 116:          /// </summary>
 117:          public bool Update(ServiceRequestOnt updatedServiceRequestOnt)
 118:          {
 119:              // below: this will not update Id, Created
 120:              bool updated;
 121:   
 122:              updated = false;
 123:   
 124:              if (this.Access != updatedServiceRequestOnt.Access) { this.Access = updatedServiceRequestOnt.Access; updated = true; }
 125:   
 126:              if (this.Pon != updatedServiceRequestOnt.Pon) { this.Pon = updatedServiceRequestOnt.Pon; updated = true; }
 127:              if (this.Ont != updatedServiceRequestOnt.Ont) { this.Ont = updatedServiceRequestOnt.Ont; updated = true; }
 128:              if (this.AreaSymbol != updatedServiceRequestOnt.AreaSymbol) { this.AreaSymbol = updatedServiceRequestOnt.AreaSymbol; updated = true; }
 129:              if (this.Block != updatedServiceRequestOnt.Block) { this.Block = updatedServiceRequestOnt.Block; updated = true; }
 130:              if (this.Street != updatedServiceRequestOnt.Street) { this.Street = updatedServiceRequestOnt.Street; updated = true; }
 131:              if (this.PremisesOld != updatedServiceRequestOnt.PremisesOld) { this.PremisesOld = updatedServiceRequestOnt.PremisesOld; updated = true; }
 132:              if (this.PremisesNew != updatedServiceRequestOnt.PremisesNew) { this.PremisesNew = updatedServiceRequestOnt.PremisesNew; updated = true; }
 133:              if (this.Paci != updatedServiceRequestOnt.Paci) { this.Paci = updatedServiceRequestOnt.Paci; updated = true; }
 134:              if (this.PossibleNumberOfTd != updatedServiceRequestOnt.PossibleNumberOfTd) { this.PossibleNumberOfTd = updatedServiceRequestOnt.PossibleNumberOfTd; updated = true; }
 135:              if (this.PossibleNumberOfEthernet != updatedServiceRequestOnt.PossibleNumberOfEthernet) { this.PossibleNumberOfEthernet = updatedServiceRequestOnt.PossibleNumberOfEthernet; updated = true; }
 136:   
 137:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
 138:   
 139:              return updated;
 140:          }
 141:   
 142:          ////////////////////////////////////////////////////////////////////////////
 143:          ////////////////////////////////////////////////////////////////////////////
 144:      }
 145:   
 146:      ////////////////////////////////////////////////////////////////////////////
 147:      ////////////////////////////////////////////////////////////////////////////
 148:  }