//删除操作 private void buttonshanchu_Click(object sender, EventArgs e) { var rows = dataGridView1.SelectedRows; if (rows.Count > 0) { DialogResult result = MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { int id = Convert.ToInt32(rows[0].Cells[0].Value); if (diBll.Remove(id)) { LoadList(); } else { MessageBox.Show("删除失败,请稍后重试!!!"); } } } else { MessageBox.Show("请先选择行!!!"); } }
private void btnRemove_Click(object sender, EventArgs e) { //获取选中的行 var rows = gvDishInfo.SelectedRows; if (rows.Count > 0) { DialogResult result = MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { int id = int.Parse(rows[0].Cells[0].Value.ToString()); if (diBll.Remove(id)) { LoadDishInfoList(); } else { MessageBox.Show("删除失败,请稍后重试!"); } } } else { MessageBox.Show("二货,你还没选要删除的行呢!"); } }
//private void txtDTitleAdd_Leave(object sender, EventArgs e) //{ // txtDCharAdd.Text = PinyinHelper.GetPinYin(txtDTitleAdd.Text); //} private void btnRemove_Click(object sender, EventArgs e) { var row = gv_DishInfoList.SelectedRows; if (row.Count > 0) { DialogResult result = MessageBox.Show("确定要删除么?", "这只是一个提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { if (_diBll.Remove(Convert.ToInt32(row[0].Cells[0].Value))) { btnCancel_Click(null, null); LoadList(); } else { MessageBox.Show("删除失败!"); } } } else { MessageBox.Show("二货,你没有选中菜名!"); } }
private void btnRemove_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); DialogResult result = MessageBox.Show("Are you sure to delete?", "Tips", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { if (diBll.Remove(id)) { LoadList(); } else { MessageBox.Show("Fail to delete"); } } }
private void btnDelete_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { if (diBll.Remove(id)) { LoadList(); } else { MessageBox.Show("删除失败,请稍后重试"); } } }
private void btnRemove_Click(object sender, EventArgs e) { int Did = Convert.ToInt32(dgvList.SelectedCells[0].Value); DialogResult result = MessageBox.Show("确定要删除此条数据吗", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } if (diBll.Remove(Did)) { LoadList(); } else { MessageBox.Show("删除失败"); } }
/// <summary> /// 逻辑删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRemove_Click(object sender, EventArgs e) { int id = int.Parse(dgvList.SelectedCells[0].Value.ToString()); DialogResult result = MessageBox.Show("确认要删除吗?", "提示", MessageBoxButtons.OKCancel); if (result != DialogResult.OK) { return; } if (diBll.Remove(id)) { LoadList(); MessageBox.Show("删除成功."); } else { MessageBox.Show("删除失败,请稍后重试......"); } }
private void btnRemove_Click(object sender, EventArgs e) { //提示删除,用户确认 DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } //获取用户选择的编号 int id = Convert.ToInt32(dgvList.SelectedRows[0].Cells[0].Value); //调用方法,根据编号进行软删除 if (diBll.Remove(id)) { LoadList(); } else { MessageBox.Show("删除失败,请稍候重试"); } }
private void btnRemove_Click(object sender, EventArgs e) { if (txtId.Text.Equals("添加时无编号")) { MessageBox.Show("请双击要删除的数据", "提示"); return; } DishInfo di = new DishInfo() //构造对象 { DId = Convert.ToInt32(txtId.Text), DTitle = txtTitleSave.Text, DChar = txtChar.Text, DPrice = Convert.ToDecimal(txtPrice.Text), DTypeId = Convert.ToInt32(ddlTypeAdd.SelectedValue) }; if (diBll.Remove(di)) { LoadList(); LoadTypeList(); ResetCom(); } }
private void btnRemove_Click(object sender, EventArgs e) { var row = dgvList.SelectedRows; int index = Convert.ToInt32(row[0].Cells[0].Value); DialogResult resul = MessageBox.Show("确认要删除吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (resul == DialogResult.OK) { if (bll.Remove(index)) { MessageBox.Show("删除成功!"); } else { MessageBox.Show("删除失败!请稍后重试"); } } else { } Clear(); LoadList(); }