Added inverse Attribute to ProductGroup.
BillInventory Renamed. Refactored Bill to be more usable. Added Bill Detail Report. Added Open Bill and Bill Details Roles. Zero Rate Products have Yellow background Color. Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI, Cached the Products List. Product and Product Group Form Working.
This commit is contained in:
@ -1,23 +1,46 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
public enum BillItemType
|
||||
{
|
||||
Product,
|
||||
Kot
|
||||
}
|
||||
public class BillItemKey
|
||||
{
|
||||
//Old = 0, New = 1, Modifiers = 2+
|
||||
public BillItemKey(int ProductID, int KotID)
|
||||
private BillItemKey(int productID, int kotID, BillItemType billItemType)
|
||||
{
|
||||
this.ProductID = ProductID;
|
||||
this.KotID = KotID;
|
||||
if (kotID < 0)
|
||||
throw new ArgumentException("KotID Cannot be Negative");
|
||||
if (productID < 0)
|
||||
throw new ArgumentException("ProductID Cannot be Negative");
|
||||
BillItemType = billItemType;
|
||||
ProductID = productID;
|
||||
KotID = kotID;
|
||||
}
|
||||
public BillItemKey(int kotID)
|
||||
: this(0, kotID, BillItemType.Kot)
|
||||
{ }
|
||||
public BillItemKey(int productID, int kotID)
|
||||
: this(productID, kotID, BillItemType.Product)
|
||||
{ }
|
||||
|
||||
private int _productID;
|
||||
public int ProductID
|
||||
{
|
||||
get { return BillItemType == BillItemType.Product ? _productID : 0; }
|
||||
private set { _productID = BillItemType == BillItemType.Product ? value : 0; }
|
||||
}
|
||||
|
||||
public int ProductID { get; private set; }
|
||||
public int KotID { get; private set; }
|
||||
|
||||
public BillItemType BillItemType { get; private set; }
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ProductID.GetHashCode() ^ KotID.GetHashCode();
|
||||
return BillItemType == BillItemType.Product ?
|
||||
ProductID.GetHashCode() ^ KotID.GetHashCode() ^ BillItemType.GetHashCode()
|
||||
: KotID.GetHashCode() ^ BillItemType.GetHashCode(); ;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
@ -41,7 +64,12 @@ namespace Tanshu.Accounts.Contracts
|
||||
if (!(b is BillItemKey))
|
||||
return false;
|
||||
|
||||
return a.ProductID == b.ProductID && a.KotID == b.KotID;
|
||||
if (a.BillItemType != b.BillItemType)
|
||||
return false;
|
||||
|
||||
return a.BillItemType == BillItemType.Product ?
|
||||
a.ProductID == b.ProductID && a.KotID == b.KotID && a.BillItemType == b.BillItemType
|
||||
: a.KotID == b.KotID && a.BillItemType == b.BillItemType;
|
||||
}
|
||||
public static bool operator !=(BillItemKey a, BillItemKey b)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user