Example #1
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (PersonId != null)
                {
                    hashCode = hashCode * 59 + PersonId.GetHashCode();
                }

                hashCode = hashCode * 59 + EngagementRoute.GetHashCode();
                if (AgencyId != null)
                {
                    hashCode = hashCode * 59 + AgencyId.GetHashCode();
                }

                hashCode = hashCode * 59 + Cost.GetHashCode();
                if (CancellationCosts != null)
                {
                    hashCode = hashCode * 59 + CancellationCosts.GetHashCode();
                }
                return(hashCode);
            }
        }
Example #2
0
        /// <summary>
        /// Returns true if ProposalDetails instances are equal
        /// </summary>
        /// <param name="other">Instance of ProposalDetails to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProposalDetails other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PersonId == other.PersonId ||
                     PersonId != null &&
                     PersonId.Equals(other.PersonId)
                     ) &&
                 (
                     EngagementRoute == other.EngagementRoute ||

                     EngagementRoute.Equals(other.EngagementRoute)
                 ) &&
                 (
                     AgencyId == other.AgencyId ||
                     AgencyId != null &&
                     AgencyId.Equals(other.AgencyId)
                 ) &&
                 (
                     Cost == other.Cost ||

                     Cost.Equals(other.Cost)
                 ) &&
                 (
                     CancellationCosts == other.CancellationCosts ||
                     CancellationCosts != null &&
                     other.CancellationCosts != null &&
                     CancellationCosts.SequenceEqual(other.CancellationCosts)
                 ));
        }