예제 #1
0
 public Reservation(Customer owner, IAccomodation accomodation, ReservationPeriod reservationPeriod, string numberOfPersons, Option bestOption)
 {
     Owner             = owner;
     Hotel             = accomodation;
     ReservationPeriod = reservationPeriod;
     NumberOfPersons   = numberOfPersons;
     BestOption        = bestOption;
 }
예제 #2
0
        public void ComputeTotalPriceFor(ReservationPeriod reservationPeriod)
        {
            double sum = 0;

            foreach (Room room in _roomList)
            {
                double roomPrice = double.Parse(room.Price.Value);
                sum += roomPrice * (reservationPeriod.CheckOut.Day - reservationPeriod.CheckIn.Day);
                _totalPrice.Currency = room.Price.Currency;
            }
            _totalPrice.Value = "" + sum;
        }
예제 #3
0
        public bool IsAfter(ReservationPeriod reservedPeriod)
        {
            int result = DateTime.Compare(_checkIn, reservedPeriod._checkOut);

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        public bool IsBefore(ReservationPeriod reservedPeriod)
        {
            int result = DateTime.Compare(_checkOut, reservedPeriod._checkIn);

            if (result < 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        public bool HasRoomsAvailableIn(ReservationPeriod reservationPeriod)
        {
            ComputeAvailableRoomsIn(reservationPeriod);

            if (_availableRoomsList.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #6
0
 private void ComputeAvailableRoomsIn(ReservationPeriod reservationPeriod)
 {
     _availableRoomsList.Clear();
     if (_roomList.Count > 0)
     {
         foreach (IRoom room in _roomList)
         {
             if (room.IsAvailableIn(reservationPeriod))
             {
                 AddToAvailableRoomList(room);
             }
         }
     }
 }
예제 #7
0
        public bool IsAvailableIn(ReservationPeriod reservationPeriod)
        {
            bool isAvailable = true;

            if (_reservedPeriodList.Count > 0)
            {
                foreach (ReservationPeriod reservedPeriod in _reservedPeriodList)
                {
                    if ((reservationPeriod.IsBefore(reservedPeriod) == false) && (reservationPeriod.IsAfter(reservedPeriod) == false))
                    {
                        isAvailable = false;
                    }
                }
            }
            return(isAvailable);
        }
예제 #8
0
 public Reservation()
 {
     _owner             = new Customer();
     _reservationPeriod = new ReservationPeriod();
     _numberOfPersons   = string.Empty;
 }
 public AccomodationReservation(IAccomodation accomodation, ReservationPeriod reservationPeriod, IRoom room)
 {
     _accomodation      = accomodation;
     _reservationPeriod = reservationPeriod;
     _room = room;
 }
 public AccomodationReservation()
 {
     _reservationPeriod = new ReservationPeriod();
     _room = new Room();
 }
예제 #11
0
 public void Delete(ReservationPeriod reservationPeriod)
 {
     _reservedPeriodList.Remove(reservationPeriod);
 }
예제 #12
0
 public void Add(ReservationPeriod newReservationPeriod)
 {
     _reservedPeriodList.Add(newReservationPeriod);
 }