Пример #1
0
        public Account CreateAccount(User.User user, currency cur)
        {
            Account account = new Account();

            account.CreateDate = DateTime.Now.AddMonths(rnd.Next(1, 12) * -1);
            account.Number     = cur.ToString().ToUpper() + rnd.Next();
            account.Balance    = 0;
            account.UserId     = user.Id;
            account.Currency   = cur;
            return(account);
        }
Пример #2
0
        public decimal getRate(DateTime date, currency currency)
        {
            if (currency == currency.RUR)
            {
                return(1);
            }
            DailyInfo cbrClient = new DailyInfo();

            cbrClient.Proxy = new WebProxy("http://msk01-wsncls02.uralsibins.ru:8080")
            {
                Credentials = new NetworkCredential(@"uralsibins\svcTinkoff", "USER4tinkoff"),
            };
            XmlNode       resultXml  = cbrClient.GetCursOnDateXML(date);
            XmlSerializer serializer = new XmlSerializer(typeof(ValuteData));
            ValuteData    result     = (ValuteData)serializer.Deserialize(new StringReader(resultXml.OuterXml));

            return(result.ValuteCursOnDate.Single(A => A.VchCode, currency.ToString()).Vcurs);
        }
 public static RateHistoryRequestBase CreateRateHistory(currency termCurrency, currency baseCurrency, provider currencyProvder)
 {
     if (currencyProvder == provider.Yahoo)
     {
         return(new YahooRateRequest(currencyProvder, baseCurrency, termCurrency)
         {
             method = "spotRateHistory",
             data = new Data()
             {
                 period = rateHistoyPeriod.day.ToString(),
                 term = termCurrency.ToString(),
                 @base = baseCurrency.ToString()
             }
         });
     }
     else
     {
         return(null);
     }
 }