Example #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");
    }
Example #2
0
    // fill shopping cart controls with data
    private void PopulateControls()
    {
        // set the title of the page
        this.Title = BalloonShopConfiguration.SiteName + " : Shopping Cart";
        // get the items in the shopping cart
        DataTable dt = ShoppingCartAccess.GetItems();

        // if the shopping cart is empty...
        if (dt.Rows.Count == 0)
        {
            titleLabel.Text        = "Your shopping cart is empty!";
            grid.Visible           = false;
            updateButton.Enabled   = false;
            checkoutButton.Enabled = false;
            totalAmountLabel.Text  = String.Format("{0:c}", 0);
        }
        else
        // if the shopping cart is not empty...
        {
            // populate the list with the shopping cart contents
            grid.DataSource = dt;
            grid.DataBind();
            // setup controls
            titleLabel.Text        = "These are the products in your shopping cart:";
            grid.Visible           = true;
            updateButton.Enabled   = true;
            checkoutButton.Enabled = true;
            // display the total amount
            decimal amount = ShoppingCartAccess.GetTotalAmount();
            totalAmountLabel.Text = String.Format("{0:c}", amount);
        }
    }
 // fill the controls with data
 private void PopulateControls()
 {
     // get the items in the shopping cart
     System.Data.DataTable dt = ShoppingCartAccess.GetItems();
     // if the shopping cart is empty...
     if (dt.Rows.Count == 0)
     {
         cartSummaryLabel.Text = "Кошницата Ви е празна.";
         totalAmountLabel.Text = String.Format("{0:c}", 0);
         viewCartLink.Visible  = false;
         list.Visible          = false;
     }
     else
     // if the shopping cart is not empty...
     {
         // populate the list with the shopping cart contents
         list.Visible    = true;
         list.DataSource = dt;
         list.DataBind();
         // set up controls
         cartSummaryLabel.Text = "Сума на кошницата ";
         viewCartLink.Visible  = true;
         // display the total amount
         decimal amount = ShoppingCartAccess.GetTotalAmount();
         totalAmountLabel.Text = String.Format("{0:c}", amount);
     }
 }
Example #4
0
        // fill shopping cart controls with data
        private void PopulateControls()
        {
            recommendations.LoadCartRecommendations();
            // get the items in the shopping cart
            DataTable dt = ShoppingCartAccess.GetItems();

            // if the shopping cart is empty...
            if (dt.Rows.Count == 0)
            {
                titleLabel.Text        = "Количката Ви е празна!";
                grid.Visible           = false;
                updateButton.Enabled   = false;
                checkoutButton.Enabled = false;
                totalAmountLabel.Text  = String.Format("{0:c}", 0);
            }
            else
            // if the shopping cart is not empty...
            {
                // populate the list with the shopping cart contents
                grid.DataSource = dt;
                grid.DataBind();
                // setup controls
                titleLabel.Text        = "Това са продуктите във Вашата количка:";
                grid.Visible           = true;
                updateButton.Enabled   = true;
                checkoutButton.Enabled = true;
                // display the total amount
                decimal amount = ShoppingCartAccess.GetTotalAmount();
                totalAmountLabel.Text = String.Format("{0:c}", amount);
            }
        }
Example #5
0
    // fill controls with data
    private void PopulateControls()
    {
        // get the items in the shopping cart
        DataTable dt = ShoppingCartAccess.GetItems();

        // populate the list with the shopping cart contents
        grid.DataSource = dt;
        grid.DataBind();
        grid.Visible = true;
        // display the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();

        totalAmountLabel.Text = String.Format("{0:c}", amount);

        // check customer details
        bool addressOK = true;
        bool cardOK    = true;

        if (Profile.Address1 + Profile.Address2 == "" ||
            Profile.ShippingRegion == "" ||
            Profile.ShippingRegion == "Please Select" ||
            Profile.Country == "")
        {
            addressOK = false;
        }
        if (Profile.CreditCard == "")
        {
            cardOK = false;
        }

        // report / hide place order button
        if (!addressOK)
        {
            if (!cardOK)
            {
                InfoLabel.Text =
                    "You must provide a valid address and credit card "
                    + "before placing your order.";
            }
            else
            {
                InfoLabel.Text =
                    "You must provide a valid address before placing your "
                    + "order.";
            }
        }
        else if (!cardOK)
        {
            InfoLabel.Text = "You must provide a credit card before "
                             + "placing your order.";
        }
        else
        {
            InfoLabel.Text =
                "Please confirm that the above details are "
                + "correct before proceeding.";
        }
        placeOrderButton.Visible = addressOK && cardOK;
    }
