private void dgvMonAn_CellClick(object sender, DataGridViewCellEventArgs e) { if ((e.RowIndex < 0) || (e.RowIndex > dgvMonAn.RowCount)) { return; } txtMaMonAn.Text = dgvMonAn.Rows[e.RowIndex].Cells["MaMonAn"].Value.ToString().Trim(); txtTenMonAn.Text = dgvMonAn.Rows[e.RowIndex].Cells["TenMonAn"].Value.ToString().Trim(); getDataGridViewChiTietMonAn(txtMaMonAn.Text); XoaTrangChiTiet(); SetEnabledComponents(!MonAnBLL.KiemTraMonAnTrongThucDon(txtMaMonAn.Text)); }
private void btnXoaChiTiet_Click(object sender, EventArgs e) { if (MonAnBLL.KiemTraMonAnTrongThucDon(txtMaMonAn.Text)) { SetEnabledComponents(false); MessageBox.Show("Không thể xóa chi tiết của món ăn đã được áp dụng", "Thông báo", MessageBoxButtons.OK); return; } ChiTietMonAnBLL.XoaChiTietMonAn(txtMaMonAn.Text.Trim(), cboChonNguyenLieu.Text.Trim()); XoaTrangChiTiet(); getDataGridViewMonAn(); getDataGridViewChiTietMonAn(txtMaMonAn.Text.Trim()); }
private void dgvMonAn_CellClick(object sender, DataGridViewCellEventArgs e) { if ((e.RowIndex < 0) || (e.RowIndex > dgvMonAn.RowCount)) { return; } txtMaMonAn.Text = dgvMonAn.Rows[e.RowIndex].Cells["MaMonAn"].Value.ToString(); txtTenMonAn.Text = dgvMonAn.Rows[e.RowIndex].Cells["TenMonAn"].Value.ToString(); getDataGridViewNguyenLieuTungMon(txtMaMonAn.Text); if (MonAnBLL.KiemTraMonAnTrongThucDon(txtMaMonAn.Text)) { lblWarning.Visible = true; setEnabledComponent(false); } else { lblWarning.Visible = false; XoaTrang(); setEnabledComponent(true); } }