private void btnLuuPhieuThue_Click(object sender, EventArgs e) { PhieuThuePhongDTO p = LayThongTinPhong(); ChiTietPhieuThueDTO ct = LayMaKeTiep(); if (RentalBUS.ThemPhieuThuePhong(ct, p)) { for (int i = 0; i < dgvDanhSachPhieuThue.Rows.Count; i++) { CustomerDTO kh = LayThongTinKhachHang(i); if (CustomerBUS.ThemKhachHang(kh)) { if (!RentalBUS.ThemCTPhieuThuePhong(ct, kh)) { MessageBox.Show("Không thêm được chi tiết phiếu thuê", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } else { MessageBox.Show("Không thêm được thông tin khách hàng" + kh.TenKhachHang + "", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } if (RoomBUS.CapNhatTinhTrangPhong(p)) { MessageBox.Show("Lập phiếu thuê thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); ((System.Windows.Forms.Form) this.TopLevelControl).Close(); } else { MessageBox.Show("Không cập nhật được tình trạng phòng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } else { MessageBox.Show("Không thêm được phiếu thuê", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }