Esempio n. 1
0
 private void tbnAddNewCar_Click(object sender, EventArgs e)
 {
     CarEditForm carEditForm = new CarEditForm();
     carEditForm.Show();
 }
Esempio n. 2
0
        private void dgvCarList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvCarList.Columns[e.ColumnIndex].Name == "btnEdit")
            {
                Form carEditForm= new CarEditForm(GetCarByRow());
                carEditForm.Show();

            }

            if (dgvCarList.Columns[e.ColumnIndex].Name == "btnDelete")
            {
                int id = Convert.ToInt32(dgvCarList.CurrentRow.Cells[2].Value.ToString());
                try
                {
                    carBLL.DeleteByCarId(id);
                    MessageBox.Show("删除成功");
                    DataTable carList = carBLL.FindAll_infos(getblacklistsql);

                    dgvCarList.DataSource = carList;
                }
                catch (Exception ex)
                {

                    MessageBox.Show("删除失败" + ex.Message);
                }

            }
        }