)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Inventory (Ia.Cl.Models.Nfc)

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

Inventory NFC Near-Field Communication (NFC) Support Entity functions

    1: using System;
    2: using System.Collections.Generic;
    3: using System.ComponentModel.DataAnnotations;
    4: using System.ComponentModel.DataAnnotations.Schema;
    5:  
    6: namespace Ia.Cl.Models.Nfc
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     /// Inventory NFC Near-Field Communication (NFC) Support Entity functions
   12:     /// </summary>
   13:     /// <remarks> 
   14:     /// Copyright © 2020-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   15:     ///
   16:     /// 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
   17:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   18:     ///
   19:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   20:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   21:     /// 
   22:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   23:     /// 
   24:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   25:     /// </remarks> 
   26:     public partial class Inventory
   27:     {
   28:         ////////////////////////////////////////////////////////////////////////////
   29:  
   30:         /// <summary>
   31:         ///
   32:         /// </summary>
   33:         public Inventory() { }
   34:  
   35:         /// <summary/>
   36:         [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
   37:         public string Id { get; set; }
   38:  
   39:         /// <summary/>
   40:         public int ProjectId { get; set; }
   41:  
   42:         /// <summary/>
   43:         public int TypeId { get; set; }
   44:  
   45:         /// <summary/>
   46:         public string StateIdList { get; set; }
   47:  
   48:         /// <summary/>
   49:         public string Name { get; set; }
   50:  
   51:         /// <summary/>
   52:         public string Description { get; set; }
   53:  
   54:         /// <summary/>
   55:         public string Content { get; set; }
   56:  
   57:         /// <summary/>
   58:         public string Note { get; set; }
   59:  
   60:         /// <summary/>
   61:         public double Latitude { get; set; }
   62:  
   63:         /// <summary/>
   64:         public double Longitude { get; set; }
   65:  
   66:         /// <summary/>
   67:         public DateTime Created { get; set; }
   68:  
   69:         /// <summary/>
   70:         public DateTime Updated { get; set; }
   71:  
   72:         /// <summary/>
   73:         public Nullable<DateTime> Deleted { get; set; }
   74:  
   75:         /// <summary/>
   76:         public virtual Ia.Cl.Models.Nfc.Tag Tag { get; set; }
   77:  
   78:         /// <summary/>
   79:         public System.Guid UserId { get; set; }
   80:  
   81:         ////////////////////////////////////////////////////////////////////////////
   82:  
   83:         /// <summary>
   84:         ///
   85:         /// </summary>
   86:         public bool Update(Inventory updatedInventory)
   87:         {
   88:             // below: this will not update Id, ProjectId, UId, Created, Deleted
   89:             bool updated;
   90:  
   91:             updated = false;
   92:  
   93:             if (this.TypeId != updatedInventory.TypeId) { this.TypeId = updatedInventory.TypeId; updated = true; }
   94:             if (this.StateIdList != updatedInventory.StateIdList) { this.StateIdList = updatedInventory.StateIdList; updated = true; }
   95:             if (this.Name != updatedInventory.Name) { this.Name = updatedInventory.Name; updated = true; }
   96:             if (this.Description != updatedInventory.Description) { this.Description = updatedInventory.Description; updated = true; }
   97:             if (this.Content != updatedInventory.Content) { this.Content = updatedInventory.Content; updated = true; }
   98:             if (this.Note != updatedInventory.Note) { this.Note = updatedInventory.Note; updated = true; }
   99:  
  100:             if (this.Latitude != updatedInventory.Latitude) { this.Latitude = updatedInventory.Latitude; updated = true; }
  101:             if (this.Longitude != updatedInventory.Longitude) { this.Longitude = updatedInventory.Longitude; updated = true; }
  102:  
  103:             //if (this.Tag != updatedInventory.Tag) { this.Tag = updatedInventory.Tag; updated = true; }
  104:  
  105:             if (this.UserId != updatedInventory.UserId) { this.UserId = updatedInventory.UserId; updated = true; }
  106:  
  107:             if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
  108:  
  109:             return updated;
  110:         }
  111:  
  112:         ////////////////////////////////////////////////////////////////////////////
  113:         ////////////////////////////////////////////////////////////////////////////
  114:     }
  115:  
  116:     ////////////////////////////////////////////////////////////////////////////
  117:     ////////////////////////////////////////////////////////////////////////////
  118: }