//删除产品 private void btnDeletePro_Click(object sender, EventArgs e) { if (dgvProductInfo.SelectedRows.Count > 0) { //获取当前选中行的 ID int id = Convert.ToInt32(dgvProductInfo.SelectedRows[0].Cells[0].Value.ToString()); ProductInfoBLL bll = new ProductInfoBLL(); string msg = bll.SoftDeleteProductInfoProId(id) ? "操作成功" : "操作失败"; MessageBox.Show(msg); LoadProductInfoByDelFlag(0);//刷新 } }