예제 #1
0
 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;
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 public Service()
 {
     _reservationsDB            = new ReservationsDB();
     _carsDB                    = new CarsDB();
     maxNumberOfDaysReservation = 60;
 }