//删除车位 private void btnDeleted_Click(object sender, EventArgs e) { string plate = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); int id = Convert.ToInt32(plate); CarPositionDal dal = new CarPositionDal(); int n = dal.IsDeleted(id); if (n <= 0) { MessageBox.Show("删除失败"); } else { MessageBox.Show("删除成功"); GetData(); } }
//结算车费 private void button2_Click(object sender, EventArgs e) { CarDal dal = new CarDal(); int n = dal.DeletedByPlate(txtPlate.Text, txtMoney.Text, Convert.ToDateTime(txtCloseTime.Text)); CarPositionDal position = new CarPositionDal(); int positionId = Convert.ToInt32(txtCarPosition.Text); int n2 = position.IsDeleted(positionId); if (n > 0 && n2 > 0) { MessageBox.Show("结算成功"); } else { MessageBox.Show("结算失败!"); } }