/// <summary>
    /// Initializes copy from global link.
    /// </summary>
    protected void InitCopyFromGlobalLink()
    {
        // Nothing to be done
        if ((mMainCurrency == null) || string.IsNullOrEmpty(mMainCurrency.CurrencyCode))
        {
            return;
        }

        // Show copy from global link when not configuring global currencies.
        if (ConfiguredSiteID == 0)
        {
            return;
        }

        // Allow copying only if global main currency and site main currency are the same
        if (mMainCurrency.CurrencyCode != CurrencyInfoProvider.GetMainCurrencyCode(0))
        {
            return;
        }

        // Show "Copy from global" link only if there is at least one global exchange rate table
        DataSet ds = ExchangeTableInfoProvider.GetExchangeTables()
                     .TopN(1)
                     .OnSite(0)
                     .Column("ExchangeTableID");

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction
            {
                Text          = GetString("general.copyfromglobal"),
                OnClientClick = "return ConfirmCopyFromGlobal();",
                CommandName   = COPY_FROM_GLBOAL,
                ButtonStyle   = ButtonStyle.Default
            });

            CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;

            // Register javascript to confirm generate
            string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetLocalizedString("com.ConfirmExchangeTableFromGlobal") + ");}";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script));
        }
    }
Beispiel #2
0
    /// <summary>
    /// Initializes copy from global link.
    /// </summary>
    protected void InitCopyFromGlobalLink()
    {
        // Nothing to be done
        if ((mMainCurrency == null) || string.IsNullOrEmpty(mMainCurrency.CurrencyCode))
        {
            return;
        }

        // Show copy from global link when not configuring global currencies.
        if (ConfiguredSiteID != 0)
        {
            // Allow copying only if global main currency and site main currency are the same
            if (mMainCurrency.CurrencyCode == CurrencyInfoProvider.GetMainCurrencyCode(0))
            {
                string[,] actions = new string[2, 9];

                // Show "Copy from global" link only if there is at least one global exchange rate table
                DataSet ds = ExchangeTableInfoProvider.GetExchangeTables("ExchangeTableSiteID IS NULL", null, 1, "ExchangeTableID");
                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    actions[1, 0] = HeaderActions.TYPE_SAVEBUTTON;
                    actions[1, 1] = GetString("general.copyfromglobal");
                    actions[1, 2] = "return ConfirmCopyFromGlobal();";
                    actions[1, 3] = null;
                    actions[1, 4] = null;
                    actions[1, 5] = GetImageUrl("Objects/Ecommerce_ExchangeTable/fromglobal.png");
                    actions[1, 6] = "copyFromGlobal";
                    actions[1, 7] = String.Empty;
                    actions[1, 8] = true.ToString();

                    // Register javascript to confirm generate
                    string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmExchangeTableFromGlobal")) + ");}";
                    ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script));

                    this.CurrentMaster.HeaderActions.Actions          = actions;
                    this.CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed);
                }
            }
        }
    }
Beispiel #3
0
    /// <summary>
    /// Initializes copy from global link.
    /// </summary>
    protected void InitCopyFromGlobalLink()
    {
        // Nothing to be done
        if ((mMainCurrency == null) || string.IsNullOrEmpty(mMainCurrency.CurrencyCode))
        {
            return;
        }

        // Show copy from global link when not configuring global currencies.
        if (ConfiguredSiteID != 0)
        {
            // Allow copying only if global main currency and site main currency are the same
            if (mMainCurrency.CurrencyCode == CurrencyInfoProvider.GetMainCurrencyCode(0))
            {
                // Show "Copy from global" link only if there is at least one global exchange rate table
                DataSet ds = ExchangeTableInfoProvider.GetExchangeTables("ExchangeTableSiteID IS NULL", null, 1, "ExchangeTableID");
                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction
                    {
                        ControlType   = HeaderActionTypeEnum.Hyperlink,
                        Text          = GetString("general.copyfromglobal"),
                        OnClientClick = "return ConfirmCopyFromGlobal();",
                        ImageUrl      = GetImageUrl("Objects/Ecommerce_ExchangeTable/fromglobal.png"),
                        CommandName   = COPY_FROM_GLBOAL
                    });

                    CurrentMaster.HeaderActions.ActionPerformed += new CommandEventHandler(HeaderActions_ActionPerformed);

                    // Register javascript to confirm generate
                    string script = "function ConfirmCopyFromGlobal() {return confirm(" + ScriptHelper.GetString(GetString("com.ConfirmExchangeTableFromGlobal")) + ");}";
                    ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ConfirmCopyFromGlobal", ScriptHelper.GetScript(script));
                }
            }
        }
    }