private void btnDelete_Click(object sender, EventArgs e) { try { if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0) { FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000); return; } Menus entity = CGridHelper.GetCurrentData <Menus>(dgv); MenuApi constantApi = new MenuApi(); var resp = constantApi.DeleteMenu(entity.Id); if (resp.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "删除成功!", ContentAlignment.MiddleCenter, 1000); CGridHelper.DeleteRow(dgv); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "删除失败!" + resp.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "删除异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000); } }
protected void DeleteBtn_Click(object sender, EventArgs e) { IMenuApi menuapi = new MenuApi(); ErrJson EJ = menuapi.DeleteMenu(token); lblMsg.Text = EJ.errcode + ":" + EJ.errmsg; }