private void lblCargarProfesor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                if (dgvProfesores.SelectedRows.Count == 1)
                {
                    Int32 ID;
                    ID  = Convert.ToInt32(dgvProfesores.CurrentRow.Cells[0].Value);
                    pPS = ProfesoresDB.ObtenerProfesor(ID);

                    if (pPS != null)
                    {
                        txtNombre.Text       = pPS.Nombre;
                        txtApellido.Text     = pPS.Apellido;
                        btnRegsitrar.Enabled = false;
                        btnModificar.Enabled = true;
                        btnEliminar.Enabled  = true;
                    }
                    else
                    {
                        MessageBox.Show("No se Pudo Cargar el Docente, Intentelo Nuevamente", "Registro de Docentes", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("No se ha Seleccionado Ningun Docente, Seleccione uno de la Tabla", "Registro de  Docentes", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void frmMantenimientoProfesores_Load(object sender, EventArgs e)
 {
     if (IDProfesor != null)
     {
         btnRegsitrar.Enabled = false;
         try
         {
             pPS = ProfesoresDB.ObtenerProfesor(int.Parse(IDProfesor));
             txtApellido.Text         = pPS.Apellido;
             txtNombre.Text           = pPS.Nombre;
             dgvProfesores.DataSource = ProfesoresDB.TodosLosProfesores();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         btnModificar.Enabled = false;
         btnEliminar.Enabled  = false;
         try
         {
             dgvProfesores.DataSource = ProfesoresDB.TodosLosProfesores();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Esempio n. 3
0
 private void btnSeleccionar_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvTabla.SelectedRows.Count == 1)
         {
             Int32 ID;
             ID  = Convert.ToInt32(dgvTabla.CurrentRow.Cells[0].Value);
             pPS = ProfesoresDB.ObtenerProfesor(ID);
             this.Close();
         }
         else
         {
             MessageBox.Show("No se ha Seleccionado un Profesor, Elija uno de la Tabla", "Profesores", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }