예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //菜单栏目
            Johnny.CMS.BLL.SystemInfo.MenuCategory        category      = new Johnny.CMS.BLL.SystemInfo.MenuCategory();
            IList <Johnny.CMS.OM.SystemInfo.MenuCategory> categoryModel = category.GetList();

            //菜单
            Johnny.CMS.BLL.SystemInfo.Menu        menu      = new Johnny.CMS.BLL.SystemInfo.Menu();
            IList <Johnny.CMS.OM.SystemInfo.Menu> menuModel = menu.GetList(true);

            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();

            arrPermission = accounts.GetUserPermission(DataConvert.GetString(Session["UserName"]));

            //顶部菜单与菜单类别
            int iTopMenuId = DataConvert.GetInt32(Request.QueryString["TopMenuId"]);

            if (iTopMenuId <= 0)
            {
                iTopMenuId = 1;
            }
            Johnny.CMS.BLL.SystemInfo.TopMenuBinding        topMainMenu      = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding();
            IList <Johnny.CMS.OM.SystemInfo.TopMenuBinding> topMainMenuModel = topMainMenu.GetList(iTopMenuId);

            //生成左侧菜单导航栏
            foreach (Johnny.CMS.OM.SystemInfo.MenuCategory item in categoryModel)
            {
                if (CategoryContains(item.MenuCategoryId, topMainMenuModel))
                {
                    MainMenuItem mainmenu = new MainMenuItem();
                    mainmenu.Text = item.MenuCategoryName;

                    foreach (Johnny.CMS.OM.SystemInfo.Menu subitem in menuModel)
                    {
                        //判断是否属于该主菜单,并且具有访问权限
                        if (subitem.MenuCategoryId == item.MenuCategoryId && arrPermission.Contains(subitem.PermissionId))
                        {
                            SubMenuItem submenu = new SubMenuItem();
                            submenu.Text    = subitem.MenuName;
                            submenu.Url     = subitem.PageLink;
                            submenu.ToolTip = subitem.ToolTip;
                            submenu.Image   = subitem.Image;
                            mainmenu.SubItems.Add(submenu);
                        }
                    }

                    if (mainmenu.SubItems.Count > 0)
                    {
                        LeftMenu1.items.Add(mainmenu);
                    }
                }
            }
        }
예제 #2
0
        private bool CheckPermission(string currentPage)
        {
            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();

            arrPermission = accounts.GetUserPermission(Session["UserName"].ToString());

            //页面访问权限
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            int permission = menu.GetPermissionByPageLink(currentPage);

            return(arrPermission.Contains(permission));
        }
예제 #3
0
        private bool CheckPermission(string currentPage)
        {
            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();
            arrPermission = accounts.GetUserPermission(Session["UserName"].ToString());

            //页面访问权限
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            int permission = menu.GetPermissionByPageLink(currentPage);

            return arrPermission.Contains(permission);

        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //菜单栏目
            Johnny.CMS.BLL.SystemInfo.MenuCategory category = new Johnny.CMS.BLL.SystemInfo.MenuCategory();
            IList<Johnny.CMS.OM.SystemInfo.MenuCategory> categoryModel = category.GetList();

            //菜单
            Johnny.CMS.BLL.SystemInfo.Menu menu = new Johnny.CMS.BLL.SystemInfo.Menu();
            IList<Johnny.CMS.OM.SystemInfo.Menu> menuModel = menu.GetList(true);
                        
            //用户权限
            Johnny.CMS.BLL.Access.Accounts accounts = new Johnny.CMS.BLL.Access.Accounts();
            ArrayList arrPermission = new ArrayList();
            arrPermission = accounts.GetUserPermission(DataConvert.GetString(Session["UserName"]));

            //顶部菜单与菜单类别
            int iTopMenuId = DataConvert.GetInt32(Request.QueryString["TopMenuId"]);
            if (iTopMenuId <= 0)
                iTopMenuId = 1;
            Johnny.CMS.BLL.SystemInfo.TopMenuBinding topMainMenu = new Johnny.CMS.BLL.SystemInfo.TopMenuBinding();
            IList<Johnny.CMS.OM.SystemInfo.TopMenuBinding> topMainMenuModel = topMainMenu.GetList(iTopMenuId);

            //生成左侧菜单导航栏
            foreach (Johnny.CMS.OM.SystemInfo.MenuCategory item in categoryModel)
            {
                if (CategoryContains(item.MenuCategoryId, topMainMenuModel))
                {
                    MainMenuItem mainmenu = new MainMenuItem();
                    mainmenu.Text = item.MenuCategoryName;

                    foreach (Johnny.CMS.OM.SystemInfo.Menu subitem in menuModel)
                    {
                        //判断是否属于该主菜单,并且具有访问权限
                        if (subitem.MenuCategoryId == item.MenuCategoryId && arrPermission.Contains(subitem.PermissionId))
                        {
                            SubMenuItem submenu = new SubMenuItem();
                            submenu.Text = subitem.MenuName;
                            submenu.Url = subitem.PageLink;
                            submenu.ToolTip = subitem.ToolTip;
                            submenu.Image = subitem.Image;
                            mainmenu.SubItems.Add(submenu);
                        }
                    }

                    if (mainmenu.SubItems.Count > 0)
                        LeftMenu1.items.Add(mainmenu);
                }
            }
        }