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
Пример #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");
    }