public Reservation(Customer owner, IAccomodation accomodation, ReservationPeriod reservationPeriod, string numberOfPersons, Option bestOption) { Owner = owner; Hotel = accomodation; ReservationPeriod = reservationPeriod; NumberOfPersons = numberOfPersons; BestOption = bestOption; }
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; }
public bool IsAfter(ReservationPeriod reservedPeriod) { int result = DateTime.Compare(_checkIn, reservedPeriod._checkOut); if (result > 0) { return(true); } else { return(false); } }
public bool IsBefore(ReservationPeriod reservedPeriod) { int result = DateTime.Compare(_checkOut, reservedPeriod._checkIn); if (result < 0) { return(true); } else { return(false); } }
public bool HasRoomsAvailableIn(ReservationPeriod reservationPeriod) { ComputeAvailableRoomsIn(reservationPeriod); if (_availableRoomsList.Count > 0) { return(true); } else { return(false); } }
private void ComputeAvailableRoomsIn(ReservationPeriod reservationPeriod) { _availableRoomsList.Clear(); if (_roomList.Count > 0) { foreach (IRoom room in _roomList) { if (room.IsAvailableIn(reservationPeriod)) { AddToAvailableRoomList(room); } } } }
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); }
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(); }
public void Delete(ReservationPeriod reservationPeriod) { _reservedPeriodList.Remove(reservationPeriod); }
public void Add(ReservationPeriod newReservationPeriod) { _reservedPeriodList.Add(newReservationPeriod); }