Esempio n. 1
0
 public void LoadDonVi()
 {
     ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
     //load Donvi
     DataTable dtDonVi = thucdon.LoadDonVi();
     comboTreeDonVi.DataSource = dtDonVi;
     comboTreeDonVi.ValueMember = "TenDonVi";
     comboTreeDonVi.DisplayMembers = "TenDonVi";
 }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
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;
                    }
            }
        }
Esempio n. 4
0
        private void ToolStripMenuItemXoaDanhMuc_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Bạn có chắc chắn muốn xóa", "Xóa", MessageBoxButtons.YesNo);
            if(dialogResult == DialogResult.Yes)
            {
                string s = "";
                try
                {
                    s = advTreeThucDon.SelectedNode.Name;
                    int NhomDanhMuc = Convert.ToInt32(s);
                    ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
                    thucdon.DeleteDanhMuc(NhomDanhMuc);
                    LoadTreeViewThucDon();
                    LoadDataGridViewThucDon();
                }
                catch (Exception)
                {
                    try
                    {
                        int NhomDanhMuc = Convert.ToInt32(s.Substring(1));
                        ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
                        thucdon.DeleteNhomDanhMuc(NhomDanhMuc);
                        LoadTreeViewThucDon();
                        LoadDataGridViewThucDon();
                    }
                    catch (Exception)
                    {

                        MessageBox.Show("Bạn chưa chọn mục");
                    }

                }
            }
        }
Esempio n. 5
0
 private void ToolStripMenuItemThemDanhMuc_Click(object sender, EventArgs e)
 {
     string s = advTreeThucDon.SelectedNode.Name;
     try
     {
        int DanhMuc = Convert.ToInt32(s);
         // load Nhom danh muc
        ThucDon.ModuleThucDon load = new ThucDon.ModuleThucDon();
        DataTable dt = load.LoadDanhMucTheoMaDanhMuc(DanhMuc);
        int NhomDanhMuc = Convert.ToInt32(dt.Rows[0][2].ToString());
        ThemDanhMuc them = new ThemDanhMuc(NhomDanhMuc);
        them.ShowDialog();
        LoadTreeViewThucDon();
     }
     catch
     {
         int NhomDanhMuc = Convert.ToInt32(s.Substring(1));
         ThemDanhMuc them = new ThemDanhMuc(NhomDanhMuc);
         them.ShowDialog();
         LoadTreeViewThucDon();
     }
 }
Esempio n. 6
0
        private void LoadTreeViewThucDon1()
        {
            advTreeThucDon1.Nodes.Clear();
            DevComponents.AdvTree.Node node2 = new DevComponents.AdvTree.Node();
            node2.Text = "Tất cả";
            DevComponents.AdvTree.Node node3 = new DevComponents.AdvTree.Node();
            node3.Text = "Tất cả thực đơn";
            node2.Nodes.AddRange(new DevComponents.AdvTree.Node[] { node3 });
              //  node3.Image = global::VietRestaurant2._0.Properties.Resources.folder_48;
            advTreeThucDon1.Nodes.AddRange(new DevComponents.AdvTree.Node[] { node2 });

            ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
            DataTable dtNhom = thucdon.LoadNhomDanhMucThucDon();
            int a = dtNhom.Rows.Count;
            for (int i = 0; i < a; i++)
            {
                DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
                node.Text = dtNhom.Rows[i]["TenDanhMuc"].ToString();
                node.Name = "a" + dtNhom.Rows[i]["MaDanhMuc"].ToString();

                DataTable dt = thucdon.LoadDanhMucTheoNhomDanhMuc(Convert.ToInt32(dtNhom.Rows[i]["MaDanhMuc"].ToString()));
                int b = dt.Rows.Count;
                for (int j = 0; j < b; j++)
                {
                    DevComponents.AdvTree.Node node1 = new DevComponents.AdvTree.Node();
                    node1.Text = dt.Rows[j]["TenDanhMuc"].ToString();
                    node1.Name = dt.Rows[j]["MaDanhMuc"].ToString();
                  //  node1.Image = global::VietRestaurant2._0.Properties.Resources.folder_48;
                    node.Nodes.AddRange(new DevComponents.AdvTree.Node[] { node1 });
                }
                advTreeThucDon1.Nodes.AddRange(new DevComponents.AdvTree.Node[] { node });

            }
            advTreeThucDon1.ExpandAll();
        }
Esempio n. 7
0
 private void loadThucDon()
 {
     ThucDon.ModuleThucDon thudon = new ThucDon.ModuleThucDon();
     DataTable dt = thudon.LoadToanBoThucDon();
     LoadThucDonTheoAdvTree(dt);
     LoadSoLuongSanPham();
 }
Esempio n. 8
0
        private void SuaMon_Load(object sender, EventArgs e)
        {
            ThucDon.ModuleThucDon thucDon = new ThucDon.ModuleThucDon();
            DataTable dt = thucDon.LoadThucDonTheoMaMonAn(MaMonAn);
            ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
            pictureBox1.Image = global::VietRestaurant2._0.Properties.Resources._5564116;
            //load danh muc da chon
            DataTable dtDanhMuc = thucdon.LoadDanhMucNhomDanhMucThucDon();
            comboTreeDanhMuc.DataSource = dtDanhMuc;
            comboTreeDanhMuc.ValueMember = "MaDanhMuc";
            int MaDanhMuc = Convert.ToInt32(dt.Rows[0][5].ToString());
            comboTreeDanhMuc.SelectedValue = MaDanhMuc;
            txtThucDon.Text = dt.Rows[0][1].ToString();
            txtGiaBan.Text = dt.Rows[0][3].ToString();
            try
            {
                pictureBox1.Image = byeArrayToImage((byte[])dt.Rows[0][4]);
            }
            catch (Exception)
            {

            }
            LoadDonVi();
            comboTreeDonVi.SelectedValue = dt.Rows[0][2].ToString();
        }
 private void SuaNhomDanhMuc_Load(object sender, EventArgs e)
 {
     ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
     DataTable dt = thucdon.LoadNhomDanhMucTheoMaNhomDanhMuc(Nhom);
     textBoxX1.Text = dt.Rows[0][1].ToString();
 }
Esempio n. 10
0
        private void ThemMon_Load(object sender, EventArgs e)
        {
            try
            {
                ThucDon.ModuleThucDon thucdon = new ThucDon.ModuleThucDon();
                //load danh muc da chon
                DataTable dtDanhMuc = thucdon.LoadDanhMucNhomDanhMucThucDon();
                comboTreeDanhMuc.DataSource = dtDanhMuc;
                comboTreeDanhMuc.ValueMember = "MaDanhMuc";
                comboTreeDanhMuc.SelectedValue = MaDanhMuc;
                pictureBox1.Image = global::VietRestaurant2._0.Properties.Resources._5564116;
                LoadDonVi();
                panelEx1.Visible = false;
            }
            catch (Exception)
            {

            }
        }