Ejemplo n.º 1
0
        private void toolStripMenuItemXoaNguyenLieu_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialog = MessageBox.Show("Bạn có chắc chắn muốn xóa?", "Xóa nguyên liệu", MessageBoxButtons.YesNo);
                if (dialog == DialogResult.Yes)
                {
                    int maNguyenLieu = Convert.ToInt32(dataGridViewXKhoHang.SelectedRows[0].Cells[1].Value.ToString());
                    KhoHang.Model.DeleteKhoHang delete = new KhoHang.Model.DeleteKhoHang();
                    delete.DeleteNguyenLieu(maNguyenLieu);
                    LoadDataGridViewKhoNguyenLieu();
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Bạn chưa chọn nguyên liệu");
            }
        }
Ejemplo n.º 2
0
        private void toolStripMenuItemXoaDanhMucNguyenLieu_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 = advTreeKhoHang.SelectedNode.Name;
                    int NhomDanhMuc = Convert.ToInt32(s);
                    KhoHang.Model.DeleteKhoHang delete = new KhoHang.Model.DeleteKhoHang();
                    delete.DeleteDanhMuc(NhomDanhMuc);
                    LoadTreeViewKhoHang();
                    LoadDataGridViewKhoNguyenLieu();
                }
                catch (Exception)
                {
                    try
                    {
                        s = advTreeKhoHang.SelectedNode.Name;
                        int NhomDanhMuc = Convert.ToInt32(s.Substring(1));
                        KhoHang.Model.DeleteKhoHang delete = new KhoHang.Model.DeleteKhoHang();
                        delete.DeleteNhomDanhMuc(NhomDanhMuc);
                        LoadTreeViewKhoHang();
                        LoadDataGridViewKhoNguyenLieu();
                    }
                    catch (Exception)
                    {

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

                }
            }
        }