Esempio n. 1
0
        public static string GetLeftMenuInfo(string firstNode)
        {
            DataTable   MenuInfo       = new DataTable();
            int         roldId         = ManagerHelper.GetCurrentManager().RoleId;
            ManagerInfo currentManager = ManagerHelper.GetCurrentManager();

            if (currentManager.UserName.ToString() != "yihui")
            {
                MenuInfo = AdminMenuHelper.GetCurrentRoleMenuInfo(roldId);
            }
            else
            {
                MenuInfo = AdminMenuHelper.GetAllAdminMenus();
            }
            string json = "";

            DataRow[] rows = MenuInfo.Select(string.Format("Layout like '{0}%'", firstNode));
            foreach (DataRow row in rows)
            {
                var url    = string.Empty;
                var layout = row["layout"].ToString();
                if (layout.Length <= 4 && currentManager.UserName != "yihui")//如果当前是一二级菜单,则获取权限内的第一个三级菜单地址
                {
                    url = ManagerHelper.GetFirstRoleUrl(roldId, layout);
                }
                else
                {
                    url = row["MIUrl"].ToString();
                }
                json += string.Format("DataID=\"{0}\",Title=\"{1}\",Link=\"{2}\",Layout=\"{3}\",IconLink=\"{4}\";", row["MIID"], row["MIName"], /*row["MIUrl"]*/ url, row["Layout"], row["IconLink"]);
            }
            return(json);
        }
Esempio n. 2
0
 private void BindData()
 {
     allMenus = AdminMenuHelper.GetAllAdminMenus();//获取所有菜单信息
     allMenuList.DataSource = allMenus;
     allMenuList.DataBind();
     allMenus.PrimaryKey   = new DataColumn[] { allMenus.Columns["MIID"] };
     ViewState["allMenus"] = allMenus;
 }
Esempio n. 3
0
        private void BindData()
        {
            //绑定当前用户名
            litManagerName.Text = currentManager.UserName;
            DataTable MenuInfo = new DataTable();

            if (litManagerName.Text != "yihui")
            {
                MenuInfo = AdminMenuHelper.GetCurrentRoleMenuInfo(ManagerHelper.GetCurrentManager().RoleId);
            }
            else
            {
                MenuInfo = AdminMenuHelper.GetAllAdminMenus();
            }
            //动态绑定当前角色的导航菜单
            for (int i = 0; i < MenuInfo.Rows.Count; i++)
            {
                if (MenuInfo.Rows[i]["Layout"].ToString().Length == 2)//只有是一级菜单才能添加
                {
                    this.litMenuBanner.Text += string.Format("<a onclick=\"ShowMenuLeft('{0}','{1}',null)\">{2}</a>", MenuInfo.Rows[i]["Layout"], MenuInfo.Rows[i]["MIurl"], MenuInfo.Rows[i]["MIName"]);
                }
            }
        }