Ejemplo n.º 1
0
        /// <summary>
        /// 初始化菜单树
        /// </summary>
        private void Init_TreeViewMenu()
        {
            return;

            int parentID = 0;

            List <Menus> lsMenus = _menusBll.GetModel(_menuTypeID, parentID);

            if (lsMenus == null || lsMenus.Count == 0)
            {
                //异常
                return;
            }

            TreeNode node = null;

            for (int i = 0; i < lsMenus.Count; i++)
            {
                //判断是否有权限
                if (_dicRoleMenus.ContainsKey(lsMenus[i].MenuID))
                {
                    node      = new TreeNode();
                    node.Text = lsMenus[i].MenuName;
                    node.Name = lsMenus[i].MenuPath;
                    node.Tag  = lsMenus[i];

                    treeView_Menu.Nodes.Add(node);

                    GetChildNodes(node, lsMenus[i].MenuID);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加角色子节点
        /// </summary>
        /// <param name="node"></param>
        /// <param name="menuTypeID"></param>
        /// <param name="parentID"></param>
        private void GetMenusChildNodes(TreeNode parentNode, int menuTypeID, int parentID)
        {
            List <Menus> lsRoles = _menusBll.GetModel(menuTypeID, parentID);

            TreeNode node = null;

            for (int i = 0; i < lsRoles.Count; i++)
            {
                node      = new TreeNode();
                node.Text = lsRoles[i].MenuName;
                node.Tag  = lsRoles[i];

                parentNode.Nodes.Add(node);

                GetRolesChildNodes(node, menuTypeID, lsRoles[i].MenuID);
            }
        }