2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
|
|
|
{
|
|
|
|
|
public class BillItemKey
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public BillItemKey(int productID, bool isNew)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
ProductID = productID;
|
|
|
|
|
IsNew = isNew;
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public int ProductID
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
}
|
|
|
|
|
public bool IsNew
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
private set;
|
|
|
|
|
}
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
return ProductID.GetHashCode() ^ IsNew.GetHashCode();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj is BillItemKey)
|
|
|
|
|
return (this == (BillItemKey)obj);
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return string.Format("{0} - {1}", ProductID, IsNew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(BillItemKey a, BillItemKey b)
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
if (object.ReferenceEquals(null, a))
|
|
|
|
|
return object.ReferenceEquals(null, b);
|
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
if (!(a is BillItemKey))
|
|
|
|
|
return false;
|
|
|
|
|
if (!(b is BillItemKey))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return a.ProductID == b.ProductID && a.IsNew == b.IsNew;
|
|
|
|
|
}
|
|
|
|
|
public static bool operator !=(BillItemKey a, BillItemKey b)
|
|
|
|
|
{
|
|
|
|
|
return !(a == b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|