コード例 #1
0
    protected void BtnAddList_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            //get cart from session and selected item from cart
            CustomerList cus      = CustomerList.GetList();
            Customer     cartItem = cus[selectedCustomer.CustomerID];

            //if item isn’t in cart, add it; otherwise, increase its quantity
            if (cartItem == null)
            {
                cus.AddList(selectedCustomer);
            }
            Response.Redirect("ContactList.aspx", false);
        }
    }