Beispiel #1
0
        protected void DataListCart_ItemCommand1(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "Delete_command")
            {
                string[] cargs = e.CommandArgument.ToString().Split(',');
                Session["productName"] = cargs[0];
                Session["descerption"] = cargs[1];
                Session["barcode"]     = cargs[2];
                Session["catagory"]    = cargs[3];
                Session["price"]       = cargs[4];
                Session["nameShop"]    = cargs[5];
                Session["Amount"]      = cargs[6];

                ShopHandler s = new ShopHandler();
                bool        b = s.remove_item_from_cart(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Session["Amount"].ToString()));
                if (b)
                {
                    ShopHandler c = new ShopHandler();

                    Data_cart.DataSource = c.GetUserBaskets(Session["username"].ToString());
                    Data_cart.DataBind();
                }
                else
                {
                }
            }

            if (e.CommandName == "up_command")
            {
                string[] cargs = e.CommandArgument.ToString().Split(',');
                Session["productName"] = cargs[0];
                Session["barcode"]     = cargs[1];
                Session["nameShop"]    = cargs[2];
                Session["Amount"]      = cargs[3];

                ShopHandler s = new ShopHandler();
                s.UpdateCart(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Session["Amount"].ToString()) + 1);
                Response.Redirect("~/Cart.aspx");
            }
            if (e.CommandName == "down_command")
            {
                string[] cargs = e.CommandArgument.ToString().Split(',');
                Session["productName"] = cargs[0];
                Session["barcode"]     = cargs[1];
                Session["nameShop"]    = cargs[2];
                Session["Amount"]      = cargs[3];
                ShopHandler s = new ShopHandler();
                s.UpdateCart(Session["username"].ToString(), Session["nameShop"].ToString(), Session["barcode"].ToString(), int.Parse(Session["Amount"].ToString()) - 1);
                Response.Redirect("~/Cart.aspx");
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Labelerrorcreditcard.Visible = false;
                Labelerroraddress.Visible    = false;
                ShopHandler a = new ShopHandler();

                Data_cart.DataSource = a.GetUserBaskets(Session["username"].ToString());
                Data_cart.DataBind();
            }
            else
            {
            }
        }