private void AddTree(string flocode, string ksdm)
        {
            TreeDept.Nodes.Clear();
            TreeXm.Nodes.Clear();

            string ssql = "";

            if (ksdm != "0")
            {
                ssql = "select dept_id,a.name ,b.name zdymc   from jc_dept_property a   left join (select * from jc_bb_ksmx a     " +
                       " inner join JC_BB_KSMC b on a.zdyksdm=b.code and b.fl_code='" + flocode +
                       "') b on a.dept_id=b.yyksdm    ";
                ssql = ssql + " where (case when b.code is null then a.dept_id else 999+b.pxxh end)='" + ksdm + "'"; //Modify By Zj 2012-08-08 存储过程里面是加PXXH现修改程序也加pxxh 原为code
            }
            else
            {
                ssql = "select 0 dept_id,'未确认科室' as name,'未确认科室' zdymc ";
            }

            DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql);

            System.Windows.Forms.TreeNode tnTopDept = new System.Windows.Forms.TreeNode();
            tnTopDept.Text = Convertor.IsNull(tb.Rows[0]["zdymc"], "");
            tnTopDept.Tag  = 0;

            tnTopDept.Checked = true;
            for (int i = 0; i <= tb.Rows.Count - 1; i++)
            {
                System.Windows.Forms.TreeNode tnDept = new System.Windows.Forms.TreeNode();
                tnDept.Text    = Convertor.IsNull(tb.Rows[i]["name"], "");
                tnDept.Tag     = Convertor.IsNull(tb.Rows[i]["dept_id"], "");
                tnDept.Checked = true;
                tnTopDept.Nodes.Add(tnDept);
            }
            TreeDept.Nodes.Add(tnTopDept);
            TreeDept.ExpandAll();



            ssql = "select * from jc_stat_item order by code";
            DataTable tab = InstanceForm.BDatabase.GetDataTable(ssql);

            System.Windows.Forms.TreeNode tnTopXM = new System.Windows.Forms.TreeNode();
            tnTopXM.Text = "统计大项目分类";
            tnTopXM.Tag  = 0;
            for (int i = 0; i <= tab.Rows.Count - 1; i++)
            {
                System.Windows.Forms.TreeNode tnTopXM_C = new System.Windows.Forms.TreeNode();
                tnTopXM_C.Text = Convertor.IsNull(tab.Rows[i]["item_name"], "");
                tnTopXM_C.Tag  = Convertor.IsNull(tab.Rows[i]["code"], "");
                tnTopXM.Nodes.Add(tnTopXM_C);
            }
            TreeXm.Nodes.Add(tnTopXM);
            TreeXm.ExpandAll();
        }
Exemplo n.º 2
0
        private void LoadTree(string deptId)
        {
            TreeDept.Nodes.Clear();
            TreeXm.Nodes.Clear();
            string sSql = "";

            if (deptId != "0")
            {
                sSql = " SELECT DEPT_ID,NAME FROM JC_DEPT_PROPERTY WHERE DEPT_ID = '" + deptId + "'";
            }
            else
            {
                sSql = " SELECT 0 DEPT_ID,'未确认科室' NAME ";
            }
            DataTable tb        = InstanceForm.BDatabase.GetDataTable(sSql);
            TreeNode  tnTopDept = new TreeNode();

            tnTopDept.Text = "所有科室";
            tnTopDept.Tag  = 0;

            tnTopDept.Checked = true;
            for (int i = 0; i <= tb.Rows.Count - 1; i++)
            {
                TreeNode tnDept = new TreeNode();
                tnDept.Text    = Convertor.IsNull(tb.Rows[i]["NAME"], "");
                tnDept.Tag     = Convertor.IsNull(tb.Rows[i]["DEPT_ID"], "");
                tnDept.Checked = true;
                tnTopDept.Nodes.Add(tnDept);
            }
            TreeDept.Nodes.Add(tnTopDept);
            TreeDept.ExpandAll();

            sSql = " SELECT * FROM JC_STAT_ITEM ORDER BY CODE ";
            DataTable tab     = InstanceForm.BDatabase.GetDataTable(sSql);
            TreeNode  tnTopXM = new TreeNode();

            tnTopXM.Text = "统计大项目分类";
            tnTopXM.Tag  = 0;
            for (int i = 0; i <= tab.Rows.Count - 1; i++)
            {
                TreeNode tnTopXM_C = new TreeNode();
                tnTopXM_C.Text = Convertor.IsNull(tab.Rows[i]["ITEM_NAME"], "");
                tnTopXM_C.Tag  = Convertor.IsNull(tab.Rows[i]["CODE"], "");
                tnTopXM.Nodes.Add(tnTopXM_C);
            }
            TreeXm.Nodes.Add(tnTopXM);
            TreeXm.ExpandAll();
        }