private void btnBookRoom_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có muốn đặt phòng không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (txbIDCard.Text != String.Empty && txbFullName.Text != String.Empty && txbAddress.Text != String.Empty && txbPhoneNumber.Text != String.Empty && cbNationality.Text != String.Empty) { if (!IsIdCardExists(txbIDCard.Text)) { int idCustomerType = (cbCustomerType.SelectedItem as CustomerType).Id; InsertCustomer(txbIDCard.Text, txbFullName.Text, idCustomerType, dpkDateOfBirth.Value, txbAddress.Text, int.Parse(txbPhoneNumber.Text), cbSex.Text, cbNationality.Text); } InsertBookRoom(CustomerDAO.Instance.GetInfoByIdCard(txbIDCard.Text).Id, (cbRoomType.SelectedItem as RoomType).Id, dpkDateCheckIn.Value, dpkDateCheckOut.Value, DateTime.Now); MessageBox.Show("Đặt phòng thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearData(); LoadListBookRoom(); if (bunifuCheckbox1.Checked) { this.Hide(); fReceiveRoom fReceiveRoom = new fReceiveRoom(GetCurrentIDBookRoom(DateTime.Now.Date)); fReceiveRoom.ShowDialog(); } } else { MessageBox.Show("Vui lòng nhập đầy đủ thông tin.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void titleRecieveRoom_Click(object sender, EventArgs e) { if (CheckAccess("fReceiveRoom")) { this.Hide(); fReceiveRoom f = new fReceiveRoom(); f.ShowDialog(); this.Show(); } else { MessageBox.Show("Bạn không quyền truy cập.", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }