示例#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);
 }