Skip to content

Instantly share code, notes, and snippets.

@bdallen
Created December 12, 2011 06:26
Show Gist options
  • Save bdallen/1465385 to your computer and use it in GitHub Desktop.
Save bdallen/1465385 to your computer and use it in GitHub Desktop.
namespace normist.websync.entities.Data_Entities
{
#region Data Structures
/// <summary>
/// Stock Item
/// </summary>
[Serializable]
public class StockItem
{
/// <summary>
/// Private Objects
/// </summary>
public string _ProductID;
public string _Name;
public string _Barcode;
protected string _SalesExTax;
public int _TaxCode;
public string _UnitMeasure;
public int _PackQty;
public string _Location;
public string _SupplierPN;
public double _Weight;
public bool _Hold;
public int _OnHand;
public string _Group;
[NonSerialized]
private string _SalesKey = "xxxxxxxxxxxxxxxxxxxxx";
/// <summary>
/// Return the SHA512 HASH String of the Stock
/// </summary>
public string StockHash
{
get
{
byte[] bSalt = ASCIIEncoding.ASCII.GetBytes("imsalt");
return normist.utilities.Encoders.SimpleHash.ComputeHash(_ProductID + _SalesExTax.ToString() + _Location + _SupplierPN + _OnHand.ToString() + _Hold.ToString() + _Name, "SHA512", bSalt);
}
}
/// <summary>
/// Returns the DatabaseID Number of the Stock Item
/// </summary>
public string DatabaseID
{
get
{
return _ProductID + _Location;
}
}
/// <summary>
/// Retrive or Set the Sale Price Ex Tax
/// </summary>
[XmlIgnore]
public decimal SalesEx
{
get
{
return System.Convert.ToDecimal(normist.utilities.Encryption.TripleDES.DecryptString(_SalesExTax, _SalesKey));
}
set
{
_SalesExTax = normist.utilities.Encryption.TripleDES.EncryptString(value.ToString(), _SalesKey);
}
}
}
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment