private void btnAddCar_Click(object sender, EventArgs e) { AddCar frm = new AddCar(); if (frm.ShowDialog() == DialogResult.Yes) { QueryCar(); } }
private void MenuItem_Add_Car_Click(object sender, RoutedEventArgs e) { if (CheckConnection()) { AddCar addCarWindow = new AddCar(); Car car = null; if (addCarWindow.ShowDialog() == false) { if (addCarWindow.car != null) { car = addCarWindow.GetCar; listOfCars.Add(car); AddCarToDB(car); } } } else { MessageBox.Show("Sorry, seems like it is not possible to connect to DB at the moment"); } }
private void btnUpdateCar_Click(object sender, EventArgs e) { List <int> CarIDs = new List <int>(); foreach (DataGridViewRow row in dgvCar.Rows) { if (row.Cells["Selected"].Value != null && (bool)row.Cells["Selected"].Value) { CarIDs.Add(Convert.ToInt32(row.Cells["CarID"].Value)); } } if (CarIDs.Count != 1) { MessageBox.Show("只能选择单张卡牌!"); return; } AddCar frm = new AddCar(); if (frm.ShowDialog() == DialogResult.Yes) { QueryCar(); } }
private void Button_Click(object sender, RoutedEventArgs e) { AddCar addCar = new AddCar(); addCar.ShowDialog(); }