Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["damncookie"];

            if (cookie != null)
            {
                ENUser user = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");
                if (user.ReadUserPerfil())
                {
                    name.Text    = user.name;
                    birth.Text   = user.birth.ToString("dd-MM-yyyy");
                    mail.Text    = user.email;
                    address.Text = user.address;
                    if (user.empresa != "")
                    {
                        company.Visible   = true;
                        company1.Text     = user.empresa;
                        productos.Visible = true;
                        pedidios.Visible  = false;
                    }
                    else
                    {
                        pedidios.Visible = true;
                    }
                    fotoPerfil.ImageUrl = user.url;
                    edit_button.Visible = true;
                }
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
Ejemplo n.º 2
0
        protected void Send_email_Click(object sender, EventArgs e)
        {
            ClearBoxes();

            // If email exists in DB, change password for that email and send it back to that email address.

            ENUser user = new ENUser();

            user.email = recover_email.Text.ToString();
            user.ReadUserPerfil();
            if (user.email != "")
            {
                //Changes DB password for this user
                byte[] salt;
                new RNGCryptoServiceProvider().GetBytes(salt = new byte[16]);
                var    pb      = new Rfc2898DeriveBytes(user.pass, salt, 1000);
                byte[] random  = pb.GetBytes(20);
                string newpass = Convert.ToBase64String(random);
                newpass   = newpass.Substring(0, 10);
                user.pass = newpass;

                if (user.UpdateUser())
                {
                    //If info can be sent, then show success message
                    if (SendMail(user.name, user.email, newpass))
                    {
                        Label_Sending_Success.Visible = true;
                    }
                    else
                    {
                        Label_Main.Text    = "Ocurrió un error inesperado al enviar su email, contacte con un administrador.";
                        Label_Main.Visible = true;
                    }
                }
                else
                {
                    Label_Update_Error.Visible = true;
                }
            }
            else
            {
                Label_Finding_Error.Visible = true;
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["damncookie"];

            if (cookie != null)
            {
                ENUser user = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");
                if (user.ReadUserPerfil())
                {
                    Direccion.Text = user.address;
                }
                ENCart    cart  = new ENCart(0, 0, 0.0F, 0);
                DataTable table = cart.ReadCart();

                for (int i = 0; i < table.Rows.Count; i++)
                {
                    paga = float.Parse(table.Rows[i][3].ToString()) * float.Parse(table.Rows[i][4].ToString()) + paga;
                }

                TotalPrice.Text = Convert.ToString(paga) + "€";
            }
        }