コード例 #1
0
        /// <summary>
        /// 创建树
        /// edit 王冀 2012-10-30
        /// </summary>
        private void MakeTree()
        {
            try
            {
                DataTable rootDrug;
                //DataTable secordDrug;
                //DataTable drug;
                m_HaveBindNode.Clear();//已绑定节点 清空 王冀 2012-10-30
                treeList_Medicine.ClearNodes();
                rootDrug = m_SqlManger.GetMedicineTreeOne();
                MakeTreeone(rootDrug);
            }
            catch (Exception ex)
            {
                MyMessageBox.Show(1, ex);
            }

            #region 已注释 王冀 2012-10-30
            ////第一级
            //foreach (DataRow dr in rootDrug.Rows)
            //{

            //    TreeListNode parentNode = null;//
            //    parentNode = treeList_Medicine.AppendNode(new object[] { dr["categorytwo"].ToString(), "Folder", dr["categorytwo"].ToString() }, null);
            //    m_HaveBindNode.Add(dr["categorytwo"].ToString());
            //    secordDrug = m_SqlManger.GetMedicaineTreeSec(dr["categorytwo"].ToString());

            //    MakeTreetwo(secordDrug, parentNode);
            //    ////第二级
            //    //foreach (DataRow secdr in secordDrug.Rows)
            //    //{
            //    //    TreeListNode node = null;//
            //    //    node = treeList_Medicine.AppendNode(new object[] { secdr["categorythree"].ToString(), "Folder", secdr["categorythree"].ToString() }, parentNode);
            //    //    m_HaveBindNode.Add(secdr["categorythree"].ToString());
            //    //    drug = m_SqlManger.GetMedicaineByThreeName(secdr["categorythree"].ToString());

            //    //    foreach (DataRow threedr in drug.Rows)
            //    //    {
            //    //        TreeListNode threenode = null;//
            //    //        threenode = treeList_Medicine.AppendNode(new object[] { threedr["Name"].ToString(), "Leaf", threedr["ID"].ToString() }, node);
            //    //        m_HaveBindNode.Add(threedr["ID"].ToString());
            //    //        threenode.Tag = threedr["id"].ToString();
            //    //    }
            //    //}

            //}
            #endregion
        }
コード例 #2
0
        private void MakeTree()
        {
            DataTable rootDrug;
            DataTable secordDrug;
            DataTable drug;

            rootDrug = m_SqlManger.GetMedicineTreeOne();

            //第一级
            foreach (DataRow dr in rootDrug.Rows)
            {
                TreeListNode parentNode = null;//
                parentNode = treeList_Medicine.AppendNode(new object[] { dr["categorytwo"].ToString(), dr["categorytwo"].ToString() }, null);

                secordDrug = m_SqlManger.GetMedicaineTreeSec(dr["categorytwo"].ToString());

                //第二级
                foreach (DataRow secdr in secordDrug.Rows)
                {
                    TreeListNode node = null;//
                    node = treeList_Medicine.AppendNode(new object[] { secdr["categorythree"].ToString(), secdr["categorythree"].ToString() }, parentNode);

                    drug = m_SqlManger.GetMedicaineByThreeName(secdr["categorythree"].ToString());

                    foreach (DataRow threedr in drug.Rows)
                    {
                        TreeListNode threenode = null;//
                        threenode     = treeList_Medicine.AppendNode(new object[] { threedr["Name"].ToString(), threedr["ID"].ToString() }, node);
                        threenode.Tag = threedr["id"].ToString();
                    }
                }
            }
        }