narsil/Tanshu.Accounts.Contracts/Data Contracts/InventoryBO.cs
2010-03-02 23:26:21 +05:30

91 lines
2.1 KiB
C#

using System;
using System.Runtime.Serialization;
namespace Tanshu.Accounts.Contracts
{
[DataContract]
public class InventoryBO
{
[DataMember]
public Guid InventoryID { get; set; }
[DataMember]
public Guid VoucherID { get; set; }
[DataMember]
public Guid ProductID { get; set; }
[DataMember]
public Guid? ComplexProductID { get; set; }
private decimal quantity;
[DataMember]
public decimal Quantity
{
get { return quantity; }
set
{
quantity = value;
if (amount != null)
CalculateAmount();
}
}
private decimal rate;
[DataMember]
public decimal Rate
{
get { return rate; }
set
{
rate = value;
if (amount != null)
CalculateAmount();
}
}
decimal tax;
[DataMember]
public decimal Tax
{
get { return tax; }
set
{
tax = value; if (amount != null)
CalculateAmount();
}
}
decimal discount;
[DataMember]
public decimal Discount
{
get { return discount; }
set
{
discount = value; if (amount != null)
CalculateAmount();
}
}
decimal? amount;
[DataMember]
public decimal Amount
{
get
{
if (!amount.HasValue)
CalculateAmount();
return amount.Value;
}
}
private void CalculateAmount()
{
amount = quantity * rate * (1 + tax) * (1 - discount);
}
[DataMember]
public bool IsRateFinal { get; set; }
[DataMember]
public bool RateFinal
{
get { return IsRateFinal; }
}
[DataMember]
public byte[] timestamp { get; set; }
}
}