private void btnThuePhong_Click_1(object sender, EventArgs e) { try { if (khachQuen) { string customerID = txtCMND.Text; string roomNo = cbxMaPhong.GetItemText(cbxMaPhong.SelectedItem); string username = txtTenKhachHang.Text; DateTime checkInDay = dateTimePicker1.Value; DateTime checkOutDay = dateTimePicker2.Value; float totalPay = float.Parse(txtTotal.Text); float prePay = float.Parse(txtTraTruoc.Text); BookingRoom book1 = new BookingRoom(customerID, roomNo, username, checkInDay, checkOutDay, totalPay, prePay); bool result1 = data.checkinKhachQuen(book1, txtCMND.Text); if (result1) { MessageBox.Show("Thuê Phòng Thành Công"); this.Hide(); Thread t = new Thread(new ThreadStart(showServerForm)); t.Start(); this.Close(); } else { MessageBox.Show("Không Thành Công"); this.Hide(); Thread t = new Thread(new ThreadStart(showServerForm)); t.Start(); this.Close(); } } else { string customerID = txtCMND.Text; string roomNo = cbxMaPhong.GetItemText(cbxMaPhong.SelectedItem); string username = txtTenKhachHang.Text; DateTime checkInDay = dateTimePicker1.Value; DateTime checkOutDay = dateTimePicker2.Value; float totalPay = float.Parse(txtTotal.Text); float prePay = float.Parse(txtTraTruoc.Text); BookingRoom book2 = new BookingRoom(customerID, roomNo, username, checkInDay, checkOutDay, totalPay, prePay); Customer cus = new Customer(txtCMND.Text, txtTenKhachHang.Text, txtSoDienThoai.Text, dateTimePicker3.Value); bool result2 = data.checkin(cus, book2); if (result2) { MessageBox.Show("Thành Công"); this.Hide(); Thread t = new Thread(new ThreadStart(showServerForm)); t.Start(); this.Close(); } else { MessageBox.Show("Không Thành Công"); this.Hide(); Thread t = new Thread(new ThreadStart(showServerForm)); t.Start(); this.Close(); } } } catch (Exception) { MessageBox.Show("Vui Lòng thử lại"); } }