Ejemplo n.º 1
0
    protected void btnCheckOut_Click(object sender, EventArgs e)
    {
        string strTotalAmount = string.Empty;
        string strOrderID     = string.Empty;
        bool   success        = false;

        try
        {
            using (ShoppingCartAccess shoppingCart = new ShoppingCartAccess())
            {
                DataTable dtTotalAmount = shoppingCart.ShoppingCart_GetTotalAmount();
                strOrderID = shoppingCart.ShoppingCart_CreateOrder(rbtnPaymentOption.SelectedValue);
                if (dtTotalAmount.Rows.Count > 0)
                {
                    strTotalAmount = dtTotalAmount.Rows[0]["TotalAmount"].ToString();
                    success        = true;
                }
            }
        }
        catch (Exception ex)
        {
            lblSystemMessage.Text = "Error: " + ex.Message;
        }
        if (success)
        {
            this.Session["PAYMENT_OPTION"] = rbtnPaymentOption.SelectedItem.Text;
            this.Session["ORDER_ID"]       = strOrderID;
            Response.Redirect("Default.aspx");
        }
        else
        {
            Response.Redirect("~/Default.aspx");
        }
    }