コード例 #1
0
        protected void Repeater_ViewCart_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string user = Context.User.Identity.GetUserName();

            switch (e.CommandName)
            {
            case "-":
                string ISBN = ((Label)e.Item.FindControl("Label4")).Text;
                (new BusinessLogic()).QuantityDecrease(user, ISBN);
                break;

            case "+":
                string ISBN_add = ((Label)e.Item.FindControl("Label4")).Text;
                (new BusinessLogic()).QuantityIncrease(user, ISBN_add);
                break;

            case "RemoveItem":
                string ISBN_remove = ((Label)e.Item.FindControl("Label4")).Text;
                (new BusinessLogic()).RemoveItem(user, ISBN_remove);
                break;
            }

            Repeater_ViewCart.DataSource = BusinessLogic.ShowCartItem(user);
            Repeater_ViewCart.DataBind();
            Label_Price.Text = String.Format("Price: S$ {0:c}", (new BusinessLogic()).TotalPrice(user));
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = Context.User.Identity.GetUserName();

            Repeater_ViewCart.DataSource = BusinessLogic.ShowCartItem(user);
            Repeater_ViewCart.DataBind();
            Label_Price.Text = String.Format("Price: S$ {0:c}", (new BusinessLogic()).TotalPrice(user));
        }