Ejemplo n.º 1
0
 private bool ValidateBookingSlot(BookedSlot booking)
 {
     foreach (var s in this.myBookedSlotList)
     {
         if (s.IsOverLap(booking))
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
 public bool BookSlot(BookedSlot booking)
 {
     if (ValidateBookingSlot(booking))
     {
         if (this.BookedSlots == null)
         {
             this.BookedSlots = new List <BookedSlot>();
         }
         this.BookedSlots.Add(booking);
         BookableBroker.Save(this);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
        private bool ValidateBookingSlot(BookedSlot booking)
        {
            if (this.BookedSlots == null)
            {
                return(true);
            }

            foreach (var s in this.BookedSlots)
            {
                if (s.IsOverLap(booking))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        public bool BookSlot(BookedSlot bookingAtempt)
        {
            if (!ValidateBookingSlot(bookingAtempt))
            {
                return(false);
            }
            var bookable = BookableBroker.GetBookableById(bookingAtempt.BookableId);

            if (bookable.BookSlot(bookingAtempt))
            {
                myBookedSlotList.Add(bookingAtempt);
                ConsumerBroker.Save(this);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        public bool IsOverLap(BookedSlot booking)
        {
            if (this.Start <= booking.End && this.End >= booking.End) //new book end in range
            {
                return(true);
            }
            else if (this.Start <= booking.Start && this.End >= booking.Start) // new booking start in range
            {
                return(true);
            }
            else if (this.Start >= booking.Start && this.End <= booking.End) // new booking covers
            {
                return(true);
            }
            else if (this.Start <= booking.Start && this.End >= booking.End) //new booking contain within
            {
                return(true);
            }

            return(false);
        }