private void bunifuThinButton21_Click(object sender, EventArgs e) { if (lblWarning.Visible) { MessageBox.Show("Không thể sửa đổi chi tiết món ăn đã được thêm vào thực đơn", "Thông báo", MessageBoxButtons.OK); return; } if (txtMaMonAn.Text == "") { MessageBox.Show("Vui lòng chọn một món ăn cần cập nhật", "Thông báo", MessageBoxButtons.OK); return; } if (!MonAnBLL.KiemTraMonAn(txtMaMonAn.Text)) { MessageBox.Show("món ăn này chưa tồn tại", "Thông báo", MessageBoxButtons.OK); return; } //trường hợp đủ điều kiện để cập nhật MonAn monan = new MonAn(); monan.MaMonAn = txtMaMonAn.Text; monan.TenMonAn = txtTenMonAn.Text; MonAnBLL.CapNhatMonAn(monan); getDataGridViewMonAn(); }
private void btnThemMonAn_Click(object sender, EventArgs e) { if (lblWarning.Visible) { MessageBox.Show("Không thể sửa đổi chi tiết món ăn đã được thêm vào thực đơn", "Thông báo", MessageBoxButtons.OK); return; } if (MonAnBLL.KiemTraMonAn(txtMaMonAn.Text)) { MessageBox.Show("Vui lòng chọn Cập nhật để sửa đổi món ăn đã tồn tại", "Thông báo", MessageBoxButtons.OK); return; } if (txtMaMonAn.Text == "") { MessageBox.Show("Vui lòng bấm 'Làm mới' để lấy mã món ăn mới", "Thông báo", MessageBoxButtons.OK); return; } if (txtTenMonAn.Text == "") { MessageBox.Show("Tên món ăn không được để trống", "Thông báo", MessageBoxButtons.OK); return; } MonAn monan = new MonAn(); monan.MaMonAn = txtMaMonAn.Text; monan.TenMonAn = txtTenMonAn.Text; MonAnBLL.ThemMonAn(monan); getDataGridViewMonAn(); }