Esempio n. 1
0
        private Single ConvertInUAH()
        {
            CryptoCourse.ExchangeInfo cours = null;

            switch (transaction.PaymentId)
            {
            case 1:
            {
                cours = CryptoCourse.GetExchangeInfo("UAH", "BTC");
                break;
            }

            case 3:
            {
                cours = CryptoCourse.GetExchangeInfo("UAH", "ETH");
                break;
            }

            case 4:
            {
                cours = CryptoCourse.GetExchangeInfo("UAH", "XRP");
                break;
            }
            }


            Single perOne = Convert.ToSingle(transaction.SumPayNew * Convert.ToDecimal(cours.Last));

            return(perOne);
        }
Esempio n. 2
0
        private Boolean ConvertInUSD(TelegramBotClient botClient, Message _message)
        {
            CryptoCourse.ExchangeInfo cours = null;
            switch (transaction.PaymentId)
            {
            case 1:
            {
                cours = CryptoCourse.GetExchangeInfo("USD", "BTC");
                break;
            }

            case 3:
            {
                cours = CryptoCourse.GetExchangeInfo("USD", "ETH");
                break;
            }

            case 4:
            {
                cours = CryptoCourse.GetExchangeInfo("USD", "XRP");
                break;
            }

            default:
                SumPay = 0;
                return(false);
            }

            Decimal perOne = (Decimal)(1 / cours.Last);

            if (!CheckSumPay(2, perOne))
            {
                return(false);
            }

            SumPay *= perOne;
            SumPay  = Math.Round(SumPay, 6);
            return(true);
        }