Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //VALIDAR QUE SE INGRESAN UNICAMENTE NUMEROS
        txt_NumDoc.Attributes.Add("onkeypress", "javascript:return SoloNum(event); ");
        txt_NumDocMadre.Attributes.Add("onkeypress", "javascript:return SoloNum(event); ");
        txt_NumDocPadre.Attributes.Add("onkeypress", "javascript:return SoloNum(event); ");

        txt_FechaNacimiento.Attributes.Add("onkeypress", "fun_validarfecha_obj(this)");
        txt_FechaNacimientoMadre.Attributes.Add("onkeypress", "fun_validarfecha_obj(this)");
        txt_FechaNacimientoPadre.Attributes.Add("onkeypress", "fun_validarfecha_obj(this)");

        if (!IsPostBack)
        {
            cargarCombo(ddl_TipoDoc, 1);
            cargarCombo(ddl_TipoDocMadre, 1);
            cargarCombo(ddl_TipoDocPadre, 1);
            cargarCombo(ddl_NivelEstudio, 0);
            if (Session["origen"] == null)
            {
                Session["origen"] = "default";
            }
            string origen = Session["origen"].ToString();
            if (origen.Equals("consulta"))
            {
                Alumno alumnoConsulta = AlumnoDao.obtenerPorLegajo(int.Parse(Session["legajo"].ToString()));

                txt_legajo.Text           = alumnoConsulta.legajo.ToString();
                txt_Nombre.Text           = alumnoConsulta.alumno.nombre.ToString();
                txt_Apellido.Text         = alumnoConsulta.alumno.apellido.ToString();
                ddl_TipoDoc.SelectedIndex = alumnoConsulta.alumno.tipoDoc.id;
                txt_NumDoc.Text           = alumnoConsulta.alumno.numDoc.ToString();
                txt_Domicilio.Text        = alumnoConsulta.alumno.domicilio.ToString();
                txt_Telefono.Text         = alumnoConsulta.alumno.telefono.ToString();
                txt_Celular.Text          = alumnoConsulta.alumno.celular.ToString();
                txt_mail.Text             = alumnoConsulta.alumno.mail.ToString();
                txt_FechaNacimiento.Text  = alumnoConsulta.alumno.fechaNacimiento.ToString();

                if (alumnoConsulta.conoceMusica == true)
                {
                    opt_Si.Checked = true;
                    opt_No.Checked = false;
                }
                else
                {
                    opt_No.Checked = true;
                    opt_Si.Checked = false;
                }
                ddl_NivelEstudio.SelectedIndex = alumnoConsulta.nivelEstudio.id;

                txt_NombreMadre.Text           = alumnoConsulta.madre.nombre.ToString();
                txt_ApellidoMadre.Text         = alumnoConsulta.madre.apellido.ToString();
                ddl_TipoDocMadre.SelectedIndex = alumnoConsulta.madre.tipoDoc.id;
                txt_NumDocMadre.Text           = alumnoConsulta.madre.numDoc.ToString();
                txt_DomicilioMadre.Text        = alumnoConsulta.madre.domicilio.ToString();
                txt_TelefonoMadre.Text         = alumnoConsulta.madre.telefono.ToString();
                txt_CelularMadre.Text          = alumnoConsulta.madre.celular.ToString();
                txt_MailMadre.Text             = alumnoConsulta.madre.mail.ToString();
                txt_FechaNacimientoMadre.Text  = alumnoConsulta.madre.fechaNacimiento.ToString();

                txt_NombrePadre.Text           = alumnoConsulta.padre.nombre.ToString();
                txt_ApellidoPadre.Text         = alumnoConsulta.padre.apellido.ToString();
                ddl_TipoDocPadre.SelectedIndex = alumnoConsulta.padre.tipoDoc.id;
                txt_NumDocPadre.Text           = alumnoConsulta.padre.numDoc.ToString();
                txt_DomicilioPadre.Text        = alumnoConsulta.padre.domicilio.ToString();
                txt_TelefonoPadre.Text         = alumnoConsulta.padre.telefono.ToString();
                txt_CelularPadre.Text          = alumnoConsulta.padre.celular.ToString();
                txt_MailPadre.Text             = alumnoConsulta.padre.mail.ToString();
                txt_FechaNacimientoPadre.Text  = alumnoConsulta.padre.fechaNacimiento.ToString();

                Session["origen"] = "desconocido";
            }
            else
            {
                txt_legajo.Text = AlumnoDao.MaxLegajo().ToString();
            }
        }
    }