コード例 #1
0
    protected void btn_Aceptar_Click(object sender, EventArgs e)
    {
        EUser   enc   = new EUser();
        DaoUser datos = new DaoUser();
        String  foto  = System.IO.Path.GetFileName(tb_Foto.PostedFile.FileName);



        if (tb_Foto.FileName == "")
        {
            enc.Id_estudiante   = Session["userId"].ToString();
            enc.UserName        = tb_usuario.Text;
            enc.Clave           = tb_contrasenia.Text;
            enc.Correo          = tb_correo.Text;
            enc.Session         = Session.SessionID;
            enc.Foto            = Session["foto"].ToString();
            tb_usuario.Text     = Session["userName"].ToString();
            tb_contrasenia.Text = Session["clave"].ToString();
            tb_correo.Text      = Session["correo"].ToString();
            ImagenEst.ImageUrl  = Session["foto"].ToString();
        }
        else
        {
            foto = "~/FotosUser/" + tb_Foto.FileName;
            enc.Id_estudiante = Session["userId"].ToString();
            enc.UserName      = tb_usuario.Text;
            enc.Clave         = tb_contrasenia.Text;
            enc.Correo        = tb_correo.Text;
            enc.Foto          = cargarImagen();
            enc.Session       = Session.SessionID;
        }



        DataTable resultado = datos.editarConfig(enc);

        Session["userName"] = enc.UserName;
        Session["clave"]    = enc.Clave;
        Session["correo"]   = enc.Correo;
        Session["foto"]     = enc.Foto;

        this.Page.Response.Write("<script language='JavaScript'>window.alert('Datos Modificados con Exito');</script>");

        ImagenEst.ImageUrl  = Session["foto"].ToString();
        tb_usuario.Text     = Session["username"].ToString();
        tb_contrasenia.Text = Session["clave"].ToString();
        tb_correo.Text      = Session["correo"].ToString();
        btn_Editar.Visible  = true;
        btn_Aceptar.Visible = false;
    }