示例#1
0
        private void tbExcluir_Click(object sender, System.EventArgs e)
        {
            //TODO: verficar se existe consulta associado
            Paciente paciente = null;

            if (dgResultado.CurrentRow == null ||
                (paciente = dgResultado.CurrentRow.DataBoundItem as Paciente) == null)
            {
                MessageBox.Show(this, "Selecione um paciente na lista para excluí-lo.", "Paciente",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                return;
            }

            try
            {
                dgResultado.DataSource = null;
                int index = Util.lstPacientes.IndexOf(paciente);
                Util.lstPacientes.RemoveAt(index);
                PacienteDao.Delete(paciente.ID.ToString());

                MessageBox.Show(this, "Paciente excluido com sucesso", "Paciente");

                dgResultado.DataSource = Util.lstPacientes;
                formOnEndTask();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void eliminarButton_Click(object sender, EventArgs e)
        {
            PacienteDao eliminar = new PacienteDao();

            eliminar.Delete(Convert.ToInt32(nssTB.Text));
            MessageBox.Show("Eliminado correctamente");
            DesHabilitarDatos();
        }