public virtual bool TimePeriodAvailable(BookingPeriod period) { var RelevantBookings = Bookings.Where(b => b.BlocksOtherBookings).ToList(); foreach (BookingPeriod bookingPeriod in RelevantBookings.ConvertEnumerable(booking => booking.BookingPeriod)) { if (bookingPeriod.OverlapsWith(period)) { return(false); } } return(true); }
public virtual void SetDates(BookingPeriod selectedDates) { BookingPeriod = new BookingPeriod(selectedDates.StartDate, selectedDates.EndDate); }
public virtual bool DoesNotOverlapWith(Booking booking) { return(BookingPeriod.DoesNotoverlapWith(booking.BookingPeriod)); }
public virtual bool OverlapsWith(Booking booking) { return(BookingPeriod.OverlapsWith(booking.BookingPeriod)); }
/// <summary> /// Determines if the specified BookingPeriod does overlap with the current one /// </summary> /// <param name="compareWith">BookingPeriod to compare with</param> /// <returns>True if it they do overlap. False otherwise.</returns> public virtual bool OverlapsWith(BookingPeriod compareWith) { return(!DoesNotoverlapWith(compareWith)); }
/// <summary> /// Determines if the specified BookingPeriod does not overlap with the current one /// </summary> /// <param name="compareWith">BookingPeriod to compare with</param> /// <returns>True if it they do not overlap. False otherwise.</returns> public virtual bool DoesNotoverlapWith(BookingPeriod compareWith) { return((compareWith.StartDate > EndDate) || (compareWith.EndDate < StartDate)); }