コード例 #1
0
 // 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);
     }
 }
コード例 #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);
        }
    }
コード例 #3
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);
            }
        }
コード例 #4
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;
    }
    // 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;
        }
    }
コード例 #6
0
ファイル: Checkout.aspx.cs プロジェクト: angelinn/E-Business
        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;
            }
        }
コード例 #7
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;
        }
    }