Exemple #1
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = Convert.ToInt32(e.CommandArgument);

        MojoCube.Web.Member.Cart cart = new MojoCube.Web.Member.Cart();
        cart.GetData(int.Parse(((Label)GridView1.Rows[index].FindControl("lblID")).Text));

        //减数量
        if (e.CommandName == "_reduction")
        {
            cart.Qty = cart.Qty - 1;
        }

        //加数量
        if (e.CommandName == "_plus")
        {
            cart.Qty = cart.Qty + 1;
        }

        if (cart.Qty > 0)
        {
            cart.UpdateData(cart.pk_Cart);
            Response.Redirect(MojoCube.Web.Site.Cache.GetUrlExtension("Cart", MojoCube.Api.UI.Language.GetLanguage()));
        }
    }
Exemple #2
0
    //改数量
    protected void txtQty_TextChanged(object sender, EventArgs e)
    {
        TextBox txt   = sender as TextBox;
        int     index = (txt.NamingContainer as GridViewRow).RowIndex;

        MojoCube.Web.Member.Cart cart = new MojoCube.Web.Member.Cart();
        cart.GetData(int.Parse(((Label)GridView1.Rows[index].FindControl("lblID")).Text));

        cart.Qty = int.Parse(((TextBox)GridView1.Rows[index].FindControl("txtQty")).Text);

        if (cart.Qty > 0)
        {
            cart.UpdateData(cart.pk_Cart);
            Response.Redirect(MojoCube.Web.Site.Cache.GetUrlExtension("Cart", MojoCube.Api.UI.Language.GetLanguage()));
        }
    }