Exemplo n.º 1
0
        protected void ButtonCheckOut_Click(object sender, EventArgs e)
        {
            AddressUtility adr = new AddressUtility();

            if (String.IsNullOrEmpty(addressId))
            {
                /*if (adr.addressIsRepeat())
                 * {
                 *  addressId = adr.Delivery_ID;
                 *  DropDownList1.Items.FindByValue(addressId).Selected = true;
                 * }
                 * else
                 * {*/
                adr.Address_Type = 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;
                //}
            }
            ShoppingCartUtility cart = new ShoppingCartUtility();

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

            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();
            Response.Redirect("Thanks.aspx?OrderID=" + order.OrderId);
        }
Exemplo n.º 2
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 + ", ";
                }
            }
            ShoppingCartUtility cart = new ShoppingCartUtility();

            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();
            Session["order_in_process"] = true;
            Response.Redirect("OrderConfirm.aspx?id=" + cart.ID);
        }