Exemplo n.º 1
0
        public CCash(double Amount, eCurrency CurrencyType)
        {
            Price    = Amount;
            Currency = CurrencyType;

            mLiquidity = eLiquidity.Instant;
            mAssetType = eAssetType.Current;
            mAssetBalanceSheetDescriptor = eAssetBalanceSheetDescriptor.CashAndEquivalents;
        }
Exemplo n.º 2
0
        public CurrentAsset(double Amount, eCurrency CurrencyType)
        {
            mPrice.Amount = Amount;
            mCurrency     = (CCurrency)CurrencyType;

            mLiquidity = eLiquidity.Instant;
            mAssetType = eAssetType.Current;
            mAssetBalanceSheetDescriptor = eAssetBalanceSheetDescriptor.CashAndEquivalents;
        }
Exemplo n.º 3
0
        /// <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]);
        }
Exemplo n.º 4
0
 public static Currency Get(eCurrency currencyCode)
 {
     if (CurrencyDictionary.ContainsKey(currencyCode))
     {
         return(CurrencyDictionary[currencyCode]);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 5
0
        /// <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;
        }
Exemplo n.º 6
0
        /// <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;
        }
Exemplo n.º 7
0
 public CMoney(double TheAmount, eCurrency TheCurrency)
 {
     mAmount   = TheAmount;
     mCurrency = CCurrency.GetCurrency(TheCurrency);
 }
Exemplo n.º 8
0
 public static string GetCurrencySymbol(this eCurrency TheCurrency)
 {
     return(TheCurrency.GetAttribute <CurrencyDescriptor>().Symbol);
 }
Exemplo n.º 9
0
 public static string GetCurrencyDescription(this eCurrency TheCurrency)
 {
     return(TheCurrency.GetAttribute <CurrencyDescriptor>().Description);
 }
Exemplo n.º 10
0
 public static string GetCurrencyCode(this eCurrency TheCurrency)
 {
     return(TheCurrency.GetAttribute <CurrencyDescriptor>().Code);
 }
Exemplo n.º 11
0
 public static bool Exists(eCurrency currencyCode)
 {
     return(CurrencyDictionary.ContainsKey(currencyCode));
 }
Exemplo n.º 12
0
 private CCurrency(eCurrency TheType) : this()
 {
     // Call update to get the conversion rate.
     //Update();
 }
Exemplo n.º 13
0
 private CCurrency(eCurrency TheType, double ConversionToUSD) : this()
 {
     mType = TheType;
     mConversionToUSDRate = ConversionToUSD;
 }