Esempio 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]);
        }
        /// <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);
                }
            }
        }