Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ru.cbr.www.DailyInfo dailyInfo = new ru.cbr.www.DailyInfo();
            var cursOnDate = dailyInfo.GetCursOnDate(DateTime.Today);
            var table      = cursOnDate.Tables[0];

            var columns = table.Columns;

            for (int i = 0; i < columns.Count; i++)
            {
                System.Diagnostics.Debug.WriteLine(columns[i]);
            }

            for (int i = 0; i < table.Rows.Count; i++)
            {
                var row = table.Rows[i];
                System.Diagnostics.Debug.WriteLine(row["Vname"].ToString().Trim() + "|" +
                                                   row["Vnom"] + "|" +
                                                   row["Vcurs"] + "|" +
                                                   row["Vcode"] + "|" +
                                                   row["VchCode"]);

                decimal price = decimal.Parse(row["Vcurs"].ToString()) / decimal.Parse(row["Vnom"].ToString());
                String  name  = row["VchCode"].ToString();

                prices.Add(name, price);
                listBox1.Items.Add(name);
                listBox2.Items.Add(name);
            }

            prices.Add("RUB", 1);
            listBox1.Items.Add("RUB");
            listBox2.Items.Add("RUB");

            listBox1.Sorted = true;
            listBox2.Sorted = true;

            listBox1.SelectedItem = "USD";
            listBox2.SelectedItem = "RUB";

            System.Diagnostics.Debug.WriteLine(cursOnDate);
        }
Beispiel #2
0
        public decimal GetCurrencyRateOnDate(DateTime onDate, string currencyCode)
        {
            var ds = _cbrClient.GetCursOnDate(onDate);

            return(ExtractCurrencyRate(ds, currencyCode));
        }