Beispiel #1
0
        private void Form_tjdw_Load(object sender, EventArgs e)
        {
            new Common.Common().AddImages(imageList1);
            tv_dw.ImageList = imageList1;

            //第0级
            DataTable dt_tjdw0 = tjglbiz.Get_tj_dw(0, "", 1);

            if (object.Equals(null, dt_tjdw0))
            {
                return;
            }
            for (int i = 0; i < dt_tjdw0.Rows.Count; i++)
            {
                TreeNode treenode0 = new TreeNode();
                treenode0.Tag  = dt_tjdw0.Rows[i]["bh"].ToString().Trim();
                treenode0.Text = dt_tjdw0.Rows[i]["mc"].ToString().Trim();
                tv_dw.Nodes.Add(treenode0);

                //第1级
                DataTable dt_tjdw1 = tjglbiz.Get_tj_dw(1, treenode0.Tag.ToString().Trim(), 1);
                for (int j = 0; j < dt_tjdw1.Rows.Count; j++)
                {
                    TreeNode treenode1 = new TreeNode();
                    treenode1.Tag  = dt_tjdw1.Rows[j]["bh"].ToString().Trim();
                    treenode1.Text = dt_tjdw1.Rows[j]["mc"].ToString().Trim();
                    treenode0.Nodes.Add(treenode1);

                    //第2级
                    DataTable dt_tjdw2 = tjglbiz.Get_tj_dw(2, treenode1.Tag.ToString().Trim(), 1);
                    for (int h = 0; h < dt_tjdw2.Rows.Count; h++)
                    {
                        TreeNode treenode2 = new TreeNode();
                        treenode2.Tag  = dt_tjdw2.Rows[h]["bh"].ToString().Trim();
                        treenode2.Text = dt_tjdw2.Rows[h]["mc"].ToString().Trim();
                        treenode1.Nodes.Add(treenode2);

                        //第3级
                        DataTable dt_tjdw3 = tjglbiz.Get_tj_dw(3, treenode2.Tag.ToString().Trim(), 1);
                        for (int k = 0; k < dt_tjdw3.Rows.Count; k++)
                        {
                            TreeNode treenode3 = new TreeNode();
                            treenode3.Tag  = dt_tjdw3.Rows[k]["bh"].ToString().Trim();
                            treenode3.Text = dt_tjdw3.Rows[k]["mc"].ToString().Trim();
                            treenode2.Nodes.Add(treenode3);
                        }
                    }
                }
                new Common.Common().AddImages(imageList1);
            }
        }
Beispiel #2
0
        void DataBind()
        {
            tv_tjdw.Nodes.Clear();
            int str_qybz = 1;

            if (rb_all.Checked)
            {
                str_qybz = 0;
            }

            TreeNode treenode = new TreeNode();

            treenode.Tag  = "";
            treenode.Text = "体检单位";
            tv_tjdw.Nodes.Add(treenode);

            //第0级
            DataTable dt_tjdw0 = tjglbiz.Get_tj_dw(0, "", str_qybz);

            if (object.Equals(null, dt_tjdw0))
            {
                return;
            }
            for (int i = 0; i < dt_tjdw0.Rows.Count; i++)
            {
                if (dt_tjdw0.Rows[i]["mc"].ToString().Trim() == "个人体检")
                {
                    continue;
                }

                TreeNode treenode0 = new TreeNode();
                treenode0.Tag  = dt_tjdw0.Rows[i]["bh"].ToString().Trim();
                treenode0.Text = dt_tjdw0.Rows[i]["mc"].ToString().Trim();
                if (dt_tjdw0.Rows[i]["qybz"].ToString().Trim() == "0")
                {
                    treenode0.ForeColor = Color.Red;
                }
                treenode.Nodes.Add(treenode0);

                //第1级
                DataTable dt_tjdw1 = tjglbiz.Get_tj_dw(1, treenode0.Tag.ToString().Trim(), str_qybz);
                for (int j = 0; j < dt_tjdw1.Rows.Count; j++)
                {
                    TreeNode treenode1 = new TreeNode();
                    treenode1.Tag  = dt_tjdw1.Rows[j]["bh"].ToString().Trim();
                    treenode1.Text = dt_tjdw1.Rows[j]["mc"].ToString().Trim();

                    if (dt_tjdw1.Rows[j]["qybz"].ToString().Trim() == "0")
                    {
                        treenode1.ForeColor = Color.Red;
                    }
                    treenode0.Nodes.Add(treenode1);

                    //第2级
                    DataTable dt_tjdw2 = tjglbiz.Get_tj_dw(2, treenode1.Tag.ToString().Trim(), str_qybz);
                    for (int h = 0; h < dt_tjdw2.Rows.Count; h++)
                    {
                        TreeNode treenode2 = new TreeNode();
                        treenode2.Tag  = dt_tjdw2.Rows[h]["bh"].ToString().Trim();
                        treenode2.Text = dt_tjdw2.Rows[h]["mc"].ToString().Trim();
                        if (dt_tjdw2.Rows[h]["qybz"].ToString().Trim() == "0")
                        {
                            treenode2.ForeColor = Color.Red;
                        }
                        treenode1.Nodes.Add(treenode2);

                        //第3级
                        DataTable dt_tjdw3 = tjglbiz.Get_tj_dw(3, treenode2.Tag.ToString().Trim(), str_qybz);
                        for (int k = 0; k < dt_tjdw3.Rows.Count; k++)
                        {
                            TreeNode treenode3 = new TreeNode();
                            treenode3.Tag  = dt_tjdw3.Rows[k]["bh"].ToString().Trim();
                            treenode3.Text = dt_tjdw3.Rows[k]["mc"].ToString().Trim();
                            if (dt_tjdw3.Rows[k]["qybz"].ToString().Trim() == "0")
                            {
                                treenode3.ForeColor = Color.Red;
                            }
                            treenode2.Nodes.Add(treenode3);
                        }
                    }
                }
            }

            new Common.Common().AddImage(treenode);
        }