Esempio n. 1
0
        public void TestGetExchangeAmount()
        {
            Currency cur = new Currency();

            cur.id     = 1;
            cur.name   = "usd";
            cur.amount = 1;
            ExchangeCurrency exc  = new ExchangeCurrency();
            double           rate = exc.getExchangedAmount(cur);

            Assert.AreEqual(1, rate);
        }
        // GET: ExchangeCurrency
        public decimal GetExchangeAmount(Currency curr)
        {
            ExchangeCurrency exc = new ExchangeCurrency();

            decimal amount = 0;

            if (exc.getExchangeRate(curr) == 0)
            {
            }
            else
            {
                amount = (int)exc.getExchangedAmount(curr);
            }

            return(amount);
        }
        public string GetRecommendationExchange(Currency curr)
        {
            string res = "";

            ExchangeCurrency exc = new ExchangeCurrency();
            decimal          dec = exc.getExchangedAmount(curr);

            // get the nearest hundreds
            int decint = (int)dec;

            int rounded = ((decint + 99) / 100) * 100;

            decimal rate = exc.getExchangeRate(curr);

            decimal res1 = rounded * rate;

            res = "recommeded to get " + curr.name.ToUpper() + rounded + " by exchanging: SGD" + (int)res1;

            return(res);
        }
Esempio n. 4
0
        // GET: ExchangeCurrency
        public double GetExchangeAmount(Currency curr)
        {
            ExchangeCurrency exc = new ExchangeCurrency();

            return(exc.getExchangedAmount(curr));
        }