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

            if (check_caducidad())
            {
                ENUser user = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");

                if (user.ReadID())
                {
                    ENCart    cart  = new ENCart(0, user.userID, 0.0F, 0);
                    DataTable table = cart.ReadCart();
                    ENOrder   order = new ENOrder(user.userID, "Preparando", paga, DateTime.Now);
                    if (order.CreateOrder())
                    {
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            ENProduct p = new ENProduct(Convert.ToInt32(table.Rows[i][0].ToString()), "", 0.0F, 0, "", "", "", "");
                            if (p.ReadProductFromCatalog())
                            {
                                p.stock -= Convert.ToInt32(table.Rows[i][3].ToString());
                            }
                            p.UpdateProduct();
                        }

                        cart.DeleteCart();
                    }
                }



                Response.Redirect("Default.aspx");
            }
        }
Ejemplo n.º 2
0
        }//end page load

        protected void AddCartButton_Click(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["damncookie"];

            if (cookie != null)
            {
                ENProduct producto = new ENProduct(0, "", 0.0F, 0, "", "", "", "");
                ENUser    usuario  = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");

                producto.id = Convert.ToInt32(Request.QueryString["id"]);
                usuario.ReadID();

                if (producto.ReadProductFromCatalog())
                {
                    ENCart carrito = new ENCart(producto.id, usuario.userID, producto.price, Convert.ToInt32(ProdAmount.Text));

                    if (carrito.CreateCart())
                    {
                        ProductAddedLabel.Visible = true;
                    }
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cart_menu_button.Visible = false;
            HttpCookie cookie = Request.Cookies["damncookie"];

            if (cookie != null)
            {
                if (!Proveedor(cookie["username"]))
                {
                    cart_menu_button.Visible = true;
                }
                login_menu_button.Visible    = false;
                register_menu_button.Visible = false;
                menu_logoff.Visible          = true;
                username_menu_button.Visible = true;
                username_menu_button.Text    = cookie["username"];
                ENUser u = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");

                if (u.ReadID())
                {
                    cart_menu_button.NavigateUrl = "Cart.aspx?userID=" + u.userID;
                }
            }
            else
            {
                login_menu_button.Visible    = true;
                register_menu_button.Visible = true;
                menu_logoff.Visible          = false;
                username_menu_button.Visible = false;
            }
        }
Ejemplo n.º 4
0
        protected void verPedidos(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["damncookie"];
            ENUser     user   = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");

            if (user.ReadID())
            {
                Response.Redirect("Orders.aspx?userID=" + user.userID);
            }
        }
Ejemplo n.º 5
0
        protected void SendRating_Click(object sender, EventArgs e)
        {
            int        productID = Convert.ToInt32(Request.QueryString["id"]);
            HttpCookie cookie    = Request.Cookies["damncookie"];

            ENUser user = new ENUser(0, "", "", cookie["username"], new DateTime(), "", "", "");


            if (user.ReadID())
            {
                ENRatting rating = new ENRatting(productID, user.userID, CommentTextBox.Text, ratingStars.CurrentRating);

                if (rating.createRatting())
                {
                    RatingSavedLabel.Visible = true;
                }
            }
        }