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

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

Miscellaneous Entity Framework class for Next Generation Network (NGN) entity model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.Security;
   6:  using System.ComponentModel.DataAnnotations;
   7:  using System.ComponentModel.DataAnnotations.Schema;
   8:  using System.Text.RegularExpressions;
   9:   
  10:  namespace Ia.Ngn.Cl.Model
  11:  {
  12:      ////////////////////////////////////////////////////////////////////////////
  13:   
  14:      /// <summary publish="true">
  15:      /// Miscellaneous Entity Framework class for Next Generation Network (NGN) entity model.
  16:      /// </summary>
  17:      /// 
  18:      /// <remarks> 
  19:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  20:      ///
  21:      /// 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
  22:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  23:      ///
  24:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  25:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  26:      /// 
  27:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  28:      /// 
  29:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  30:      /// </remarks> 
  31:      public partial class Miscellaneous
  32:      {
  33:          /// <summary/>
  34:          public Miscellaneous() { }
  35:   
  36:          /// <summary/>
  37:          public long Id { get; set; }
  38:          /// <summary/>
  39:          public int TypeId { get; set; }
  40:          /// <summary/>
  41:          public string Name { get; set; }
  42:          /// <summary/>
  43:          public bool Flag { get; set; }
  44:          /// <summary/>
  45:          public string Value { get; set; }
  46:          /// <summary/>
  47:          public DateTime Created { get; set; }
  48:          /// <summary/>
  49:          public DateTime Updated { get; set; }
  50:          /// <summary/>
  51:          public System.Guid UserId { get; set; }
  52:   
  53:          ////////////////////////////////////////////////////////////////////////////
  54:   
  55:          /// <summary>
  56:          ///
  57:          /// </summary>
  58:          public bool Equal(Miscellaneous item)
  59:          {
  60:              // below: this will not check the Id, Created, Updated fields
  61:              bool areEqual;
  62:   
  63:              if (this.TypeId != item.TypeId) areEqual = false;
  64:              else if (this.Name != item.Name) areEqual = false;
  65:              else if (this.Value != item.Value) areEqual = false;
  66:              else areEqual = true;
  67:   
  68:              return areEqual;
  69:          }
  70:   
  71:          ////////////////////////////////////////////////////////////////////////////
  72:   
  73:          /// <summary>
  74:          ///
  75:          /// </summary>
  76:          public bool Update(Miscellaneous item)
  77:          {
  78:              // below: this will not update Id, Created
  79:              bool updated;
  80:   
  81:              updated = false;
  82:   
  83:              if (this.Flag != item.Flag) { this.Flag = item.Flag; updated = true; }
  84:              if (this.TypeId != item.TypeId) { this.TypeId = item.TypeId; updated = true; }
  85:              if (this.Name != item.Name) { this.Name = item.Name; updated = true; }
  86:              if (this.Value != item.Value) { this.Value = item.Value; updated = true; }
  87:              if (this.UserId != item.UserId) { this.UserId = item.UserId; updated = true; }
  88:   
  89:              if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  90:   
  91:              return updated;
  92:          }
  93:   
  94:          ////////////////////////////////////////////////////////////////////////////
  95:          ////////////////////////////////////////////////////////////////////////////
  96:      }
  97:   
  98:      ////////////////////////////////////////////////////////////////////////////
  99:      ////////////////////////////////////////////////////////////////////////////
 100:  }