예제 #1
0
        private void f_Load_Tree()
        {
            try
            {
                DataSet ads_nhombhyt = m_v.f_get_v_nhombhyt("", "", "", "", "");
                DataSet ads_nhomvp   = m_v.f_get_v_nhomvp("", "", "", "", "", "", "");
                DataSet ads_nhomduoc = m_v.f_get_d_dmnhom_frmphannhomduoc();


                treeView1.Nodes.Clear();
                TreeNode anode, anode1;
                foreach (DataRow r in ads_nhombhyt.Tables[0].Select("", "ten"))
                {
                    anode                    = new TreeNode(r["ten"].ToString());
                    anode.ImageIndex         = 0;
                    anode.SelectedImageIndex = 1;
                    anode.Tag                = r["id"].ToString() + ":?";
                    foreach (DataRow r1 in ads_nhomvp.Tables[0].Select("idnhombhyt=" + r["id"].ToString(), "ten"))
                    {
                        anode1                    = new TreeNode(r1["ten"].ToString());
                        anode1.ImageIndex         = 2;
                        anode1.SelectedImageIndex = 3;
                        anode1.Tag                = r["id"].ToString() + ":" + r1["ma"].ToString();
                        anode.Nodes.Add(anode1);
                    }
                    treeView1.Nodes.Add(anode);
                }
                if (ads_nhomduoc.Tables[0].Select("nhomvp=-999").Length > 0)
                {
                    anode                    = new TreeNode(lan.Change_language_MessageText("{Chưa khai nhóm viện phí}"));
                    anode.Tag                = "-999:-999";
                    anode.ImageIndex         = 4;
                    anode.SelectedImageIndex = 4;
                    treeView1.Nodes.Add(anode);
                }
                if (treeView1.Nodes.Count > 1)
                {
                    anode                    = new TreeNode(lan.Change_language_MessageText("{Tất cả}"));
                    anode.Tag                = "-1:-1";
                    anode.ImageIndex         = 5;
                    anode.SelectedImageIndex = 5;
                    treeView1.Nodes.Add(anode);
                }

                if (treeView1.Nodes.Count > 0)
                {
                    treeView1.SelectedNode = treeView1.Nodes[treeView1.Nodes.Count - 1];
                }

                cbLoaikho.DisplayMember = "ten";
                cbLoaikho.ValueMember   = "id";
                cbLoaikho.DataSource    = m_v.f_get_d_loaikho_frmphannhomduoc().Tables[0];
                if (m_loaikho != "")
                {
                    try
                    {
                        cbLoaikho.SelectedValue = m_loaikho;
                    }
                    catch
                    {
                    }
                }
                else
                {
                    try
                    {
                        cbLoaikho.SelectedValue = "1";
                    }
                    catch
                    {
                    }
                }

                cbNhomvp.DisplayMember = "ten";
                cbNhomvp.ValueMember   = "ma";
                cbNhomvp.DataSource    = ads_nhomvp.Tables[0];
                if (m_nhomvp != "")
                {
                    try
                    {
                        cbNhomvp.SelectedValue = m_nhomvp;
                    }
                    catch
                    {
                    }
                }

                dataGridView1.DataSource = ads_nhomduoc.Tables[0];
                toolStrip_Tim_TextChanged(null, null);
            }
            catch
            {
            }
        }