public CCash(double Amount, eCurrency CurrencyType) { Price = Amount; Currency = CurrencyType; mLiquidity = eLiquidity.Instant; mAssetType = eAssetType.Current; mAssetBalanceSheetDescriptor = eAssetBalanceSheetDescriptor.CashAndEquivalents; }
public CurrentAsset(double Amount, eCurrency CurrencyType) { mPrice.Amount = Amount; mCurrency = (CCurrency)CurrencyType; mLiquidity = eLiquidity.Instant; mAssetType = eAssetType.Current; mAssetBalanceSheetDescriptor = eAssetBalanceSheetDescriptor.CashAndEquivalents; }
/// <summary> /// Get the instance of the currency that corresponds to the type of currency /// the user wishes. /// </summary> /// <returns>The currency.</returns> /// <param name="WhichCurrency">Which currency.</param> public static CCurrency GetCurrency(eCurrency WhichCurrency) { if (!mInstances.ContainsKey(WhichCurrency)) { throw new Exception("Failed to retrieve currency."); } return(mInstances[WhichCurrency]); }
public static Currency Get(eCurrency currencyCode) { if (CurrencyDictionary.ContainsKey(currencyCode)) { return(CurrencyDictionary[currencyCode]); } else { return(null); } }
/// <summary> /// Constructs a currency object with a NumberFormatInfo. /// </summary> /// <param name="currencyCode"></param> public Currency(eCurrency currencyCode) { CurrencyCode = currencyCode; Code = System.Enum.GetName(typeof(eCurrency), CurrencyCode); var cultureInfo = CultureInfoFromCurrencyISO(Code); NumberFormat = cultureInfo.NumberFormat; var region = new RegionInfo(cultureInfo.LCID); Symbol = region?.CurrencySymbol; EnglishName = region?.CurrencyEnglishName; NativeName = region?.CurrencyNativeName; }
/// <summary> /// Converts to another currency. /// </summary> /// <param name="TheNewCurrency">The new currency.</param> public void ConvertToCurrency(eCurrency TheNewCurrency) { // Get the latest currency rates. this.Publish <CCurrencyUpdate>(); // Cache the current conversion rate. double CurrentConversionRate = Currency.ConversionToUSDRate; // Get the instance of the currency. mCurrency = CCurrency.GetCurrency(TheNewCurrency); // Convert the USD to the new currency. Amount *= CurrentConversionRate * Currency.ConversionToUSDRate; }
public CMoney(double TheAmount, eCurrency TheCurrency) { mAmount = TheAmount; mCurrency = CCurrency.GetCurrency(TheCurrency); }
public static string GetCurrencySymbol(this eCurrency TheCurrency) { return(TheCurrency.GetAttribute <CurrencyDescriptor>().Symbol); }
public static string GetCurrencyDescription(this eCurrency TheCurrency) { return(TheCurrency.GetAttribute <CurrencyDescriptor>().Description); }
public static string GetCurrencyCode(this eCurrency TheCurrency) { return(TheCurrency.GetAttribute <CurrencyDescriptor>().Code); }
public static bool Exists(eCurrency currencyCode) { return(CurrencyDictionary.ContainsKey(currencyCode)); }
private CCurrency(eCurrency TheType) : this() { // Call update to get the conversion rate. //Update(); }
private CCurrency(eCurrency TheType, double ConversionToUSD) : this() { mType = TheType; mConversionToUSDRate = ConversionToUSD; }