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); }