예제 #1
0
        private decimal CalculateExchangeRate(string symbol)
        {
            var firstChars = symbol.Substring(0, 3);

            switch (firstChars)
            {
            case "USD":
                return(ExchangeRates.GetUsd());

            case "GOL":
                return(ExchangeRates.GetUsd());

            case "AUD":
                return(ExchangeRates.GetAud());

            case "JPY":
                return(ExchangeRates.GetJpy());

            case "NZD":
                return(ExchangeRates.GetNzd());

            case "EUR":
                return(ExchangeRates.GetEur());

            case "GBP":
                return(ExchangeRates.GetGbp());

            case "CHF":
                return(ExchangeRates.GetChf());

            case "CAD":
                return(ExchangeRates.GetCad());

            case "PLN":
                return(1);

            default:
                Console.WriteLine("nieznana waluta");
                return(0);
            }
        }