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