/// <summary>
    /// Reloads shopping cart item selector data.
    /// </summary>
    public void ReloadData()
    {
        if (SKUID <= 0)
        {
            return;
        }

        DebugHelper.SetContext("ShoppingCartItemSelector");

        InitializeControls();

        if (ShowProductOptions)
        {
            LoadProductOptions();
        }

        // Fill units textbox with default quantity
        if (ShowUnitsTextBox)
        {
            if (String.IsNullOrWhiteSpace(txtUnits.Text))
            {
                txtUnits.Text = DefaultQuantity.ToString();
            }
        }

        mDataLoaded = true;
        DebugHelper.ReleaseContext();
    }
    /// <summary>
    /// Reloads shopping cart item selector data.
    /// </summary>
    public void ReloadData()
    {
        if (SKUID <= 0)
        {
            return;
        }

        DebugHelper.SetContext("ShoppingCartItemSelector");

        InitializeControls();

        if (ShowProductOptions)
        {
            LoadProductOptions();
        }

        // If donation properties should be shown and SKU product type is donation
        if (ShowDonationProperties && (SKU != null) && (SKU.SKUProductType == SKUProductTypeEnum.Donation))
        {
            donationProperties.Visible        = true;
            donationProperties.StopProcessing = false;
            donationProperties.SKU            = SKU;
            donationProperties.ShoppingCart   = ShoppingCart;
            donationProperties.ReloadData();
        }

        // Get count of the product options
        if (AlwaysShowTotalPrice || (ShowTotalPrice && SKUHasOptions))
        {
            // Count and show total price with options
            CalculateTotalPrice();
        }

        // Fill units textbox with default quantity
        if (ShowUnitsTextBox)
        {
            if (txtUnits.Text.Trim() == "")
            {
                txtUnits.Text = DefaultQuantity.ToString();
            }
        }

        mDataLoaded = true;
        DebugHelper.ReleaseContext();
    }
Пример #3
0
        internal override void WriteXml(XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("add_on");

            xmlWriter.WriteElementString("add_on_code", AddOnCode);
            xmlWriter.WriteElementString("name", Name);
            xmlWriter.WriteElementString("default_quantity", DefaultQuantity.AsString());
            xmlWriter.WriteElementString("accounting_code", AccountingCode);

            if (AddOnType.HasValue)
            {
                xmlWriter.WriteElementString("add_on_type", AddOnType.Value.ToString().EnumNameToTransportCase());
            }

            if (UsageType.HasValue)
            {
                xmlWriter.WriteElementString("usage_type", UsageType.Value.ToString().EnumNameToTransportCase());
            }

            if (MeasuredUnitId.HasValue)
            {
                xmlWriter.WriteElementString("measured_unit_id", MeasuredUnitId.ToString());
            }

            if (DisplayQuantityOnHostedPage.HasValue)
            {
                xmlWriter.WriteElementString("display_quantity_on_hosted_page", DisplayQuantityOnHostedPage.Value.AsString());
            }

            if (Optional.HasValue)
            {
                xmlWriter.WriteElementString("optional", Optional.Value.AsString());
            }

            xmlWriter.WriteIfCollectionHasAny("unit_amount_in_cents", UnitAmountInCents, pair => pair.Key,
                                              pair => pair.Value.AsString());

            xmlWriter.WriteEndElement();
        }