private void btnFRemove_Click(object sender, EventArgs e) { if (IsInt(txtFlightId) == false) { MessageBox.Show("Id is not an integer"); txtFlightId.Focus(); return; } int id = Int32.Parse(txtFlightId.Text); KeyValuePair <int, String> selectedPair_airplane = (KeyValuePair <int, String>)comboAirplane.SelectedItem; int airplane_id = selectedPair_airplane.Key; if (flightDAO.isExistedFlightForDelete(id, airplane_id)) { if (flightDAO.isFlightBooked(id) == false) { flightDAO.deleteOwnerFlight(id, airplane_id); flightDAO.deleteFlight(id); MessageBox.Show("Delete successfully"); clearDataFlight(); updateDatagridFlight(); } else { MessageBox.Show("Cancel delete flight because user has booked it"); } } else { MessageBox.Show("flight is not existed"); } }