/// <summary>
        /// This method will run through the details of the rental(including fees)
        /// give a sufficient calculation for the cost of the rental /day.
        /// </summary>
        private void UpdateRentalCost()
        {
            int fees = RentalControl.AccessoryFee(_rentalToPayFor, babySeat.Checked, satNav.Checked)
                       + _customerOfRental.Fee;

            txtRentRate.Text = "$" + _vehicleOfRental.Rate.ToString() + "/day";
            txtFees.Text     = "$" + fees.ToString();
            RentalControl.DetermineCost(_rentalToPayFor, babySeat.Checked, satNav.Checked);
            txtCost.Text = "$" + _rentalToPayFor.Cost.ToString();
        }
 /// <summary>
 /// This method will attempt to send the rental to the database
 /// and if the rental worked, the rental confirmation page is displayed
 /// otherwise, an error messgae is shown.
 /// </summary>
 private void AttemptRental()
 {
     _rentalToPayFor.DropOffLocation = dropoffCB.Text;
     if (RentalControl.AddRental(_rentalToPayFor))
     {
         DisplayRentalConfirmationPage();
         Controllers.UserControl.RemoveFee(_customerOfRental);
     }
     else
     {
         SetAndMakeVisiblePaymentErrorText(PMT_ERROR_USER_IN_RENTAL);
     }
 }
        public void DetermineCostTest()
        {
            Rental  r1          = DBController.GetAllRecords <Rental>().FirstOrDefault();
            Vehicle v1          = DBController.GetByPrimaryKey <Vehicle>(r1.VehicleID);
            int     vehicleRate = v1.Rate;
            int     vehicleDate = r1.EndDate.DayOfYear - r1.StartDate.DayOfYear;
            int     acc         = RentalControl.AccessoryFee(r1, false, false);
            int     amountT     = vehicleRate * (vehicleDate + 1) + acc;

            RentalControl.DetermineCost(r1, false, false);
            double amount = r1.Cost;

            Assert.AreEqual(amount, amountT);
        }
        public void AddRentalTest()
        {
            List <string> nameslist = new List <string>();
            Vehicle       v1        = new Vehicle("car", "blue", 123, "100", "s", false, false, 15, "Madison");

            DBController.Save(v1, DBObject.SaveTypes.Insert);
            Customer c1 = new Customer("John", "Doe", "username", "password");

            DBController.Save(c1, DBObject.SaveTypes.Insert);
            DateTime startDate = new DateTime(2018, 1, 1);
            DateTime endDate   = new DateTime(2018, 1, 2);
            Rental   r1        = new Rental(startDate, endDate, "Platteville", "Madison", v1, c1, "");

            RentalControl.AddRental(r1);
            Rental r2 = DBController.GetByPrimaryKey <Rental>(r1.PrimaryKey);

            Assert.AreEqual(r1.PrimaryKey, r2.PrimaryKey);
        }
 public void ListOfVehicleRental()
 {
     Vehicle       v = new Vehicle("t", "c", 1, "m", "m2", true, true, 100, "here");
     List <Rental> vehicleRentals = RentalControl.returnaAllRentals();
 }