Example #6
0
    protected void Checkout_Click(object sender, EventArgs e)
    {
        // Get the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();
        // Create the order and store the order ID
        int orderId = ShoppingCartAccess.CreateOrder();

        // string ordername = DatabaseConfiguration.PayPal + " Order " + orderId;
        // Go to PayPal checkout
        //  string destination = Link.ToPayPalCheckout(ordername, amount);
        Response.Redirect("https://www.paypal.com/");
    }
Example #7
0
    // create a new order and redirect to a payment page
    protected void checkoutButton_Click(object sender, EventArgs e)
    {
        // Get the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();
        // Create the order and store the order ID
        string orderId   = ShoppingCartAccess.CreateOrder();
        string ordername = BalloonShopConfiguration.SiteName + " Order " + orderId;
        // Go to PayPal Checkout
        string destination = Link.ToPayPalCheckout(ordername, amount);

        Response.Redirect(destination);
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        double amount   = (double)ShoppingCartAccess.GetTotalAmount();
        bool   promoset = false;

        if (promoset == false)
        {
            if (TextBox1.Text == "GET10ONSHOESHOP")
            {
                amount = amount - (amount * 0.10);
                totalAmountLabel.Text = String.Format("{0:f2}", amount);
                promoset = true;
            }
        }
    }
Example #9
0
    protected void placeOrderButton_Click(object sender, EventArgs e)
    {
        // Store the total amount because the cart
        // is emptied when creating the order
        decimal amount = ShoppingCartAccess.GetTotalAmount();
        // Create the order and store the order ID
        string orderId = ShoppingCartAccess.CreateOrder();
        // Create the PayPal redirect location
        string redirect = "";

        redirect +=
            "https://www.paypal.com/xclick/[email protected]";
        redirect += "&item_name=BallonShopOrder " + orderId;
        redirect += "&item_number=" + orderId;
        redirect += "&amount=" + String.Format("{0:c} ", amount);
        redirect += "&return=http://www.YourWebSite.com";
        redirect += "&cancel_return=http://www.YourWebSite.com";
        // Redirect to the payment page
        Response.Redirect(redirect);
    }
Example #10
0
    // create a new order and redirect to a payment page
    protected void checkoutButton_Click(object sender, EventArgs e)
    {
        // Store the total amount because the cart
        // is emptied when creating the order
        decimal amount = ShoppingCartAccess.GetTotalAmount();
        // Create the order and store the order ID
        string orderId = ShoppingCartAccess.CreateOrder();
        // Obtain the site name from the configuration settings
        string siteName = BalloonShopConfiguration.SiteName;
        // Create the PayPal redirect location
        string redirect = "";

        redirect += "https://www.paypal.com/xclick/[email protected]";
        redirect += "&item_name=" + siteName + " Order " + orderId;
        redirect += "&item_number=" + orderId;
        redirect += "&amount=" + String.Format("{0:0.00} ", amount);
        redirect += "&currency=USD";
        redirect += "&return=http://www." + siteName + ".com";
        redirect += "&cancel_return=http://www." + siteName + ".com";
        // Redirect to the payment page
        Response.Redirect(redirect);
    }
    // fill controls with data
    private void PopulateControls()
    {
        // get the items in the shopping cart
        DataTable dt = ShoppingCartAccess.GetItems();

        // populate the list with the shopping cart contents
        grid.DataSource = dt;
        grid.DataBind();
        // setup controls
        titleLabel.Text =
            "These are the products in your shopping cart:";
        grid.Visible = true;
        // display the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();

        totalAmountLabel.Text = String.Format("{0:c}", amount);

        // check customer details
        bool addressOK = true;
        bool cardOK    = true;

        if (Profile.Address1 + Profile.Address2 == "" ||
            Profile.ShippingRegion == "" ||
            Profile.ShippingRegion == "1" ||
            Profile.Country == "")
        {
            addressOK = false;
        }
        if (Profile.CreditCard == "")
        {
            cardOK = false;
        }

        // report / hide place order button / shipping selection
        if (!addressOK)
        {
            if (!cardOK)
            {
                InfoLabel.Text =
                    "You must provide a valid address and credit card "
                    + "before placing your order.";
            }
            else
            {
                InfoLabel.Text =
                    "You must provide a valid address before placing your "
                    + "order.";
            }
        }
        else if (!cardOK)
        {
            InfoLabel.Text = "You must provide a credit card before "
                             + "placing your order.";
        }
        else
        {
            InfoLabel.Text = "Please confirm that the above details are "
                             + "correct before proceeding.";
        }
        placeOrderButton.Visible  = addressOK && cardOK;
        shippingSelection.Visible = addressOK && cardOK;

        // Populate shipping selection
        if (addressOK && cardOK)
        {
            int shippingRegionId = int.Parse(Profile.ShippingRegion);
            List <ShippingInfo> shippingInfoData = CommerceLibAccess.GetShippingInfo(shippingRegionId);
            foreach (ShippingInfo shippingInfo in shippingInfoData)
            {
                shippingSelection.Items.Add(new ListItem(shippingInfo.ShippingType, shippingInfo.ShippingID.ToString()));
            }
            shippingSelection.SelectedIndex = 0;
        }
    }
