Exemplo n.º 1
0
        /// <summary>
        /// 绑定当前分类及下一级分类的检查项目
        /// </summary>
        /// <param name="tnClass"></param>
        private void BindClassItem(TreeNode tnClass)
        {
            if (tnClass == null)
            {
                return;
            }

            ExamClassData classData = tnClass.Tag as ExamClassData;

            if (classData == null)
            {
                return;
            }

            TreeNode[] tmpNodes = tnClass.Nodes.Find("TMP" + classData.项目分类ID, false);
            if (tmpNodes.Length <= 0)
            {
                return;
            }

            DataTable dtItem = _eiModel.GetExamItemByClass(classData.项目分类ID);

            foreach (DataRow dr in dtItem.Rows)
            {
                ExamItemData itemData = new ExamItemData();
                itemData.BindRowData(dr);

                TreeNode tnItem = tnClass.Nodes.Add(itemData.项目ID, itemData.项目名称, 1);
                tnItem.SelectedImageIndex = 1;
                tnItem.Tag = itemData;
            }
            tnClass.Nodes.Remove(tmpNodes[0]);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定子节点
        /// </summary>
        /// <param name="pNode"></param>
        /// <param name="dtClass"></param>
        private void BindSubNode(TreeNode pNode, DataTable dtClass)
        {
            if (pNode == null || dtClass == null)
            {
                return;
            }

            ExamClassData pClassData = pNode.Tag as ExamClassData;

            DataRow[] drSubs = dtClass.Select("上级分类ID='" + pClassData.项目分类ID + "'");

            if (drSubs.Length <= 0)
            {
                return;
            }

            foreach (DataRow drCur in drSubs)
            {
                ExamClassData subClassData = new ExamClassData();
                subClassData.BindRowData(drCur);

                TreeNode tnSub = pNode.Nodes.Add(subClassData.项目分类ID, subClassData.分类名称, 0);
                tnSub.SelectedImageIndex = 0;
                tnSub.Tag = subClassData;

                tnSub.Nodes.Add("TMP" + subClassData.项目分类ID, "TMP");

                BindSubNode(tnSub, dtClass);
            }
        }
        /// <summary>
        /// 绑定分类项目
        /// </summary>
        private void BindClassItem(TreeNode tnClass)
        {
            if (tnClass == null)
            {
                return;
            }


            ExamClassData classData = tnClass.Tag as ExamClassData;

            if (classData == null)
            {
                return;
            }

            DataTable dtItem = _eim.GetExamItemByClass(classData.项目分类ID);

            foreach (DataRow dr in dtItem.Rows)
            {
                ExamItemData itemData = new ExamItemData();
                itemData.BindRowData(dr);

                if (AllowReleation(itemData.项目ID))
                {
                    TreeNode tnItem = tnClass.Nodes.Add(itemData.项目ID, itemData.项目名称, 1);
                    tnItem.SelectedImageIndex = 1;
                    tnItem.Tag = itemData;

                    tnItem.Checked = IsChecked(itemData.项目ID);
                }
            }
        }
        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("未发现可供模板关联的检查项目,请确认检查项目是否已关联其他模板。", "提示");
            }
        }
Exemplo n.º 5
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);
                }
            }
        }