예제 #1
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            deshabilitarTodo();
            habilitarBusqueda();
            tsbInsertar.Enabled = false;
            tsbMod.Enabled      = false;
            string cedula = txtCédula.Text.ToString();

            if (cedula.Length > 0 && MessageBox.Show("Esta seguro de desear eliminar este estudiante de forma permanente?", "Confirmar Eliminación de Estudiante",
                                                     MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                     MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                EstudianteBLL estBLL = new EstudianteBLL();
                try
                {
                    int resultado = estBLL.eliminarEstudiante(cedula);
                    if (resultado == 1)
                    {
                        MessageBox.Show("Estudiante eliminado con exito", "Estudiante Eliminado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error al eliminar estudiante" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Debe buscar un estudiante para eliminar", "Estudiante Invalido", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }