protected void Page_Load(object sender, EventArgs e)
    {
        this.ShoppingCart = new Cart();
        this.conn = new SqlConnection(this.connString);

        string action = "";

        if(!String.IsNullOrEmpty(Request.QueryString["action"]))
            action = Request.QueryString["action"].Trim();

        if(action == "add")
        {
            int product_id;
            int qty;

            if(!int.TryParse(Request.Form["product_id"], out product_id))
            {
                alert.InnerText = "Invalid product ID";
                alert.Visible = true;
                return;
            }

            if(!int.TryParse(Request.Form["quantity"], out qty))
            {
                alert.InnerText = "Invalid quantity";
                alert.Visible = true;
                return;
            }

            if(qty > 0)
            {
                if(this.Add(product_id, qty))
                    Response.Redirect("cart.aspx");
            }
            else {
                alert.InnerText = "Invalid quantity";
                alert.Visible = true;
            }
        }
        else if(action == "empty")
        {
            this.Empty_Cart();
            Response.Redirect("cart.aspx");
        }

        SqlDataSource1.SelectParameters["cart_id"].DefaultValue = ShoppingCart.Get_Cart().ToString();
        sub_total.InnerText = "$" + Convert.ToDecimal(this.ShoppingCart.Calculate_Subtotal().ToString()).ToString("#,##0.00");
        total.InnerText = "$" + Convert.ToDecimal(this.ShoppingCart.Calculate_Subtotal().ToString()).ToString("#,##0.00");
    }