Table of Contents

Class CurrencyService

Namespace
Dynamicweb.Ecommerce.International
Assembly
Dynamicweb.Ecommerce.dll
Currency service provides operations for working with the currency model
public class CurrencyService : ICacheStorage<string, Currency>, ICacheStorage<string>, ICacheStorage
Inheritance
CurrencyService
Implements
Inherited Members

Methods

CleanDefault()

Remove default property from currencies.
public void CleanDefault()

ClearCache()

Resets all keys to the default value for objects stored in the object cache
public void ClearCache()

ClearCache(IEnumerable<string>)

Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<string> keys)

Parameters

keys IEnumerable<string>
Keys to reset

ClearCache(string)

Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(string key)

Parameters

key string
Key to reset

Delete(string)

Deletes an instance with the specified parameters.
public void Delete(string currencyCode)

Parameters

currencyCode string
The currency code.

Delete(string, string)

Deletes an instance with the specified parameters.
[Obsolete("")]
public void Delete(string currencyCode, string languagId)

Parameters

currencyCode string
The currency code.
languagId string
The language id.

Format(Currency, double)

Formats the specified value according to the currency settings.
public string Format(Currency currency, double value)

Parameters

currency Currency
The currency to use for formatting the value
value double
The value - the price to format to a string.

Returns

string
The formatted value.

Format(Currency, double, bool)

Formats the specified value according to the currency settings.
public string Format(Currency currency, double value, bool showSymbol)

Parameters

currency Currency
The currency to use for formatting the value
value double
The value - the price to format to a string.
showSymbol bool
if set to true includes the currency symbol.

Returns

string
The formatted value.

FormatCurrency(Currency, double, bool)

Formats the currency using the currency rounding method.
public string FormatCurrency(Currency currency, double value, bool showSymbol)

Parameters

currency Currency
The currency to use for formatting the value
value double
The value to format to a currency.
showSymbol bool
if set to true show the currency symbol, i.e. $, £, € or DKK.

Returns

string
System.String., i.e. $1,000.23 or DKK 1.000,23 or €1.000,23

FormatCurrency(Currency, double, bool, bool)

Formats the currency to a currency string. Rounding is either handled by the currency rounding or to nearest 2 decimals.
public string FormatCurrency(Currency currency, double value, bool showSymbol, bool useCurrencyRounding)

Parameters

currency Currency
The currency to use for formatting the value
value double
The value to format to a currency.
showSymbol bool
if set to true show the currency symbol, i.e. $, £, € or DKK.
useCurrencyRounding bool
if set to true the rounding specified on the currency will be used for rounding, otherwise the value is rounded to 2 decimals.

Returns

string
System.String., i.e. $1,000.23 or DKK 1.000,23 or €1.000,23

GetAllCurrencies()

Gets all currencies.
public IEnumerable<Currency> GetAllCurrencies()

Returns

IEnumerable<Currency>
A collection of the Currency.

GetCurrencies()

Gets all currencies.
[Obsolete("Use GetAllCurrencies instead.")]
public CurrencyCollection GetCurrencies()

Returns

CurrencyCollection
A collection of the Currency.

GetCurrenciesForCode(string)

Gets all currencies by the specified parameters.
[Obsolete("Use GetCurrency instead. There will never be more than one currency matching a given currency code.")]
public IEnumerable<Currency> GetCurrenciesForCode(string currencyCode)

Parameters

currencyCode string
The currency code.

Returns

IEnumerable<Currency>
A collection of the Currency.

GetCurrenciesForLanguage(string)

Gets all currencies by the specified parameters.
[Obsolete("Use GetAllCurrencies instead.")]
public CurrencyCollection GetCurrenciesForLanguage(string languageId)

Parameters

languageId string
The language id.

Returns

CurrencyCollection
A collection of the Currency.

GetCurrency(string)

Gets a currency by currency code.
public Currency GetCurrency(string currencyCode)

Parameters

currencyCode string
The currency code.

Returns

Currency
An instance of Currency, if found, otherwise null.

GetCurrency(string, string)

Gets the currency.
[Obsolete("Use the overload without languageId and then use Translations on the currency.")]
public Currency GetCurrency(string currencyCode, string languageId)

Parameters

currencyCode string
The currency code.
languageId string
The language id.

Returns

Currency
A currency Currency.

GetCurrencyForCode(string)

Gets the currency ignoring language.
[Obsolete("Use GetCurrency instead.")]
public Currency GetCurrencyForCode(string currencyCode)

Parameters

currencyCode string
The currency code.

Returns

Currency
A collection of the Currency.

GetDefaultCurrency()

Gets the default currency.
public Currency GetDefaultCurrency()

Returns

Currency
A currency Currency.

GetNumberFormatInfo(Currency)

Returns number format info related to specified currency. If currency's culture info is not found, get number format info from execution context.
public NumberFormatInfo GetNumberFormatInfo(Currency currency)

Parameters

currency Currency
The currency to provide number format info.

Returns

NumberFormatInfo
The NumberFormatInfo object.

Round(Currency, double)

Rounds the value.
public double Round(Currency currency, double value)

Parameters

currency Currency
value double
The value.

Returns

double
The rounded value.

Save(Currency)

Saves a currency instance
public void Save(Currency currency)

Parameters

currency Currency
The currency.

UpdateCurrencyCode(string, string)

Update currency and its relations with a new Code.
public void UpdateCurrencyCode(string oldCode, string newCode)

Parameters

oldCode string
The old code.
newCode string
The new code.

UpdateForAllLanguages(Currency)

Updates currency for all languages.
[Obsolete("Use Save instead.")]
public void UpdateForAllLanguages(Currency currency)

Parameters

currency Currency
The currency.
To top