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

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

            return false;
        }

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

        public override string ToString()
        {
            return this.Description;
        }
    }
}