private void Delete(HttpContext context) { int value = base.GetIntParam(context, "roleId", false).Value; if (value <= 0) { throw new HidistroAshxException("错误的参数"); } try { if (ManagerHelper.GetManagers(new ManagerQuery { RoleId = value }).TotalRecords > 0) { throw new HidistroAshxException("删除失败,该部门下已有管理员!"); } ManagerHelper.DeleteRole(value); base.ReturnSuccessResult(context, "成功删除了选择的部门!", 0, true); } catch { throw new HidistroAshxException("删除失败,该部门下已有管理员!"); } }
private void grdGroupList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { if (ManagerHelper.DeleteRole((int)this.grdGroupList.DataKeys[e.RowIndex].Value)) { this.BindUserGroup(); this.ShowMsg("成功删除了选择的部门", true); return; } this.ShowMsg("删除失败,该部门下已有管理员", false); }