コード例 #1
0
        protected void ButtonNext_Click(object sender, EventArgs e)
        {
            updatePrice();
            string toppings = "";

            for (int i = 0; i < CheckBoxListToppings.Items.Count; i++)
            {
                if (CheckBoxListToppings.Items[i].Selected)
                {
                    toppings += CheckBoxListToppings.Items[i].Text + ", ";
                }
            }//close for loop
            ShoppingCartUti cart = new ShoppingCartUti();

            //The below line needs to be changed later on.
            cart.UserName   = Session["user"].ToString();
            cart.PizzaSize  = DropDownListPizzaSize.SelectedItem.ToString();
            cart.PizzaStyle = DropDownListPizzaStyle.SelectedItem.ToString();
            cart.Toppings   = toppings;
            cart.Price      = (double)price * (1.07);
            cart.insertShoppingCart();
            //The below line (Response) needs to be removed by
            //Response.Redirect("OrderConfirm.aspx?=id"+cart.ID);
            // Response.Write("<script language=javascript> var agree;agree=confirm('You have successfully added into ShoppingCart table'); </script>");

            Response.Redirect("OrderConfirm.aspx?id=" + cart.ID);
        }
コード例 #2
0
    protected void ButtonCheckOut_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(addressId))
        {
            AddressUti adr = new AddressUti();
            adr.AddressType  = TextBoxAddressType.Text;
            adr.UserName     = Session["user"].ToString();
            adr.Phone        = TextBoxPhone.Text;
            adr.AddressLine1 = TextBoxAddressLine1.Text;
            adr.AddressLine2 = TextBoxAddressLine2.Text;
            adr.ZipCode      = TextBoxZipCode.Text;
            adr.insertAddress();
            addressId = adr.ID;
        }
        ShoppingCartUti cart = new ShoppingCartUti();

        cart.ID = Request.QueryString["id"].ToString();
        cart.readRecordById();
        OrderUti order = new OrderUti();

        order.PizzaSize  = cart.PizzaSize;
        order.PizzaStyle = cart.PizzaStyle;
        order.Price      = cart.Price;
        order.Toppings   = cart.Toppings;
        order.UserName   = cart.UserName;
        order.AddressId  = addressId;
        order.insertOrder();
        cart.removeRecord();
        Response.Redirect("Thanks.aspx");
    }
コード例 #3
0
        protected void ButtonCheckOut_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(addressId))
            {
                //Access Delivery_Address table
                AddressUti adr = new AddressUti();
                adr.AddressType  = TextBoxAddressType.Text;
                adr.UserName     = Session["user"].ToString();
                adr.Phone        = TextBoxPhone.Text;
                adr.AddressLine1 = TextBoxAddressLine1.Text;
                adr.AddressLine2 = TextBoxAddressLine2.Text;
                adr.ZipCode      = TextBoxZipCode.Text;
                adr.insertAddress();
                addressId = adr.Delivery_ID;
            }
            //Access ShoppingCartUti Table
            ShoppingCartUti cart = new ShoppingCartUti();

            cart.ID = Request.QueryString["id"].ToString();
            cart.readRecordById();

            //Access Order Table
            OrderUti order = new OrderUti();

            order.PizzaSize   = cart.PizzaSize;
            order.PizzaStyle  = cart.PizzaStyle;
            order.Price       = cart.Price;
            order.Toppings    = cart.Toppings;
            order.UserName    = cart.UserName;
            order.Delivery_ID = addressId;
            order.insertOrder();
            cart.removeRecord();
            //You need to create a ThankYou Page
            Response.Redirect("ThankYou.aspx?id=" + cart.ID);
        }//close ButtonCheckOut_Click method
コード例 #4
0
ファイル: Order.aspx.cs プロジェクト: Aaron-Feng/CS345
    protected void ButtonNext_Click(object sender, EventArgs e)
    {
        updatePrice();
        string toppings = "";

        for (int i = 0; i < CheckBoxListToppings.Items.Count; i++)
        {
            if (CheckBoxListToppings.Items[i].Selected)
            {
                toppings += CheckBoxListToppings.Items[i].Text + ", ";
            }
        }//close for
        ShoppingCartUti cart = new ShoppingCartUti();

        cart.PizzaSize  = DropDownListPizzaSize.SelectedItem.ToString();
        cart.PizzaStyle = DropDownListPizzaStyle.SelectedItem.ToString();
        cart.Price      = (double)price * (1.07);
        cart.Toppings   = toppings;
        cart.UserName   = Session["user"].ToString();
        cart.insertShoppingCart();
        Response.Redirect("OrderConfirm.aspx?id=" + cart.ID);
    }