)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
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 Optical Fiber Network (OFN) entity model.

    1: using System;
    2: using System.ComponentModel.DataAnnotations.Schema;
    3: using System.Linq;
    4: using System.Threading;
    5: using System.Threading.Tasks;
    6:  
    7: namespace Ia.Ngn.Cl.Model
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Miscellaneous Entity Framework class for Optical Fiber Network (OFN) entity model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2006-2021 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 Miscellaneous
   29:     {
   30:         /// <summary/>
   31:         public Miscellaneous() { }
   32:  
   33:         /// <summary/>
   34:         public long Id { get; set; }
   35:         /// <summary/>
   36:         public int TypeId { get; set; }
   37:         /// <summary/>
   38:         public string Name { get; set; }
   39:         /// <summary/>
   40:         public bool Flag { get; set; }
   41:         /// <summary/>
   42:         public string Value { get; set; }
   43:         /// <summary/>
   44:         public DateTime Created { get; set; }
   45:         /// <summary/>
   46:         public DateTime Updated { get; set; }
   47:         /// <summary/>
   48:         public System.Guid UserId { get; set; }
   49:  
   50:         ////////////////////////////////////////////////////////////////////////////
   51:  
   52:         /// <summary>
   53:         ///
   54:         /// </summary>
   55:         public bool Equal(Miscellaneous item)
   56:         {
   57:             // below: this will not check the Id, Created, Updated fields
   58:             bool areEqual;
   59:  
   60:             if (this.TypeId != item.TypeId) areEqual = false;
   61:             else if (this.Name != item.Name) areEqual = false;
   62:             else if (this.Value != item.Value) areEqual = false;
   63:             else areEqual = true;
   64:  
   65:             return areEqual;
   66:         }
   67:  
   68:         ////////////////////////////////////////////////////////////////////////////
   69:  
   70:         /// <summary>
   71:         ///
   72:         /// </summary>
   73:         public bool Update(Miscellaneous item)
   74:         {
   75:             // below: this will not update Id, Created
   76:             bool updated;
   77:  
   78:             updated = false;
   79:  
   80:             if (this.Flag != item.Flag) { this.Flag = item.Flag; updated = true; }
   81:             if (this.TypeId != item.TypeId) { this.TypeId = item.TypeId; updated = true; }
   82:             if (this.Name != item.Name) { this.Name = item.Name; updated = true; }
   83:             if (this.Value != item.Value) { this.Value = item.Value; updated = true; }
   84:             if (this.UserId != item.UserId) { this.UserId = item.UserId; updated = true; }
   85:  
   86:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
   87:  
   88:             return updated;
   89:         }
   90:  
   91:         ////////////////////////////////////////////////////////////////////////////
   92:         ////////////////////////////////////////////////////////////////////////////
   93:     }
   94:  
   95:     ////////////////////////////////////////////////////////////////////////////
   96:     ////////////////////////////////////////////////////////////////////////////
   97: }