Example #1
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (btnConfirm.Enabled == true)
            {
                record.RentStartDate = dateTimePickerRent.Value.Date;
                record.RentalPeriod  = (dateTimePickerDue.Value.Date - dateTimePickerRent.Value.Date).Days;

                using (TransactionScope ts = new TransactionScope())
                {
                    rentvehiclecontrol.UpdateVehicleStatus(record.RentedVehicle);
                    rentvehiclecontrol.CreateRentalRecord(record);
                    ts.Complete();
                }

                MessageBox.Show(VehicleMessage.RentalrRecordSuccessful);
                rentvehiclecontrol.Close(this);
            }
        }