public void SendToCheckUpOnTime() { _rentsLastBeforeCheckingUp -= 1; if (_rentsLastBeforeCheckingUp == 0) { // запросить последнюю дату проката, добавить резервацию тех. обслуживания на 7 дней ReservationsDB reservationsDB = new ReservationsDB(); var lastReservation = reservationsDB.LastReservationEnds(_carID); reservationsDB.AddReservation("Technical inspection", _carID, lastReservation.AddDays(1), lastReservation.AddDays(8)); _rentsLastBeforeCheckingUp = 10; } }
public IEnumerable <Car> SelectCarsWhichAvailableIn(DateTime firstDay, DateTime lastDay) { List <Car> AvailableCars = new List <Car>(); ReservationsDB reservationsDB = new ReservationsDB(); foreach (Car car in _allCars) { if (reservationsDB.IsFreeToRentIn(car.ID, firstDay, lastDay)) { AvailableCars.Add(car); } } return(AvailableCars); }
public Service() { _reservationsDB = new ReservationsDB(); _carsDB = new CarsDB(); maxNumberOfDaysReservation = 60; }