private bool AreAvailableSpace(Vehicle vehicle) { List <Vehicle> vehicles = vehicleQuery.GetAllActiveVehicles(vehicle.VehicleType); if ((VehicleHelper.IsCar(vehicle) && vehicles.Count.Equals(20)) || (VehicleHelper.IsMotorcycle(vehicle) && vehicles.Count.Equals(10))) { errorMessage = Messages.ErrorSpaceFull; return(false); } return(true); }
private int CalculatePayment(Vehicle vehicle) { int payment = 0; int differenceHours = Convert.ToInt32(Math.Ceiling((dateTimeHelper.GetDateTimeNow() - vehicle.EntryTime).TotalHours)); if (differenceHours >= 9) { payment = CalculatePaymentParkingDays(vehicle, differenceHours); } else { payment = GetPaymentParkingHours(vehicle, differenceHours); } payment = VehicleHelper.IsMotorcycle(vehicle) && vehicle.Displacement > 500 ? payment + VehicleHelper.GetExtraCostMotorcycleHigher500Displacement() : payment; return(payment); }