示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            order = (Order)Session["order"];
            if (order == null)
            {
                // We can't checkout if we haven't started an order yet
                Response.Redirect("OrderPizza.aspx");
            }

            TotalLabel.Text = "Total cost (including sales tax): " +
                order.Cost().ToString("c");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Start an order if we haven't already
            Order order = (Order)Session["order"];
            if (order == null)
            {
                // Figure out what reference number we should use
                Object last_ref = Application["last_reference_number"];
                int reference_number;
                if (last_ref == null)
                {
                    reference_number = 1;
                }
                else
                {
                    reference_number = (int) last_ref + 1;
                }
                Application["last_reference_number"] = reference_number;

                Session["order"] = new Order(reference_number);
            }
        }