protected void btnGuardar_Click(object sender, EventArgs e) { BLLEstudiante estudiante = new BLLEstudiante(); int idEstudiante = 0; bool correcto = false; string mensaje = ""; DateTime fechaNac = new DateTime(); try { fechaNac = Convert.ToDateTime(Funciones.formatearFecha(this.txtFechaNac.Text.Trim())).Date; correcto = true; } catch { mensaje = "Ha ocurrido un error, la fecha no se encuentra en el formato correcto"; } if (correcto) { mensaje = estudiante.insertarEstudiante(this.txtNombres.Text.Trim(), this.txtApellidos.Text.Trim(), this.txtDPI.Text.Trim(), fechaNac.Date, this.txtMatricula.Text.Trim(), ref idEstudiante); } if (Funciones.tipoMensaje(mensaje)) { mostrarAlertaExito(mensaje); } else { mostrarAlertaError(mensaje); } ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "limpiarTextos", "limpiar_textos()", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLLEstudiante estu = new BLLEstudiante(); this.grvEstudiantes.DataSource = estu.ObtenerTodosEstudiantes(); this.grvEstudiantes.DataBind(); this.drpMeses.DataSource = estu.ObtenerTodosMeses(); this.drpMeses.DataValueField = "id_mes"; this.drpMeses.DataTextField = "nombre_mes"; } }