Exemplo n.º 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 (EffectiveFrom != null)
                {
                    hashCode = hashCode * 59 + EffectiveFrom.GetHashCode();
                }
                if (DaysPerWeek != null)
                {
                    hashCode = hashCode * 59 + DaysPerWeek.GetHashCode();
                }
                if (MaxDaysPerWeek != null)
                {
                    hashCode = hashCode * 59 + MaxDaysPerWeek.GetHashCode();
                }
                if (MaxShiftsPerWeek != null)
                {
                    hashCode = hashCode * 59 + MaxShiftsPerWeek.GetHashCode();
                }
                if (MaxConsecutiveDays != null)
                {
                    hashCode = hashCode * 59 + MaxConsecutiveDays.GetHashCode();
                }
                if (MaxConsecutiveDaysRequested != null)
                {
                    hashCode = hashCode * 59 + MaxConsecutiveDaysRequested.GetHashCode();
                }
                if (MaxWorkTimePerDay != null)
                {
                    hashCode = hashCode * 59 + MaxWorkTimePerDay.GetHashCode();
                }
                if (MaxDurationPerShift != null)
                {
                    hashCode = hashCode * 59 + MaxDurationPerShift.GetHashCode();
                }
                if (AdditionalHoursPerWeek != null)
                {
                    hashCode = hashCode * 59 + AdditionalHoursPerWeek.GetHashCode();
                }
                if (MaxOvertimePerDay != null)
                {
                    hashCode = hashCode * 59 + MaxOvertimePerDay.GetHashCode();
                }
                if (MaxOvertimePerWeek != null)
                {
                    hashCode = hashCode * 59 + MaxOvertimePerWeek.GetHashCode();
                }
                if (MaxOvertimePerCalendarMonth != null)
                {
                    hashCode = hashCode * 59 + MaxOvertimePerCalendarMonth.GetHashCode();
                }
                if (WtdDayStart != null)
                {
                    hashCode = hashCode * 59 + WtdDayStart.GetHashCode();
                }
                if (WtdWeekDayStart != null)
                {
                    hashCode = hashCode * 59 + WtdWeekDayStart.GetHashCode();
                }
                if (WtdWeekTimeStart != null)
                {
                    hashCode = hashCode * 59 + WtdWeekTimeStart.GetHashCode();
                }

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

            return
                ((
                     EffectiveFrom == other.EffectiveFrom ||
                     EffectiveFrom != null &&
                     EffectiveFrom.Equals(other.EffectiveFrom)
                     ) &&
                 (
                     DaysPerWeek == other.DaysPerWeek ||
                     DaysPerWeek != null &&
                     DaysPerWeek.Equals(other.DaysPerWeek)
                 ) &&
                 (
                     MaxDaysPerWeek == other.MaxDaysPerWeek ||
                     MaxDaysPerWeek != null &&
                     MaxDaysPerWeek.Equals(other.MaxDaysPerWeek)
                 ) &&
                 (
                     MaxShiftsPerWeek == other.MaxShiftsPerWeek ||
                     MaxShiftsPerWeek != null &&
                     MaxShiftsPerWeek.Equals(other.MaxShiftsPerWeek)
                 ) &&
                 (
                     MaxConsecutiveDays == other.MaxConsecutiveDays ||
                     MaxConsecutiveDays != null &&
                     MaxConsecutiveDays.Equals(other.MaxConsecutiveDays)
                 ) &&
                 (
                     MaxConsecutiveDaysRequested == other.MaxConsecutiveDaysRequested ||
                     MaxConsecutiveDaysRequested != null &&
                     MaxConsecutiveDaysRequested.Equals(other.MaxConsecutiveDaysRequested)
                 ) &&
                 (
                     MaxWorkTimePerDay == other.MaxWorkTimePerDay ||
                     MaxWorkTimePerDay != null &&
                     MaxWorkTimePerDay.Equals(other.MaxWorkTimePerDay)
                 ) &&
                 (
                     MaxDurationPerShift == other.MaxDurationPerShift ||
                     MaxDurationPerShift != null &&
                     MaxDurationPerShift.Equals(other.MaxDurationPerShift)
                 ) &&
                 (
                     AdditionalHoursPerWeek == other.AdditionalHoursPerWeek ||
                     AdditionalHoursPerWeek != null &&
                     AdditionalHoursPerWeek.Equals(other.AdditionalHoursPerWeek)
                 ) &&
                 (
                     MaxOvertimePerDay == other.MaxOvertimePerDay ||
                     MaxOvertimePerDay != null &&
                     MaxOvertimePerDay.Equals(other.MaxOvertimePerDay)
                 ) &&
                 (
                     MaxOvertimePerWeek == other.MaxOvertimePerWeek ||
                     MaxOvertimePerWeek != null &&
                     MaxOvertimePerWeek.Equals(other.MaxOvertimePerWeek)
                 ) &&
                 (
                     MaxOvertimePerCalendarMonth == other.MaxOvertimePerCalendarMonth ||
                     MaxOvertimePerCalendarMonth != null &&
                     MaxOvertimePerCalendarMonth.Equals(other.MaxOvertimePerCalendarMonth)
                 ) &&
                 (
                     WtdDayStart == other.WtdDayStart ||
                     WtdDayStart != null &&
                     WtdDayStart.Equals(other.WtdDayStart)
                 ) &&
                 (
                     WtdWeekDayStart == other.WtdWeekDayStart ||
                     WtdWeekDayStart != null &&
                     WtdWeekDayStart.Equals(other.WtdWeekDayStart)
                 ) &&
                 (
                     WtdWeekTimeStart == other.WtdWeekTimeStart ||
                     WtdWeekTimeStart != null &&
                     WtdWeekTimeStart.Equals(other.WtdWeekTimeStart)
                 ) &&
                 (
                     MinBreakBetweenShifts == other.MinBreakBetweenShifts ||

                     MinBreakBetweenShifts.Equals(other.MinBreakBetweenShifts)
                 ) &&
                 (
                     Notes == other.Notes ||
                     Notes != null &&
                     Notes.Equals(other.Notes)
                 ));
        }