//will not be called if action is cancelled -- only if a save occurs private void closeForm() { VehiclesForm vehiclesForm = (VehiclesForm)parentForm; vehiclesForm.ReloadVehicles(); this.Close(); }
//add the transaction to the database, which will cascade save the vehicle and customer associated with it private void confirmSale(Transaction transaction) { var confirmResult = MessageBox.Show("Are you sure you want to make this sale?\n" + currentVehicle + "\nFinal Price: $" + transaction.totalCost, "Confirm Sale", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { currentVehicle.sold = true; TransactionDAO.SaveTransaction(transaction); //update the list of vehicles in the parent form so that it shows that this car has been sold parentForm.ReloadVehicles(); Console.WriteLine("Transaction Completed"); this.Close(); } }