Example #12
0
        private void PopulateControls()
        {
            // get the items in the shopping cart
            DataTable dt = ShoppingCartAccess.GetItems();

            // populate the list with the shopping cart contents
            grid.DataSource = dt;
            grid.DataBind();
            grid.Visible = true;
            // display the total amount
            decimal amount = ShoppingCartAccess.GetTotalAmount();

            totalAmountLabel.Text = String.Format("{0:c}", amount);
            // check customer details
            bool addressOK = true;
            bool cardOK    = true;

            ProfileBase Profile = HttpContext.Current.Profile;

            if ((string)Profile["Address1"] + (string)Profile["Address2"] == "" ||
                (string)Profile["ShippingRegion"] == "" ||
                (string)Profile["ShippingRegion"] == "Моля изберете" ||
                (string)Profile["Country"] == "")
            {
                addressOK = false;
            }
            if ((string)Profile["CreditCard"] == "")
            {
                cardOK = false;
            }
            // report/hide place order button
            if (!addressOK)
            {
                if (!cardOK)
                {
                    InfoLabel.Text =
                        "Трябва да въведете валид адрес и дебитна карта.";
                }
                else
                {
                    InfoLabel.Text = "Трябва да въведете валиден адрес";
                }
            }
            else if (!cardOK)
            {
                InfoLabel.Text = "Трябва да въведете номер на дебитна карта.";
            }
            else
            {
                InfoLabel.Text = "Моля потвърдете, че детайлите по-горе са вярни преди извършване на поръчката.";
            }
            placeOrderButton.Visible  = addressOK && cardOK;
            shippingSelection.Visible = addressOK && cardOK;
            // Populate shipping selection
            if (addressOK && cardOK)
            {
                int shippingRegionId = int.Parse((string)Profile["ShippingRegion"]);
                List <ShippingInfo> shippingInfoData =
                    CommerceLibAccess.GetShippingInfo(shippingRegionId);
                foreach (ShippingInfo shippingInfo in shippingInfoData)
                {
                    shippingSelection.Items.Add(
                        new ListItem(shippingInfo.ShippingType,
                                     shippingInfo.ShippingID.ToString()));
                }
                shippingSelection.SelectedIndex = 0;
            }
        }
Example #13
0
    // fill controls with data
    private void PopulateControls()
    {
        // get the items in the shopping cart
        DataTable dt = ShoppingCartAccess.GetItems();

        // populate the list with the shopping cart contents
        grid.DataSource = dt;
        grid.DataBind();
        grid.Visible = true;
        // display the total amount
        decimal amount = ShoppingCartAccess.GetTotalAmount();

        totalAmountLabel.Text = String.Format("{0:c}", amount);

        // check customer details
        bool addressOK = true;
        bool cardOK    = true;

        if (Profile.Address1 + Profile.Address2 == "" ||
            Profile.ShippingRegion == "" ||
            Profile.ShippingRegion == "Моля изберете" ||
            Profile.Country == "")
        {
            addressOK = false;
        }
        if (Profile.CreditCard == "")
        {
            cardOK = false;
        }

        // report / hide place order button
        if (!addressOK)
        {
            if (!cardOK) // http://localhost:49571/BalloonShop/Default.aspx
            {
                InfoLabel.Text =
                    "Трябва да напишете валиден адрес и кредитна карта "
                    + "преди да пуснете резервацията.";
            }
            else
            {
                InfoLabel.Text =
                    "Трябва да напишете валиден адрес преди да пуснете "
                    + "резервацията.";
            }
        }
        else if (!cardOK)
        {
            InfoLabel.Text = "Трябва да предоставите кредитна карта "
                             + "преди да пуснете резервацията.";
        }
        else
        {
            InfoLabel.Text =
                "Моля потвърдете че данните са "
                + "валидни преди да продължите.";
        }
        placeOrderButton.Visible  = addressOK && cardOK;
        shippingSelection.Visible = addressOK && cardOK;

        // Populate shipping selection
        if (addressOK && cardOK)
        {
            int shippingRegionId = int.Parse(Profile.ShippingRegion);
            List <ShippingInfo> shippingInfoData =
                CommerceLibAccess.GetShippingInfo(shippingRegionId);
            foreach (ShippingInfo shippingInfo in shippingInfoData)
            {
                shippingSelection.Items.Add(
                    new ListItem(shippingInfo.ShippingType,
                                 shippingInfo.ShippingID.ToString()));
            }
            shippingSelection.SelectedIndex = 0;
        }
    }