/// <summary> /// Determines whether this ItemSize is the same that other. /// </summary> /// <param name="other">The other.</param> /// <returns> /// <c>true</c> if is the same the specified other; otherwise, <c>false</c>. /// </returns> public bool IsTheSame(ItemSize other) { return other.Description == Description && other.Name == Name && other.IsActive == IsActive && other.Size == Size && IsIdealHoursTheSame(other) && other.OccurrenceConstraint == OccurrenceConstraint; }
public bool IsIdealHoursTheSame(ItemSize other) { if (other.SizeIdealHours == null && SizeIdealHours == null) return true; if (other.SizeIdealHours == null && SizeIdealHours != null) return false; if (other.SizeIdealHours != null && SizeIdealHours == null) return false; if (other.SizeIdealHours.Count != SizeIdealHours.Count) return false; var myHours = SizeIdealHours.OrderBy(i => i.RoleShortName).ToArray(); var otherHours = other.SizeIdealHours.OrderBy(i => i.RoleShortName).ToArray(); for (int i = 0; i < myHours.Length; i++) { if(myHours[i].Hours!=otherHours[i].Hours) return false; } return true; }