Exemplo n.º 1
0
        ////Data Methods

        /// <summary>
        /// Bind PostageTable Gridview
        /// Take the cart from session variable and bind CartTable gridview
        /// Columns 0 is made visible and hide because it correspond to the ID of whichis irrelevant for the user
        /// Update the value of invoice (Calcul())
        /// </summary>
        protected void BindData()
        {
            //Postages options
            BindPostages();

            //Cart content
            //Cart recuperation
            List <ProductSelectionDTO> cart = (List <ProductSelectionDTO>)(this.Session["Cart"]);

            CartTable.Columns[0].Visible = true;                //ID column visible for the Binding
            CartTable.DataSource         = getDataTableCart(cart);
            CartTable.DataBind();
            CartTable.Columns[0].Visible = false;
            Calcul();

            if (cart.Count == 0)
            {
                lblResult.Text       = ("Your cart is empty");
                AmountLabels.Visible = false;
            }
            else
            {
                AmountLabels.Visible = true;
            }
        }
Exemplo n.º 2
0
        protected void deleteCart(object sender, EventArgs e)
        {
            int id     = Int32.Parse((sender as LinkButton).CommandArgument);
            int userID = Int32.Parse(Session["user"].ToString());

            CartController.doDeleteCart(id, userID);
            CartTable.DataBind();
            countGrandTotal();
        }
Exemplo n.º 3
0
        protected void checkout(object sender, EventArgs e)
        {
            int    userID         = Int32.Parse(Session["user"].ToString());
            string checkoutStatus = CartController.checkout(userID);

            if (checkoutStatus.Equals("success"))
            {
                Response.Redirect("CheckoutSuccess.aspx");
            }
            else if (checkoutStatus.Equals("empty"))
            {
                ErrorMessageLabel.Text = "Cart can't be empty";
            }
            CartTable.DataBind();
        }