private void btnExcluir_Click(object sender, RoutedEventArgs e) { try { paciente = pacientesController.BuscarPorID(Convert.ToInt32(txtID.Text)); if (paciente != null) { pacientesController.Excluir((Convert.ToInt32(txtID.Text))); } MessageBox.Show("O Paciente foi excluido."); } catch (Exception ex) { MessageBox.Show("Erro ao excluir o Paciente (" + ex.Message + ")"); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { pacientes.Pid = int.Parse(lblIdPaciente.Text); ctrlPacientes.Excluir(pacientes); limpar(); preencherDgv(id_conv_passed_by_frmConve); MessageBox.Show("Paciente excluido com sucesso.", "Excluido", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Parece que algo de errado aconteceu...", MessageBoxButtons.OK, MessageBoxIcon.Error); } }