예제 #1
0
        /// <summary>
        /// 得到系统菜单
        /// </summary>
        /// <returns></returns>
        public string GetSysMenuString()
        {
            Ctrl_Sys_Menu dacMenu = new Ctrl_Sys_Menu();

            string sMenu = "";
            sMenu += "<script type='text/javascript'>";
            sMenu += " d = new dTree('d');";
            sMenu += "  d.config.check=true;";
            sMenu += " d.config.useCookies=false;";
            sMenu += " d.add(0, -1, '功能菜单','#','功能菜单');";

            DataSet ds = dacMenu.GetList("");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {

                sMenu += "d.add(" +
                    ds.Tables[0].Rows[i]["Id"].ToString() + "," +
                    ds.Tables[0].Rows[i]["ParentId"].ToString() + ",'" +
                    ds.Tables[0].Rows[i]["MenuName"].ToString() + "','" +
                    "#" + "','" +
                       ds.Tables[0].Rows[i]["MenuName"].ToString() +
                    "');";

            }

            sMenu += "document.write(d);";
            sMenu += "d.setCheckNodeIds('" + dacRoleInfo.GetRoleMenu(int.Parse(hdRoleId.Value)) + "');";
            sMenu += "</script>";

            return sMenu;
        }
예제 #2
0
파일: MasterPage.cs 프로젝트: wawa0210/jgq
 protected override void OnInit(EventArgs e)
 {
     string url = GetRequestUrl();
     if (Session["UserName"] == null || string.IsNullOrEmpty(Session["UserName"].ToString()))
     {
         //MessageBox.ShowAndRedirect(this, "您还没有登录,请登录后操作!", ServerInfo.GetRootURI() + "/SysAdmin/login.aspx");
         HttpContext.Current.Response.Redirect(ServerInfo.GetRootURI() + "/login.aspx");
     }
     else
     {
         Ctrl_Sys_Menu ctrl_menu = new Ctrl_Sys_Menu();
         if (ctrl_menu.GetList("MenuLinkRoute='" + url + "'").Tables[0].Rows.Count > 0)
         {
             List<DataRow> drList = ctrl_menu.GetRoleMenu(int.Parse(Session["RoleId"].ToString())).Tables[0].AsEnumerable()
                   .Where((dr) => dr["MenuLinkRoute"].ToString() == url).ToList();
             if (drList.Count <= 0)
             {
                 HttpContext.Current.Response.Redirect(ServerInfo.GetRootURI() + "/Pages/NoEnoughRightPage.aspx");
             }
         }
         else
         {
             HttpContext.Current.Response.Redirect(ServerInfo.GetRootURI() + "/Pages/NoEnoughRightPage.aspx");
         }
     }
     base.OnInit(e);
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string Url = Request.QueryString["aspxerrorpath"];
     Ctrl_Sys_Menu ctrl_menu = new Ctrl_Sys_Menu();
     try
     {
         lbUrl.Text = ctrl_menu.GetList("MenuLinkRoute='" + Url + "'").Tables[0].Rows[0]["MenuName"].ToString();
     }
     catch (Exception error)
     {
         lbUrl.Text = "未捕获错误页信息!";
         throw error;
     }
 }
예제 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Ctrl_Sys_Menu dacMenuInfo = new Ctrl_Sys_Menu();

            int iMenuId = int.Parse(hdMenuId.Value.ToString());
            SysMenuEntity menuEntity = new SysMenuEntity();
            menuEntity.menuID = iMenuId;
            menuEntity.menuLinkRoute = txtLinkRoute.Text;
            menuEntity.menuName = txtMenuName.Text;
            menuEntity.menuTarget = txtShowTarget.Text;
            menuEntity.parentID = int.Parse(drpParentMenu.SelectedValue);

            if (hdMenuId.Value == "0")
            {
                if (dacMenuInfo.Add(menuEntity) > 0)
                {
                    MessageBox.ShowAndRedirect(this, "成功添加一条数据!", "MenuInfoList.aspx");
                }
                else
                {
                    MessageBox.Show(this, "添加数据失败,请与管理员联系!");
                }
            }
            else
            {
                if (drpParentMenu.SelectedValue == hdMenuId.Value)
                {
                    MessageBox.Show(this, "不允许选择自身,自为父菜单!");
                }

                if (dacMenuInfo.Update(menuEntity))
                {
                    MessageBox.ShowAndRedirect(this, "成功修改一条数据!", "MenuInfoList.aspx");
                }
                else
                {
                    MessageBox.Show(this, "修改数据失败,请与管理员联系!");
                }
            }
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = GetTitle();
            if (!IsPostBack)
            {
                Ctrl_Sys_Menu dacMenuInfo = new Ctrl_Sys_Menu();
                DataSet ds = dacMenuInfo.GetList("");
                drpParentMenu.Items.Add(new ListItem("做为顶级菜单", "0"));
                BindMenuDropList(0, 1, ds.Tables[0].AsEnumerable().ToList());

                if (Request.QueryString["action"].ToString() == "add")
                {
                    // txtOperAction.InnerText = "添加菜单信息";
                }
                else if (Request.QueryString["action"].ToString() == "edit")
                {
                    //txtOperAction.InnerText = "修改菜单信息";
                    hdMenuId.Value = Request.QueryString["MenuId"];
                    this.BindControlData();//调用公共函数
                }
            }
        }
예제 #6
0
        private void BindControlData()
        {
            int iMenuId = int.Parse(hdMenuId.Value);

            Ctrl_Sys_Menu dacMenuInfo = new Ctrl_Sys_Menu();
            SysMenuEntity menuEntity = dacMenuInfo.GetModel(iMenuId);
            txtMenuName.Text = menuEntity.menuName;
            txtLinkRoute.Text = menuEntity.menuLinkRoute;
            txtShowTarget.Text = menuEntity.menuTarget;
            drpParentMenu.SelectedValue = menuEntity.parentID.ToString();
        }