A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Add currency to Catalog Currency Directory

Vote:
 

Hi,

i want to add Currency to Catalog Currency Catalog programmatically. Because i want to enable it when adding new Market (also done from code)

I have found CurrencyManager but it does not feel right :-/

So what repo/service/Mgr should i use in order to add a currency to the  Catalog Currency Directory?

#207419
Edited, Sep 19, 2019 11:17
Vote:
 

        private void AddCurrencyToCatalogCurrencyDictionary(LanguageSetupInformation setup)
        {
            var currencyDto = CurrencyManager.GetCurrencyDto();
            var newCurrencyRow = currencyDto.Currency.NewCurrencyRow();
            newCurrencyRow.CurrencyCode = setup.Currency.CurrencyCode;
            newCurrencyRow.Name = setup.CultureInfo.GetRegion().CurrencyEnglishName;
            currencyDto.Currency.AddCurrencyRow(newCurrencyRow);
            CurrencyManager.SaveCurrency(currencyDto);
        }

Big thanks to Roger at Epi

#207422
Sep 19, 2019 12:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.