3ca8b29e04
Regression: PrintLocation added the compare methods back Breaking: Kot.Code is now integers Breaking: Kot Update is now via Stored Procedure to get DB Values Breaking: Reprints Insert is now via Stored Procedure to get DV Values Breaking: Voucher.BillID and KotID are now integers Breaking: Voucher Insert/Update is now via Stored Procedures to get DV Values also Dirty Checking for Voucher has been overwritten to set dirty for LastEditDate update Fix: Login forms simplified Feature: PrintLocation and Products are cached application wide.
70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using System;
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
{
|
|
public enum BillItemType
|
|
{
|
|
Product,
|
|
Kot
|
|
}
|
|
public class BillItemKey
|
|
{
|
|
private BillItemKey(Guid productID, Guid kotID, BillItemType billItemType)
|
|
{
|
|
BillItemType = billItemType;
|
|
ProductID = productID;
|
|
KotID = kotID;
|
|
}
|
|
public BillItemKey(Guid kotID)
|
|
: this(Guid.Empty, kotID, BillItemType.Kot)
|
|
{ }
|
|
public BillItemKey(Guid productID, Guid kotID)
|
|
: this(productID, kotID, BillItemType.Product)
|
|
{ }
|
|
|
|
private Guid _productID;
|
|
public Guid ProductID
|
|
{
|
|
get { return BillItemType == BillItemType.Product ? _productID : Guid.Empty; }
|
|
private set { _productID = BillItemType == BillItemType.Product ? value : Guid.Empty; }
|
|
}
|
|
|
|
public Guid KotID { get; private set; }
|
|
|
|
public BillItemType BillItemType { get; private set; }
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return BillItemType.GetHashCode() ^ KotID.GetHashCode() ^ ProductID.GetHashCode();
|
|
}
|
|
public static bool operator ==(BillItemKey a, BillItemKey b)
|
|
{
|
|
if (object.ReferenceEquals(null, a))
|
|
return object.ReferenceEquals(null, b);
|
|
|
|
if (!(a is BillItemKey))
|
|
return false;
|
|
if (!(b is BillItemKey))
|
|
return false;
|
|
|
|
if (a.BillItemType != b.BillItemType)
|
|
return false;
|
|
|
|
return a.KotID == b.KotID && a.BillItemType == b.BillItemType && a.ProductID == b.ProductID;
|
|
}
|
|
public static bool operator !=(BillItemKey a, BillItemKey b)
|
|
{
|
|
return !(a == b);
|
|
}
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is BillItemKey)
|
|
return (this == (BillItemKey)obj);
|
|
else
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
|