Пример #1
2
        /// <summary>
        /// 功能菜单树节点赋值
        /// </summary>
        /// <param name="list"></param>
        /// <param name="tree"></param>
        /// <param name="expandFunctionType"></param>
        public static void FillData(List <SysFunction> list, UltraTree tree, string expandFunctionType)
        {
            UltraTreeNode       node  = null;
            TreeNodesCollection nodes = tree.Nodes;

            nodes.Clear();
            //获取根节点(代表系统)
            List <SysFunction> sysFunctions = list.FindAll(f => string.IsNullOrEmpty(f.ParentId));

            foreach (SysFunction sysFun in sysFunctions)
            {
                node      = new UltraTreeNode();
                node.Key  = sysFun.FunctionId;
                node.Text = sysFun.FunctionName;
                node.Tag  = sysFun;
                if (String.Compare(expandFunctionType, sysFun.FunctionType) > 0)
                {
                    node.Expanded = true;
                }
                if (!String.IsNullOrEmpty(sysFun.Image))
                {
                    node.LeftImages.Add(Image.FromFile("./resource/image/mainMenu/" + sysFun.Image + ".png"));
                }
                nodes.Add(node);

                FillData(list, node, expandFunctionType);
            }
        }
Пример #2
0
        /// <summary>
        /// 组织结构树节点赋值
        /// </summary>
        /// <param name="list"></param>
        /// <param name="tree"></param>
        /// <param name="expandFunctionType"></param>
        public static void FillData(List <SysOrganization> list, TreeNodesCollection nodes, string expandOrgType, bool showIcon)
        {
            UltraTreeNode node = null;

            nodes.Clear();

            //获取最高组织节点
            List <SysOrganization> orgList = list.FindAll(o => string.IsNullOrEmpty(o.ParentId));

            foreach (SysOrganization org in orgList)
            {
                node      = new UltraTreeNode();
                node.Key  = org.OrganizationId;
                node.Text = GetOrgTreeNodeText(org);
                node.Tag  = org;
                if (String.Compare(expandOrgType, org.OrganizationType) > 0)
                {
                    node.Expanded = true;
                }
                if (showIcon)
                {
                    node.LeftImages.Add(GetImage(org.OrganizationType));
                }
                nodes.Add(node);

                FillData(list, node, expandOrgType, showIcon);
            }
        }
Пример #3
0
        /// <summary>
        /// 角色树节点赋值
        /// </summary>
        /// <param name="list"></param>
        /// <param name="tree"></param>
        /// <param name="expandFunctionType"></param>
        public static void FillData(List <SysRole> list, UltraTree tree)
        {
            UltraTreeNode       node  = null;
            TreeNodesCollection nodes = tree.Nodes;

            nodes.Clear();

            List <SysRole> roleList = list.FindAll(o => string.IsNullOrEmpty(o.ParentId));

            foreach (SysRole role in roleList)
            {
                node      = new UltraTreeNode();
                node.Key  = role.RoleId;
                node.Text = role.RoleName;
                node.Tag  = role;
                nodes.Add(node);

                FillData(list, node);
            }
        }