public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is AppointmentSegment other && DurationMinutes.Equals(other.DurationMinutes) && ((ServiceVariationId == null && other.ServiceVariationId == null) || (ServiceVariationId?.Equals(other.ServiceVariationId) == true)) && ((TeamMemberId == null && other.TeamMemberId == null) || (TeamMemberId?.Equals(other.TeamMemberId) == true)) && ServiceVariationVersion.Equals(other.ServiceVariationVersion)); }
public override int GetHashCode() { int hashCode = -1009100920; hashCode += DurationMinutes.GetHashCode(); if (ServiceVariationId != null) { hashCode += ServiceVariationId.GetHashCode(); } if (TeamMemberId != null) { hashCode += TeamMemberId.GetHashCode(); } hashCode += ServiceVariationVersion.GetHashCode(); return(hashCode); }
/// <summary> /// Submits current page /// </summary> private void Submit() { int durationHours = 0, durationMinutes = 0, durationSeconds = 0; try { // Follow the order of properties like in the view IoCServer.TestEditor.Builder.AddName(Name); if (string.IsNullOrEmpty(DurationHours)) { DurationHours = "00"; } if (string.IsNullOrEmpty(DurationMinutes)) { DurationMinutes = "00"; } if (string.IsNullOrEmpty(DurationSeconds)) { DurationSeconds = "00"; } if ((DurationHours.TrimStart('0') != "" && !int.TryParse(DurationHours.TrimStart('0'), out durationHours)) || durationHours > 3) { throw new Exception("Niepoprawna wartość w polu godzin."); } if ((DurationMinutes.TrimStart('0') != "" && !int.TryParse(DurationMinutes.TrimStart('0'), out durationMinutes)) || durationMinutes > 60) { throw new Exception("Niepoprawna wartość w polu minut."); } if ((DurationSeconds.TrimStart('0') != "" && !int.TryParse(DurationSeconds.TrimStart('0'), out durationSeconds)) || durationSeconds > 60) { throw new Exception("Niepoprawna wartość w polu sekund."); } IoCServer.TestEditor.Builder.AddDuration(new TimeSpan(durationHours, durationMinutes, durationSeconds)); IoCServer.TestEditor.Builder.AddTags(Tags); IoCServer.TestEditor.Builder.AddNote(Note); } catch (Exception ex) { ErrorMessage = ex.Message; return; } // Chcek if something changed compared to the original information if (EditingModeOn) { if (mOriginalInfo.Name != Name || mOriginalInfo.Duration.TotalSeconds != (durationHours * 3600 + durationMinutes * 60 + durationSeconds) || mOriginalInfo.Tags != Tags || mOriginalInfo.Note != Note) { IoCServer.TestEditor.TestChanged(); } } // If everything went fine proceed to the next phase of creation/edition of this test IoCServer.TestEditor.GoNextPhase(); }