Esempio n. 1
0
        private void btnOrder_Click(object sender, System.EventArgs e)
        {
            funstore.cartDB cart = new funstore.cartDB();

            // Calculate end-user's shopping cart ID
            String cartId = cart.GetShoppingCartId();

            funstore.Customer c1 = new Customer();
            //string customerID= c1.GetCustomerDetails(User.Identity.Name);

            // Calculate end-user's customerID
            String id = (User.Identity.Name).ToString();

            if ((cartId != null))
            {
//			if ((cartId != null) && (id != ""))
//			{

                // Place the order
                funstore.order ordersDatabase = new funstore.order();
                int            orderId        = ordersDatabase.PlaceOrder(id, cartId);

                //Update labels to reflect the fact that the order has taken place
                //Header.Text="Check Out Complete!";
                //Message.Text = "<b>Your Order Number Is: </b>" + orderId;
                //				SubmitBtn.Visible = false;

                Response.Redirect("thankyou.aspx");
            }
        }
Esempio n. 2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            // Obtain Order ID from QueryString
            int OrderID = Int32.Parse(Request.Params["OrderID"]);

            // Get the customer ID too
            string CustomerId = User.Identity.Name;

            // Obtain Order Details from Database
            funstore.order        orderHistory   = new funstore.order();
            funstore.OrderDetails myOrderDetails = orderHistory.GetOrderDetails(OrderID, CustomerId);

            // if order was found, display it
            if (myOrderDetails != null)
            {
                // Bind Items to GridControl
                this.DataGrid1.DataSource = myOrderDetails.OrderItems;
                this.DataGrid1.DataBind();

                // Update labels with summary details
                lbltotal.Text = String.Format("{0:c}", myOrderDetails.OrderTotal);
                lblid.Text    = OrderID.ToString();
                lbldate.Text  = myOrderDetails.OrderDate.ToShortDateString();
                //lblShipDate.Text = myOrderDetails.ShipDate.ToShortDateString();
            }
            // otherwise display an error message
            else
            {
                Label1.Text = "Order Not found";
                //detailsTable.Visible = false;
            }
        }