Exemplo n.º 1
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            shoppingCartItemSelector.StopProcessing = true;
            return;
        }

        // Set description
        lblDescription.Text = HTMLHelper.HTMLEncode(Description);

        // Initialize donation properties
        donationProperties.SKU                   = DonationSKU;
        donationProperties.Visible               = (!ShowInDialog && (DonationSKU != null));
        donationProperties.ShowDonationAmount    = ShowAmountTextbox;
        donationProperties.ShowCurrencyCode      = ShowCurrencyCode;
        donationProperties.ShowDonationUnits     = ShowUnitsTextbox;
        donationProperties.ShowDonationIsPrivate = AllowPrivateDonation;

        if ((DonationAmount > 0) && !donationProperties.DonationAmountInitialized)
        {
            // Get amount in cart currency
            double amount = ECommerceContext.CurrentShoppingCart.ApplyExchangeRate(DonationAmount);

            donationProperties.DonationAmount = amount;
        }

        // Initialize shopping cart item selector control
        if (DonationSKU != null)
        {
            shoppingCartItemSelector.SKUID = DonationSKU.SKUID;
        }

        if (!String.IsNullOrEmpty(ControlImage))
        {
            shoppingCartItemSelector.AddToCartImageButton = ControlImage;
        }
        else
        {
            if (ControlType.ToUpperCSafe() == "BUTTON")
            {
                shoppingCartItemSelector.AddToCartText = ControlText;
            }
            else
            {
                shoppingCartItemSelector.AddToCartLinkText = HTMLHelper.HTMLEncode(ControlText);
            }
        }

        shoppingCartItemSelector.AddToCartTooltip     = ControlTooltip;
        shoppingCartItemSelector.SKUEnabled           = true;
        shoppingCartItemSelector.OnAddToShoppingCart += new CancelEventHandler(shoppingCartItemSelector_OnAddToShoppingCart);
    }