namespace BS.Shared.DataContracts
{
    public partial class ContractDC
    {
        public override bool Equals(object obj)
        {
            if (obj is ContractDC)
            {
                var y = (ContractDC)obj;
                if (this.ContractOid == null && y.ContractOid == null)
                {
                    return this.GetHashCode() == y.GetHashCode();
                }

                if (this.ContractOid != null && y.ContractOid != null)
                {
                    return this.ContractOid == y.ContractOid;
                }
            }

            return false;
        }

        public override int GetHashCode()
        {
            return this.ContractOid.HasValue ? this.GetType().Name.GetHashCode() ^ this.ContractOid.GetHashCode() : base.GetHashCode();
        }
    }
}