예제 #1
0
        /// <summary>
        /// 加载下一级节点
        /// </summary>
        /// <param name="node">父节点</param>
        private void AddDirs(TreeNode node)
        {
            try
            {
                string strNodeId = node.Name;
                string sqlDir    = string.Format("SELECT * FROM TTree WHERE parentId={0}  ORDER BY Turn ASC", strNodeId);

                //OleDbParameter[] ArrPara = new OleDbParameter[1];
                //OleDbParameter p1 = new OleDbParameter("@parentId", OleDbType.Integer);
                //p1.Value =Int32.Parse(strNodeId);
                //ArrPara[0] = p1;
                DataTable TbDir = GetTable(sqlDir);

                int DirCount = TbDir.Rows.Count;

                string name, text;

                //加载
                //for (int i = 0; i < DirCount; i++)
                //{
                //    DataRow dr = TbDir.Rows[i];
                //    name = dr["NodeId"].ToString();
                //    text = dr["Title"].ToString();
                //    DirNode tempNode = new DirNode(text);
                //    tempNode.Name = name;
                //    node.Nodes.Add(tempNode);
                //}

                foreach (DataRow dr in TbDir.Rows)
                {
                    name = dr["NodeId"].ToString();
                    text = dr["Title"].ToString();
                    DirNode tempNode = new DirNode(text);
                    tempNode.Name = name;
                    node.Nodes.Add(tempNode);
                }
            }
            catch
            {
            }
        }
예제 #2
0
 private void AddSubDirs(DirNode node)
 {
     for (int i = 0; i < node.Nodes.Count; i++)
     {
         AddDirs(node.Nodes[i]);
     }
     node.SubDirectoriesAdded = true;
 }
예제 #3
0
 /// <summary>
 /// 初始化树,第一次加载绑定第一层子节点(无parentid)及孙节点(两层)
 /// 在展开节点之前再延迟加载节点
 /// </summary>
 private void iniTree()
 {
     string SQL = "SELECT * FROM TTree WHERE parentId=0 ORDER BY Turn ASC";
     DataTable RootTb = GetTable(SQL);
     int iLength = RootTb.Rows.Count;
     for (int i = 0; i < iLength; i++)
     {
         DirNode root = new DirNode(RootTb.Rows[i]["Title"].ToString());
         root.Name = RootTb.Rows[i]["NodeId"].ToString();
         treeViewDir.Nodes.Add(root);
         AddDirs(root);
     }
 }
예제 #4
0
        /// <summary>
        /// 加载下一级节点
        /// </summary>
        /// <param name="node">父节点</param>
        private void AddDirs(TreeNode node)
        {
            try
            {
                string strNodeId = node.Name;
                string sqlDir = string.Format("SELECT * FROM TTree WHERE parentId={0}  ORDER BY Turn ASC", strNodeId);

                //OleDbParameter[] ArrPara = new OleDbParameter[1];
                //OleDbParameter p1 = new OleDbParameter("@parentId", OleDbType.Integer);
                //p1.Value =Int32.Parse(strNodeId);
                //ArrPara[0] = p1;
                DataTable TbDir = GetTable(sqlDir);

                int DirCount = TbDir.Rows.Count;

                string name, text;

                //加载
                //for (int i = 0; i < DirCount; i++)
                //{
                //    DataRow dr = TbDir.Rows[i];
                //    name = dr["NodeId"].ToString();
                //    text = dr["Title"].ToString();
                //    DirNode tempNode = new DirNode(text);
                //    tempNode.Name = name;
                //    node.Nodes.Add(tempNode);
                //}

                foreach (DataRow dr in TbDir.Rows)
                {
                    name = dr["NodeId"].ToString();
                    text = dr["Title"].ToString();
                    DirNode tempNode = new DirNode(text);
                    tempNode.Name = name;
                    node.Nodes.Add(tempNode);
                }
            }
            catch
            {
            }
        }