private void AgregarActualizar() { //Variables int vln_resultado; ClsEntidadesProfesores vlo_EntidadProfesor = new ClsEntidadesProfesores(); ClsLogicaProfesor vlo_LogicaProfesor = new ClsLogicaProfesor(); try { //Se guardan los valores de la bentana en la clase de profesor. vlo_EntidadProfesor.Correo = txtAACorreo.Text; vlo_EntidadProfesor.Identificacion = txtAAIdentificacion.Text; vlo_EntidadProfesor.Nombre = txtAANombre.Text; vlo_EntidadProfesor.PrimerApellido = txtAAPrimerApellido.Text; vlo_EntidadProfesor.SegundoApellido = txtAASegundoApellido.Text; vlo_EntidadProfesor.Telefono = txtAATelefono.Text; //Se llama a la funcion en la capa de logica para actualice o inserte un estudiante. vln_resultado = vlo_LogicaProfesor.InsertarActualizarProfesor(vlo_EntidadProfesor); //se verifica si se realizó el cambio sugerido. if (vln_resultado > 0) { MessageBox.Show("Operación realizada de forma correcta."); } else { MessageBox.Show("La operción no realizó ningún cambio."); } } catch (Exception ex) { throw; } }
private void EliminarProfesor() { string vlc_Identicacion; int vln_Resultado = 0; ClsLogicaProfesor vlo_LogicaProfesor = new ClsLogicaProfesor(); try { vlc_Identicacion = txtAAIdentificacion.Text; vln_Resultado = vlo_LogicaProfesor.EliminarProfesor(vlc_Identicacion); if (vln_Resultado > 0) { MessageBox.Show("Registro eliminado satisfactoriamente."); } else { MessageBox.Show("Registro no pudo ser eliminado."); } } catch (Exception) { throw; } }
private void CargarRegistro(string pvc_Cedula) { //Se establese una variable entidadprofesor ClsEntidadesProfesores vlo_EntidadProfesor = new ClsEntidadesProfesores(); //Se instancia la logica de profesor ClsLogicaProfesor vlo_LigicaProfesor = new ClsLogicaProfesor(); string vlc_Condicion; //Se establece la condición que debe cumplir. vlc_Condicion = string.Format("ID_PROFESOR='{0}'", pvc_Cedula); try { //Se invoca la función de obtener un registro. vlo_EntidadProfesor = vlo_LigicaProfesor.ObtenerRegistro(vlc_Condicion); //Se verifaca la existencai del registro. if (vlo_EntidadProfesor.Existe == true) { //Se muestranlos valores. txtAAIdentificacion.Tag = vlo_EntidadProfesor.CodProfesor; txtAACorreo.Text = vlo_EntidadProfesor.Correo; txtAAIdentificacion.Text = vlo_EntidadProfesor.Identificacion; txtAANombre.Text = vlo_EntidadProfesor.Nombre; txtAAPrimerApellido.Text = vlo_EntidadProfesor.PrimerApellido; txtAASegundoApellido.Text = vlo_EntidadProfesor.SegundoApellido; txtAATelefono.Text = vlo_EntidadProfesor.Telefono; } } catch (Exception) { throw; } }
public void CargarDatos(string pvc_Condicion = "") { //Variables ClsLogicaProfesor vlo_LogicaProfesor = new ClsLogicaProfesor(); DataSet vlo_DS; try { //Se guarda en una variable data set el resultado de la base de datos. vlo_DS = vlo_LogicaProfesor.ListaProfesores(pvc_Condicion); //Se verifica si el dataset contiene datos. if (vlo_DS.Tables[0].Rows.Count >= 0) { //Se alamcenan los datos en el gridview. grdLista.AutoGenerateColumns = false; grdLista.DataSource = vlo_DS; grdLista.DataMember = vlo_DS.Tables[0].TableName; } } catch (Exception) { throw; } }