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

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

            return false;
        }

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