Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public virtual void SetDates(BookingPeriod selectedDates)
 {
     BookingPeriod = new BookingPeriod(selectedDates.StartDate, selectedDates.EndDate);
 }
Esempio n. 3
0
 public virtual bool DoesNotOverlapWith(Booking booking)
 {
     return(BookingPeriod.DoesNotoverlapWith(booking.BookingPeriod));
 }
Esempio n. 4
0
 public virtual bool OverlapsWith(Booking booking)
 {
     return(BookingPeriod.OverlapsWith(booking.BookingPeriod));
 }
Esempio n. 5
0
 /// <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));
 }
Esempio n. 6
0
 /// <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));
 }