Example #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (txtMaNguyenLieu.Text == "" || !NguyenLieuBLL.KiemTraMaNL(txtMaNguyenLieu.Text))
            {
                MessageBox.Show("Chưa chọn nguyên liệu nào\nNhấp chọn một nguyên liệu trong BẢNG NGUYÊN LIỆU để xóa", "Thông báo", MessageBoxButtons.OK);
                return;
            }

            if (NguyenLieuBLL.CoTrongChiTietPhieuMua(txtMaNguyenLieu.Text))
            {
                MessageBox.Show("Không thể xóa nguyên liệu\nNguyên liệu này có trong chi tiết phiếu mua\nVui lòng kiểm tra chi tiết phiếu mua và thử lại", "Thông báo", MessageBoxButtons.OK);
                return;
            }
            NguyenLieuBLL.XoaNguyenLieu(txtMaNguyenLieu.Text.Trim());
            getDataGridView();
            SetEnabledComponents(false);
            XoaTrang();
        }