Example #1
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 (EquipmentType != null)
                {
                    hash = hash * 59 + EquipmentType.GetHashCode();
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     EquipmentType == other.EquipmentType ||
                     EquipmentType != null &&
                     EquipmentType.Equals(other.EquipmentType)
                 ) &&
                 (
                     OwnerName == other.OwnerName ||
                     OwnerName != null &&
                     OwnerName.Equals(other.OwnerName)
                 ) &&
                 (
                     OwnerId == other.OwnerId ||
                     OwnerId != null &&
                     OwnerId.Equals(other.OwnerId)
                 ) &&
                 (
                     SeniorityString == other.SeniorityString ||
                     SeniorityString != null &&
                     SeniorityString.Equals(other.SeniorityString)
                 ) &&
                 (
                     Seniority == other.Seniority ||
                     Seniority != null &&
                     Seniority.Equals(other.Seniority)
                 ) &&
                 (
                     Make == other.Make ||
                     Make != null &&
                     Make.Equals(other.Make)
                 ) &&
                 (
                     Model == other.Model ||
                     Model != null &&
                     Model.Equals(other.Model)
                 ) &&
                 (
                     Size == other.Size ||
                     Size != null &&
                     Size.Equals(other.Size)
                 ) &&
                 (
                     EquipmentCode == other.EquipmentCode ||
                     EquipmentCode != null &&
                     EquipmentCode.Equals(other.EquipmentCode)
                 ) &&
                 (
                     LastCalled == other.LastCalled ||
                     LastCalled != null &&
                     LastCalled.Equals(other.LastCalled)
                 ) &&
                 (
                     YearsRegistered == other.YearsRegistered ||
                     YearsRegistered != null &&
                     YearsRegistered.Equals(other.YearsRegistered)
                 ) &&
                 (
                     YtdHours == other.YtdHours ||
                     YtdHours != null &&
                     YtdHours.Equals(other.YtdHours)
                 ) &&
                 (
                     HoursYearMinus1 == other.HoursYearMinus1 ||
                     HoursYearMinus1 != null &&
                     HoursYearMinus1.Equals(other.HoursYearMinus1)
                 ) &&
                 (
                     HoursYearMinus2 == other.HoursYearMinus2 ||
                     HoursYearMinus2 != null &&
                     HoursYearMinus2.Equals(other.HoursYearMinus2)
                 ) &&
                 (
                     HoursYearMinus3 == other.HoursYearMinus3 ||
                     HoursYearMinus3 != null &&
                     HoursYearMinus3.Equals(other.HoursYearMinus3)
                 ) &&
                 (
                     SenioritySortOrder == other.SenioritySortOrder ||
                     SenioritySortOrder.Equals(other.SenioritySortOrder)
                 ));
        }