private void btnAgregar_Click(object sender, EventArgs e) { btnModificar.Enabled = false; btnEliminar.Enabled = false; if (txtDni.TextLength > 0 && txtNombre.TextLength > 0 && txtApellido.TextLength > 0) { if (DniRepetido() == true) { MessageBox.Show("Hay Una Persona con ese dni. Ingrese bien el dni", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { CargarProfesor(); objDatosProfesor.Agregar(objEntProfesor, "profesor", objEntSede.Id, objEntCurso.Id); dgwProfesor.DataSource = objDatosProfesor.TraerTodos(objEntCurso.Id, objEntSede.Id, "profesor"); dgwProfesor.Columns[0].Visible = false; } } else { MessageBox.Show("Llene todos los campos"); } }
//Metodos public void Agregar(Entidades.Profesor pProfesor) { Datos.Profesor objProfesor = new Datos.Profesor(); objProfesor.Agregar(pProfesor); }
public void Agregar(Entidades.Profesor profesor) { objDatos.Agregar(profesor); }