Esempio n. 1
0
        /// <summary>
        /// 搜索根结点
        /// </summary>
        public void RootSearch()
        {
            this.isInit = true;
            this.tree_Template.Nodes.Clear();
            NewMReporttemp           = null;
            CopyMReporttemp          = null;
            this.cmb_Part.DataSource = null;
            GetTreeNode gettreenode = new GetTreeNode(addTreeNode);
            //string sql = "select * from report_template_dict where EXAM_CLASS  = '" + GetConfig.RS_TempExamClass + "' " +
            //    "and (IS_PRIVATE = 0 or (IS_PRIVATE =1 and DOCTOR_ID = '" + ((SIS_Model.MUser)frmMainForm.iUser).DOCTOR_ID + "')) order by SORT_FLAG asc,NODE_ID asc";
            string sql = "select * from report_template_dict where(EXAM_CLASS  = '" + GetConfig.RS_TempExamClass + "' " +
                         " and IS_PRIVATE=0) or (IS_PRIVATE =1 and DOCTOR_ID = '" + ((SIS_Model.MUser)frmMainForm.iUser).DOCTOR_ID + "') order by SORT_FLAG asc,NODE_ID asc"; //可实现跨科显示个人模板

            rootDs = BReportTemp.GetTable(sql);                                                                                                                               // this.operate.getDataSet(, this.conn);

            DataRow[] dr     = rootDs.Tables[0].Select("NODE_PARENT_ID = 0 ");
            DataSet   dsRoot = new DataSet();

            dsRoot.Merge(dr);
            if (dsRoot.Tables.Count > 0)
            {
                TreeNode[] RootTree = new TreeNode[dsRoot.Tables[0].Rows.Count];
                for (int i = 0; i < dsRoot.Tables[0].Rows.Count; i++)
                {
                    RootTree[i]      = new TreeNode(dsRoot.Tables[0].Rows[i]["NODE_NAME"].ToString().Trim());
                    RootTree[i].Name = dsRoot.Tables[0].Rows[i]["NODE_ID"].ToString().Trim();
                    this.searchNode(dsRoot.Tables[0].Rows[i]["NODE_ID"].ToString().Trim(), RootTree[i]);
                }
                this.tree_Template.BeginInvoke(gettreenode, new object[] { RootTree, false });
                DataRow newdr = dsRoot.Tables[0].NewRow();
                dsRoot.Tables[0].Rows.InsertAt(newdr, 0);
                this.cmb_Part.DataSource    = dsRoot.Tables[0];
                this.cmb_Part.DisplayMember = "NODE_NAME";
                this.cmb_Part.ValueMember   = "NODE_ID";
            }
            else
            {
                TreeNode[] RootTree = new TreeNode[1];
                MReporttemp                = new MReportTempDict();
                MReporttemp.EXAM_CLASS     = GetConfig.RS_TempExamClass;
                MReporttemp.IS_PRIVATE     = 0;
                MReporttemp.NODE_DEPICT    = "";
                MReporttemp.NODE_ID        = Convert.ToInt32(ID.GetSeqValue());
                MReporttemp.NODE_NAME      = "新增部位分类";
                MReporttemp.NODE_PARENT_ID = 0;
                MReporttemp.NODE_SIGN      = "P";
                BReportTemp.Add(MReporttemp);
                RootTree[0]      = new TreeNode(MReporttemp.NODE_NAME);
                RootTree[0].Name = MReporttemp.NODE_ID.ToString();
                this.tree_Template.BeginInvoke(gettreenode, new object[] { RootTree, false });
            }
            this.isInit = false;
        }
Esempio n. 2
0
        private void cmb_Part_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.isInit || this.cmb_Part.SelectedItem == null)
            {
                return;
            }
            this.tree_Template.Nodes.Clear();
            NewMReporttemp  = null;
            CopyMReporttemp = null;
            GetTreeNode gettreenode = new GetTreeNode(addTreeNode);

            System.Data.DataRow cmbdr = (cmb_Part.SelectedItem as System.Data.DataRowView).Row;
            DataRow[]           dr;
            if (cmbdr["NODE_ID"].ToString() == "")
            {
                dr = rootDs.Tables[0].Select("NODE_PARENT_ID = 0 ");
            }
            else
            {
                dr = rootDs.Tables[0].Select("NODE_PARENT_ID = " + cmbdr["NODE_ID"].ToString());
            }
            DataSet dsRoot = new DataSet();

            dsRoot.Merge(dr);
            List <TreeNode> RootTree = new List <TreeNode>();

            if (dsRoot.Tables.Count > 0)
            {
                for (int i = 0; i < dsRoot.Tables[0].Rows.Count; i++)
                {
                    RootTree.Add(new TreeNode(dsRoot.Tables[0].Rows[i]["NODE_NAME"].ToString().Trim()));
                    RootTree[i].Name = dsRoot.Tables[0].Rows[i]["NODE_ID"].ToString().Trim();
                    this.searchNode(dsRoot.Tables[0].Rows[i]["NODE_ID"].ToString().Trim(), RootTree[i]);
                }
            }
            this.tree_Template.BeginInvoke(gettreenode, new object[] { RootTree.ToArray(), false });
        }