protected void btnDelete_ServerClick(object sender, EventArgs e) { try { int menuID = CurrentSelectMenuID; int parentMenuID = 0; SystemMenu systemMenu = systemMenuServiceInstance.FindById(menuID); if (systemMenu != null) { if (systemMenu.ParentMenuID != null) { parentMenuID = systemMenu.ParentMenuID.MenuID; } systemMenuServiceInstance.Delete(systemMenu); BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, parentMenuID.ToString()); this.lblMessage.Text = "删除菜单成功!"; } else { BindManageMenuTreeByApplicationIDAndSelectNodeID(this.ddlSelectApplication.SelectedValue, "0"); } } catch (Exception ex) { this.lblMessage.Text = "系统错误:" + ex.Message; this.btnSave.Disabled = true; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } HttpCookie u_cookie = Request.Cookies["LoginOk"]; HttpCookie r_cookie = Request.Cookies["RolesId"]; if ((Session["LoginOk"] == null || Session["RolesId"] == null) && (u_cookie == null || r_cookie == null)) { Response.Write("<script>alert('账号信息过期,请重新登入');location.href='../Login.aspx'</script>"); } else { int id = Request.Params["action"] == null ? 0 : int.Parse(Request.Params["action"]); var data = menuSvc.GetSystemMenuById(id); if (data == null) { Response.Write("<script>alert('查询的对象不存在');location.href='SystemMenuList.aspx'</script>"); } else { int rs = menuSvc.Delete(data); if (rs > 0) { Response.Write("<script>alert('删除成功');location.href='SystemMenuList.aspx'</script>"); } else { Response.Write("<script>alert('删除失败');location.href='SystemMenuList.aspx'</script>"); } } } }