Example #1
0
        public void LoadDataGridViewThucDon1()
        {
            string s = "";

            try
            {
                s = advTreeThucDon1.SelectedNode.Name;
                int MaDanhMuc = Convert.ToInt32(s);
                MaDanhMucThucDon = MaDanhMuc;
                ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
                DataTable dt = thudon.LoadThucDonTheoDanhMuc(MaDanhMuc);
                LoadThucDonTheoAdvTree(dt);
            }
            catch (Exception)
            {
                try
                {

                    int NhomDanhMuc = Convert.ToInt32(s.Substring(1));
                    ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
                    DataTable dt = thudon.LoadThucDonTheoNhomDanhMuc(NhomDanhMuc);
                    LoadThucDonTheoAdvTree(dt);

                }
                catch
                {

                    ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
                    DataTable dt = thudon.LoadToanBoThucDon();
                    dataGridViewXThucDon.DataSource = dt;
                    LoadThucDonTheoAdvTree(dt);
                }
            }
        }
Example #2
0
        public void LoadDataGridViewThucDon()
        {
            string s="";

            try
            {
                s = advTreeThucDon.SelectedNode.Name;
                int MaDanhMuc = Convert.ToInt32(s);
                MaDanhMucThucDon = MaDanhMuc;
                ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
                DataTable dt = thudon.LoadThucDonTheoDanhMuc(MaDanhMuc);
                loadData(dt);
                toolStripMenuItemThemMon.Enabled = true;
                ToolStripMenuItemThemDanhMuc.Enabled = true;
                ToolStripMenuItemSuaDanhMuc.Enabled = true;
            }
            catch
            {
                try
                {

                    int NhomDanhMuc = Convert.ToInt32(s.Substring(1));
                    ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
                    DataTable dt = thudon.LoadThucDonTheoNhomDanhMuc(NhomDanhMuc);
                    loadData(dt);
                    ToolStripMenuItemThemDanhMuc.Enabled = true;
                    toolStripMenuItemThemMon.Enabled = false;
                    ToolStripMenuItemSuaDanhMuc.Enabled = true;

                }
                catch
                {

                    ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
                    DataTable dt = thudon.LoadToanBoThucDon();
                    dataGridViewXThucDon.DataSource = dt;
                    loadData(dt);
                    ToolStripMenuItemThemDanhMuc.Enabled = false;
                    toolStripMenuItemThemMon.Enabled = false;
                    ToolStripMenuItemSuaDanhMuc.Enabled = false;
                    }
            }
        }