Esempio n. 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()));
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["add"] != null)
            {
                int id = int.Parse(MojoCube.Api.Text.Security.DecryptString(Request.QueryString["add"]));

                if (!MojoCube.Web.Sql.IsExist("Member_Cart", "fk_ID", id, "fk_Member=" + Session["Member_UserID"].ToString() + " and StatusID=0"))
                {
                    MojoCube.Web.Member.Cart cart = new MojoCube.Web.Member.Cart();
                    cart.fk_Member  = int.Parse(Session["Member_UserID"].ToString());
                    cart.TypeID     = 0;
                    cart.StatusID   = 0;
                    cart.fk_ID      = id;
                    cart.Qty        = 1;
                    cart.CreateDate = DateTime.Now.ToString();
                    cart.InsertData();
                }
            }
            else if (Request.QueryString["del"] != null)
            {
                int id = int.Parse(MojoCube.Api.Text.Security.DecryptString(Request.QueryString["del"]));

                if (MojoCube.Web.Sql.IsExist("Member_Cart", "pk_Cart", id, "fk_Member=" + Session["Member_UserID"].ToString()))
                {
                    MojoCube.Web.Member.Cart cart = new MojoCube.Web.Member.Cart();
                    cart.DeleteData(id);
                }
            }

            Response.Redirect(MojoCube.Web.Site.Cache.GetUrlExtension("Cart", strLanguage));
        }
    }
Esempio n. 3
0
    //删除
    protected void lnbDelete_Click(object sender, EventArgs e)
    {
        MojoCube.Web.Member.Cart cart = new MojoCube.Web.Member.Cart();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            if (((CheckBox)GridView1.Rows[i].FindControl("cbSelect")).Checked)
            {
                cart.DeleteData(int.Parse(((Label)GridView1.Rows[i].FindControl("lblID")).Text));
            }
        }

        Response.Redirect(MojoCube.Web.Site.Cache.GetUrlExtension("Cart", MojoCube.Api.UI.Language.GetLanguage()));
    }
Esempio n. 4
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()));
        }
    }