⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resourcesbll.cs

📁 通用权限管理平台
💻 CS
字号:
//----------------------------------------------------------------
// <copyright file="ResourcesBLL.cs" >
//    Copyright (c) Wenzy , All rights reserved.
//    author:温正宇 E-Mail:wenzy@tom.com MyBlog:wenzy.cnblogs.com
//    All rights reserved.
// </copyright>
//----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Data;
using MemberShipDAL.DataObject;

namespace WMFConfig.Bussiness
{
    class ResourcesBLL
    {
        /// <summary>
        /// 绑定资源树,递归算法
        /// </summary>
        /// <param name="trv_Resources"></param>
        public bool ResourcesTreeBind(string parentId, TreeNode pNode, DataTable dsResources, TreeView trv_Resources)
        {
            DataView dvTree = new DataView(dsResources);

            if (parentId != "")
            {
                dvTree.RowFilter = "[ParentId] ='" + parentId + "'";
            }
            else
            {
                dvTree.RowFilter = "[ParentId] is null";
            }

            foreach (DataRowView row in dvTree)
            {
                TreeNode tn = new TreeNode();
                tn.Name = row["ResourceGroupId"].ToString();
                tn.Text = row["ResourcesGroupName"].ToString();
                tn.ToolTipText = row["Description"].ToString();
                
                if (pNode == null)
                {
                    trv_Resources.Nodes.Add(tn);
                    trv_Resources.SelectedNode = tn;
                    ResourcesTreeBind(row["ResourceGroupId"].ToString(), tn, dsResources, trv_Resources);
                }
                else
                {
                    pNode.Nodes.Add(tn);
                    ResourcesTreeBind(row["ResourceGroupId"].ToString(), tn, dsResources, trv_Resources);
                }
            }
            return true;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -