Ejemplo n.º 1
0
        public FirstInputForm()
        {
            InitializeComponent();

            nummericIntCollums = new List<String>();

            nummericFloatCollums = new List<String>();
            nummericFloatCollums.Add("AmountColumn");
            nummericFloatCollums.Add("PriceColumn");

            ExchangeRates = new ExchangeRate("http://www.cnb.cz/cs/financni_trhy/devizovy_trh/kurzy_devizoveho_trhu/denni_kurz.txt");

            resizeByDataGrid(dataGridView1);
        }
Ejemplo n.º 2
0
        public override void init(bool firstRun = true)
        {
            Status = "Připojování k databázi...";
            connector = Authorization.login(AppSettings.Nick, AppSettings.Password);
            connector.onError = new Action(()=>connectorErrorHandler(connector));
            SQL = new MySQLDriver(connector);
            Transfers = new Transfers(SQL);
            Currencies = new Currencies(SQL);
            ExchangeRates = new ExchangeRate("http://www.cnb.cz/cs/financni_trhy/devizovy_trh/kurzy_devizoveho_trhu/denni_kurz.txt");

            Status = "Inicializace...";

            if (firstRun)
            {

            }
            List<Currency> curlst = (Currencies).getList();
            if (!connector.IsConnected()) return;

            if (currencies != curlst)
            {
                currencies = curlst;
                comboBox1.Items.Clear();
                ((DataGridViewComboBoxColumn)dataGridView1.Columns["CurrencyColumn"]).Items.Clear();
                foreach (Currency cmpn in currencies)
                {
                    ((DataGridViewComboBoxColumn)dataGridView1.Columns["CurrencyColumn"]).Items.Add(cmpn.ToString());
                    comboBox1.Items.Add(cmpn.ToString());

                }
            }

            Status = "Stahuji aktuální kurzovní lístek ČNB...";
            comboBox1.Text = "EUR";
            kurz = ExchangeRates.getByDate(Currencies.getCurrency("EUR"), DateTime.Now);
            if (kurz == 0) MessageBox.Show("Dnešní kurzovní lístek není na webu ČNB k dispozici.");
            if (!connector.IsConnected()) return;

            textBox1.Text = kurz.ToString();

            initState = true;
            if (!connector.IsConnected())
            {
                handleError();
                return;
            }
            reload();
            refresh();
        }