void LuuPhongChieu() { if (txbPCMaPhong.Text == "") { return; } PhongChieuDAO ttphongchieu = new PhongChieuDAO() { TenRap = cbPCTenRap.SelectedItem.ToString(), MaPhong = txbPCMaPhong.Text, TenPhong = txbPCTenPhong.Text, SoGhe = Int32.Parse(txbPCSoGhe.Text) }; if (phongchieu.KiemTraPhongChieu(ttphongchieu.MaPhong)) { int soghecu = phongchieu.LaySoGheCuaPhongTheoMaPhong(ttphongchieu.MaPhong); phongchieu.SuaPhongChieu(ttphongchieu, soghecu); } else { phongchieu.ThemPhong(ttphongchieu); } MessageBox.Show("Lưu phòng chiếu thành công!"); LoadDtgvPhongChieu(); }
private void btnAdd_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có chắc muốn thêm?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK) { try { int soHang; int soCot; soHang = int.Parse(txtSoHang.Text); soCot = int.Parse(txtSoCot.Text); string tenPhong = txtTenPhong.Text; if (pcBLL.ThemPhong(tenPhong, soHang, soCot)) { MessageBox.Show("Thêm thành công!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } QuanLyPhong_Load(sender, e); } }