示例#1
0
        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
            {
                ParentTitleBind();
                //下面我们开始做页面内容绑定
                int id = Request.Params["action"] == null ? 0 : int.Parse(Request.Params["action"]);

                var model = menuSvc.GetSystemMenuById(id);
                if (model == null)
                {
                    Response.Write("<script>alert('查询的对象不存在');location.href='SystemMenuList.aspx'</script>");
                }
                else
                {
                    this.MenuId.Text    = model.Id.ToString();
                    this.MenuTitle.Text = model.Title;
                    this.MenuLink.Text  = model.Link;
                    //下拉列表怎么做啊
                    if (model.ParentId == 0) //这种情况是一级菜单
                    {
                        this.ddlLevel.SelectedIndex = 0;
                        this.ddlParentTitle.Visible = false;
                        this.ddlSonTitle.Visible    = false;
                    }
                    else //这个里面指定的是不是一级菜单的情况
                    {
                        var parent = menuSvc.GetSystemMenuById(model.ParentId);
                        if (parent.ParentId == 0) //这种情况是指二级菜单
                        {
                            this.ddlLevel.SelectedIndex       = 1;
                            this.ddlParentTitle.Visible       = true;
                            this.ddlParentTitle.SelectedValue = parent.Id.ToString();
                            this.ddlSonTitle.Visible          = false;
                        }
                        else //这种情况指三级菜单
                        {
                            this.ddlLevel.SelectedIndex       = 2;
                            this.ddlParentTitle.Visible       = true;
                            this.ddlSonTitle.Visible          = true;
                            this.ddlParentTitle.SelectedValue = parent.ParentId.ToString();
                            SonTitleBind(parent.ParentId);
                            this.ddlSonTitle.SelectedValue = parent.Id.ToString();
                        }
                    }
                }
            }
        }
示例#2
0
        public string GetSystemMenuTitle(int pid)
        {
            if (pid == 0)
            {
                return("一级菜单");
            }
            var data = menuSvc.GetSystemMenuById(pid);

            return(data.Title);
        }
        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>");
                    }
                }
            }
        }
        public string GetSystemMenuTitle(int id)
        {
            var data = menuSvc.GetSystemMenuById(id);

            return(data.Title);
        }