public void Update(DateTime from, DateTime to, UnavailabilityReason reason, string comment) { this.SetDuration(from, to); this.Reason = reason; this.Comment = comment; this.LastModified = DateTime.UtcNow; }
public Unavailability(DateTime from, DateTime to, UnavailabilityReason reason, string comment) { this.Created = DateTime.UtcNow; this.SetDuration(from, to); this.Reason = reason; this.Comment = comment; }
/// <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 (UnavailabilityGroup != null) { hashCode = hashCode * 59 + UnavailabilityGroup.GetHashCode(); } if (UnavailabilityReason != null) { hashCode = hashCode * 59 + UnavailabilityReason.GetHashCode(); } if (Work != null) { hashCode = hashCode * 59 + Work.GetHashCode(); } if (Start != null) { hashCode = hashCode * 59 + Start.GetHashCode(); } if (End != null) { hashCode = hashCode * 59 + End.GetHashCode(); } if (ExternalUnavailabilityIdentifier != null) { hashCode = hashCode * 59 + ExternalUnavailabilityIdentifier.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if PersonalPatternUnavailability instances are equal /// </summary> /// <param name="other">Instance of PersonalPatternUnavailability to be compared</param> /// <returns>Boolean</returns> public bool Equals(PersonalPatternUnavailability other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( UnavailabilityGroup == other.UnavailabilityGroup || UnavailabilityGroup != null && UnavailabilityGroup.Equals(other.UnavailabilityGroup) ) && ( UnavailabilityReason == other.UnavailabilityReason || UnavailabilityReason != null && UnavailabilityReason.Equals(other.UnavailabilityReason) ) && ( Work == other.Work || Work != null && Work.Equals(other.Work) ) && ( Start == other.Start || Start != null && Start.Equals(other.Start) ) && ( End == other.End || End != null && End.Equals(other.End) ) && ( ExternalUnavailabilityIdentifier == other.ExternalUnavailabilityIdentifier || ExternalUnavailabilityIdentifier != null && ExternalUnavailabilityIdentifier.Equals(other.ExternalUnavailabilityIdentifier) )); }
public UnavailabilityBuilder WithReason(UnavailabilityReason reason) { base.Entity.SetProperty(p => p.Reason, reason); return(this); }