private void btnRemove_Click(object sender, EventArgs e) { var row = gv_DishTypeInfoList.SelectedRows; if (row.Count > 0) { DialogResult result = MessageBox.Show("确定要删除么?", "我是提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { int id = Convert.ToInt32(row[0].Cells[0].Value); if (_dtiBll.Remove(id)) { UpdateTypeEvent?.Invoke(); LoadList(); } else { MessageBox.Show("删除失败"); } } } else { MessageBox.Show("二货,你又忘记选择了"); } }
private void btnRemove_Click(object sender, EventArgs e) { var rows = gv_MemberTypeInfoList.SelectedRows; if (rows.Count > 0) { var result = MessageBox.Show("确定要删除么?", "提示", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { var id = int.Parse(rows[0].Cells[0].Value.ToString()); if (mtiBll.Remove(id)) { Load_List(); UpdateTypeEvent?.Invoke(); } else { MessageBox.Show("删除失败"); } } } else { MessageBox.Show("请选择要删除的数据"); } }
private void btnSave_Click(object sender, EventArgs e) { DishTypeInfo dti = new DishTypeInfo(); dti.DTitle = txtDtitle.Text.ToString(); if (btnSave.Text.Equals("添加")) { if (_dtiBll.Add(dti)) { UpdateTypeEvent?.Invoke(); LoadList(); } else { MessageBox.Show("添加失败!"); } } else if (btnSave.Text.Equals("修改")) { dti.DId = int.Parse(txtDId.Text); if (_dtiBll.Edit(dti)) { UpdateTypeEvent?.Invoke(); LoadList(); } else { MessageBox.Show("修改失败!"); } } }
private void btnSave_Click(object sender, EventArgs e) { var mti = new MemberTypeInfo { MTitle = txtTitle.Text, MDiscount = Convert.ToDecimal(txtDiscount.Text) }; if (btnSave.Text.Equals("添加")) { if (mtiBll.Add(mti)) { btnCancel_Click(null, null); Load_List(); UpdateTypeEvent?.Invoke(); } else { MessageBox.Show("添加失败"); } } else if (btnSave.Text.Equals("修改")) { mti.Mid = Convert.ToInt32(txtId.Text); if (mtiBll.Edit(mti)) { btnCancel_Click(null, null); Load_List(); UpdateTypeEvent?.Invoke(); } else { MessageBox.Show("修改失败"); } } }