Ejemplo n.º 1
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (plcSelector.Visible)
        {
            // Get product name and price
            SKUInfo skuObj  = SKUInfoProvider.GetSKUInfo(this.SKUID);
            string  skuName = "";

            if (skuObj != null)
            {
                lblPriceValue.Text = SKUInfoProvider.GetSKUFormattedPrice(skuObj, this.ShoppingCartObj, true, false);
                skuName            = ResHelper.LocalizeString(skuObj.SKUName);
            }

            // Set SKU name label
            this.lblSKUName.Text = skuName;

            // Show info text
            this.lblPrice.Text = GetString("Order_Edit_AddItems.UnitPrice");

            // Initializes page title control
            string[,] tabs = new string[2, 3];
            tabs[0, 0]     = GetString("Order_Edit_AddItems.Products");
            tabs[0, 1]     = "~/CMSModules/Ecommerce/Pages/Tools/Orders/Order_Edit_AddItems.aspx?cart=" + HTMLHelper.HTMLEncode(QueryHelper.GetString("cart", ""));
            tabs[0, 2]     = "";
            tabs[1, 0]     = skuName;
            tabs[1, 1]     = "";
            tabs[1, 2]     = "";
            PageTitleAddItems.Breadcrumbs = tabs;
        }
    }
    private object gridProducts_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        DataRowView row = null;

        switch (sourceName.ToLowerCSafe())
        {
        case "skuname":
            row = (DataRowView)parameter;
            string skuName = ValidationHelper.GetString(row["SKUName"], "");
            int    skuId   = ValidationHelper.GetInteger(row["SKUID"], 0);

            // Create link for adding one item using product name
            LinkButton link = new LinkButton();
            link.Text            = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(skuName));
            link.Click          += btnAddOneUnit_Click;
            link.CommandArgument = skuId.ToString();

            return(link);

        case "price":
            // Format product price
            row = (DataRowView)parameter;
            return(SKUInfoProvider.GetSKUFormattedPrice(new SKUInfo(row.Row), ShoppingCartObj, true, false));

        case "quantity":
            int id = ValidationHelper.GetInteger(parameter, 0);

            // Create textbox for entering quantity
            CMSTextBox tb = new CMSTextBox();
            tb.MaxLength = 9;
            tb.Width     = 50;
            tb.ID        = "txtQuantity" + id;

            // Add textbox to dictionary under SKUID key
            quantityControls.Add(id, tb);

            return(tb);
        }

        return(parameter);
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns formatted SKU catalog price based on the SKU data and the data of the current shopping cart.
 /// Catalog discounts and/or taxes are included optionally.
 /// </summary>
 /// <param name="discounts">True - catalog discounts are applied to the price</param>
 /// <param name="taxes">True - catalog taxes are applied to the discounted price</param>
 /// <param name="column">SKU column from which the price should be returned. If empty, SKUPrice column is used.</param>
 public string GetSKUFormattedPrice(bool discounts, bool taxes, string column)
 {
     return(SKUInfoProvider.GetSKUFormattedPrice(SKU, null, discounts, taxes, column));
 }