コード例 #1
0
        private void BindExamClassData()
        {
            DataTable dtClass = _eim.GetExamClass(_imgKind);

            if (dtClass.Rows.Count <= 0)
            {
                return;
            }

            DataRow[] drRoots = dtClass.Select("上级分类ID is null or 上级分类ID=''");


            foreach (DataRow drRoot in drRoots)
            {
                TreeNode rootNode = null;

                ExamClassData classData = new ExamClassData();
                classData.BindRowData(drRoot);

                rootNode = treeView1.Nodes.Add(classData.项目分类ID, classData.分类名称, 0);

                rootNode.SelectedImageIndex = 0;
                rootNode.Tag = classData;

                //rootNode.Nodes.Add("TMP" + classData.项目分类ID, "TMP");


                if (rootNode == null)
                {
                    continue;
                }

                BindSubNode(rootNode, dtClass);

                BindClassItem(rootNode);

                if (rootNode.Nodes.Count <= 0)
                {
                    rootNode.Remove();
                }
                else
                {
                    rootNode.Expand();
                }

                ////绑定当前分类及下一级分类的检查项目
                //BindClassItem(rootNode);

                //foreach (TreeNode tnSub in rootNode.Nodes)
                //{
                //    BindClassItem(tnSub);
                //}
            }

            if (treeView1.Nodes.Count <= 0)
            {
                MessageBox.Show("未发现可供模板关联的检查项目,请确认检查项目是否已关联其他模板。", "提示");
            }
        }
コード例 #2
0
        /// <summary>
        /// 绑定检查分类数据
        /// </summary>
        private void BindExamClassData()
        {
            trvItems.Nodes.Clear();

            DataTable dtClass = _eiModel.GetExamClass(cbxModality.Text);

            if (dtClass.Rows.Count <= 0)
            {
                return;
            }

            DataRow[] drRoots = dtClass.Select("上级分类ID is null or 上级分类ID=''");

            foreach (DataRow drRoot in drRoots)
            {
                TreeNode rootNode = null;

                ExamClassData classData = new ExamClassData();
                classData.BindRowData(drRoot);

                rootNode = trvItems.Nodes.Add(classData.项目分类ID, classData.分类名称, 0);

                rootNode.SelectedImageIndex = 0;
                rootNode.Tag = classData;

                rootNode.Nodes.Add("TMP" + classData.项目分类ID, "TMP");

                if (rootNode == null)
                {
                    continue;
                }

                BindSubNode(rootNode, dtClass);

                //绑定当前分类及下一级分类的检查项目
                BindClassItem(rootNode);

                foreach (TreeNode tnSub in rootNode.Nodes)
                {
                    BindClassItem(tnSub);
                }
            }
        }