Beispiel #1
0
    protected void placeOrderButton_Click(object sender, EventArgs e)
    {
        // Store the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();
        // Get shipping ID or default to 0
        int shippingId = 0;

        int.TryParse(shippingSelection.SelectedValue, out shippingId);

        // Get tax ID or default to "No tax"
        string shippingRegion =
            (HttpContext.Current.Profile as ProfileCommon).ShippingRegion;
        int taxId;

        switch (shippingRegion)
        {
        case "2":
            taxId = 1;
            break;

        default:
            taxId = 2;
            break;
        }

        // Create the order and store the order ID
        string orderId =
            ShoppingCartAccess.CreateCommerceLibOrder(shippingId, taxId);

        // Redirect to the conformation page
        Response.Redirect("OrderPlaced.aspx");
    }
    protected void placeOrderButton_Click(object sender,
                                          EventArgs e)
    {
        // Get shipping ID or default to 0
        int shippingId = 0;

        try
        {
            shippingId = int.Parse(shippingSelection.SelectedValue);
        }
        catch
        {
        }
        // Get tax ID or default to "No tax"
        string shippingRegion = (HttpContext.Current.Profile as ProfileCommon).ShippingRegion;
        int    taxId;

        switch (shippingRegion)
        {
        case "2":
            taxId = 1;
            break;

        default:
            taxId = 2;
            break;
        }

        // Create the order and store the order ID
        string orderId = ShoppingCartAccess.CreateCommerceLibOrder(shippingId, taxId);
        // Process order
        OrderProcessor processor = new OrderProcessor(orderId);

        processor.Process();
        // Redirect to the conformation page
        Response.Redirect("OrderPlaced.aspx");
    }