示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddVehicle addCustomerForm = new frmAddVehicle();
            Vehicle       vehicle         = addCustomerForm.GetNewVehicle();

            if (vehicle != null)
            {
                vehicles.Add(vehicle);
                VehicleDB.SaveVehicle(vehicles);
                FillVehicleListBox();
            }
        }
示例#2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int i = lstVehicles.SelectedIndex;

            if (i != -1)
            {
                Vehicle      vehicle = vehicles[i];
                string       message = "Are you sure you want to delete " + vehicle.Vin + " " + vehicle.Description + "?";
                DialogResult button  = MessageBox.Show(message, "Confirm Delete", MessageBoxButtons.YesNo);
                if (button == DialogResult.Yes)
                {
                    vehicles.Remove(vehicle);
                    VehicleDB.SaveVehicle(vehicles);
                    FillVehicleListBox();
                }
            }
        }
示例#3
0
 private void frmCustomers_Load(object sender, EventArgs e)
 {
     vehicles = VehicleDB.GetVehicles();
     FillVehicleListBox();
 }
 private void frmVehicleAddNormal_Load(object sender, EventArgs e)
 {
     vehicles = VehicleDB.GetVehicle();
     FillVehicleListBox();
 }