コード例 #1
0
ファイル: Cart.aspx.cs プロジェクト: 78526Nasir/EBuy
        protected void repeaterItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("RemoveFromCart"))
            {
                HiddenField hf        = (HiddenField)e.Item.FindControl("hiddenField");
                int         productID = Convert.ToInt32(hf.Value);

                ECommerceBusiness ecb = new ECommerceBusiness();
                DataTable         dt  = (DataTable)Session["UserWholeRecord"];

                int userID = Convert.ToInt32(dt.Rows[0]["user_id"].ToString());

                ecb.DeleteCartedProduct(productID, userID);
                GetCartedProducts(userID);

                UpdateBadge();
            }
            else if (e.CommandName.Equals("ViewProduct"))
            {
                HiddenField hf          = (HiddenField)e.Item.FindControl("hfGUID");
                string      productGUID = hf.Value;

                Response.Redirect("Product.aspx?id=" + productGUID);
            }
            else if (e.CommandName.Equals("OrderProduct"))
            {
                HiddenField hf          = (HiddenField)e.Item.FindControl("hfGUID");
                string      productGUID = hf.Value;

                hf = (HiddenField)e.Item.FindControl("hiddenField");

                int productID = Convert.ToInt32(hf.Value);

                DataTable dt = (DataTable)Session["UserWholeRecord"];

                int userID = Convert.ToInt32(dt.Rows[0]["user_id"].ToString());

                RemoveFromCart(productID, userID);

                Response.Redirect("Order.aspx?id=" + productGUID);
            }
        }