Beispiel #1
0
        /// <summary>
        /// Returns true if RentalAgreementRate instances are equal
        /// </summary>
        /// <param name="other">Instance of RentalAgreementRate to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RentalAgreementRate other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     RentalAgreement == other.RentalAgreement ||
                     RentalAgreement != null &&
                     RentalAgreement.Equals(other.RentalAgreement)
                 ) &&
                 (
                     ComponentName == other.ComponentName ||
                     ComponentName != null &&
                     ComponentName.Equals(other.ComponentName)
                 ) &&
                 (
                     IsAttachment == other.IsAttachment ||
                     IsAttachment != null &&
                     IsAttachment.Equals(other.IsAttachment)
                 ) &&
                 (
                     Rate == other.Rate ||
                     Rate != null &&
                     Rate.Equals(other.Rate)
                 ) &&
                 (
                     PercentOfEquipmentRate == other.PercentOfEquipmentRate ||
                     PercentOfEquipmentRate != null &&
                     PercentOfEquipmentRate.Equals(other.PercentOfEquipmentRate)
                 ) &&
                 (
                     RatePeriod == other.RatePeriod ||
                     RatePeriod != null &&
                     RatePeriod.Equals(other.RatePeriod)
                 ) &&
                 (
                     Comment == other.Comment ||
                     Comment != null &&
                     Comment.Equals(other.Comment)
                 ) &&
                 (
                     TimeRecords == other.TimeRecords ||
                     TimeRecords != null &&
                     TimeRecords.SequenceEqual(other.TimeRecords)
                 ));
        }
Beispiel #2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

                if (RentalAgreement != null)
                {
                    hash = hash * 59 + RentalAgreement.GetHashCode();
                }

                hash = hash * 59 + IsIncludedInTotal.GetHashCode();

                if (ComponentName != null)
                {
                    hash = hash * 59 + ComponentName.GetHashCode();
                }

                if (IsAttachment != null)
                {
                    hash = hash * 59 + IsAttachment.GetHashCode();
                }

                if (Rate != null)
                {
                    hash = hash * 59 + Rate.GetHashCode();
                }

                if (PercentOfEquipmentRate != null)
                {
                    hash = hash * 59 + PercentOfEquipmentRate.GetHashCode();
                }

                if (RatePeriod != null)
                {
                    hash = hash * 59 + RatePeriod.GetHashCode();
                }

                if (Comment != null)
                {
                    hash = hash * 59 + Comment.GetHashCode();
                }

                if (TimeRecords != null)
                {
                    hash = hash * 59 + TimeRecords.GetHashCode();
                }
                return(hash);
            }
        }