CurrencyConverterGetExchangeRate Method (Boolean, String, Int32) |
Note: This API is now obsolete.
Calculates exchange rate for conversion from main currency to different currency.
Example: if 1 USD = 16 CZK then this method returns 1/16 = 0.0625 for conversion from USD to CZK.
Namespace: CMS.EcommerceAssembly: CMS.Ecommerce (in CMS.Ecommerce.dll) Version: 13.0.131
Syntax [ObsoleteAttribute("Use 'CMS.Core.Service.Resolve<ICurrencyConverterService>().GetExchangeRate(System.Boolean, System.String, System.Int32)' instead.")]
public static decimal GetExchangeRate(
bool fromGlobalMain,
string toCurrencyCode,
int siteID
)
Parameters
- fromGlobalMain
- Type: SystemBoolean
Indicates if conversion is done from global main currency or from site main currency. - toCurrencyCode
- Type: SystemString
Code of currency to convert amount to, e.g. USD, EUR. - siteID
- Type: SystemInt32
ID of the site for which the rate is calculated.
Return Value
Type:
DecimalExchange rate from main currency to another currency on specific site.
Exceptions Exception | Condition |
---|
ArgumentException | Thrown when currency with given code does not exist in the system. |
InvalidCurrencyConversionException | Thrown when conversion fails (e.g. exchange rate not found). |
See Also