Beispiel #1
0
 //непосредственная загрузка котировок и вывод в датагрид
 private void Update_toolStripButton_Click(object sender, EventArgs e)
 {
     if (openDBName != string.Empty)
     {
         string errMsg;
         //получение списка котировок из файла БД
         List <BidAskData> list = SQLiteWorker.DBSelectAll("data", out errMsg);
         if (string.IsNullOrEmpty(errMsg))
         {
             res_dataGridView.DataSource = list;
             res_dataGridView.Columns[0].DefaultCellStyle.Format = "dd.MM.yyyy HH:mm:ss";
             res_dataGridView.AutoResizeColumns();
             countRec_toolStripStatusLabel.Text = list.Count.ToString("N0");
             if (list.Count > 0)
             {
                 from_toolStripStatusLabel.Text = list[0].Date.ToString();
                 to_toolStripStatusLabel.Text   = list.Last().Date.ToString();
             }
         }
         else
         {
             MessageBox.Show(errMsg, "Загрузка данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Beispiel #2
0
        //открыть и загрузить котировки из БД
        private void Open_toolStripButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string errMsg;
                SQLiteWorker.SetDB(openFileDialog.FileName, out errMsg);
                if (string.IsNullOrEmpty(errMsg))
                {
                    countRec_toolStripStatusLabel.Text = "0";
                    from_toolStripStatusLabel.Text     = "-";
                    to_toolStripStatusLabel.Text       = "-";
                    openDBName     = Path.GetFileNameWithoutExtension(openFileDialog.FileName);
                    groupBox1.Text = "Данные из " + openDBName;
                    //непосредственная загрузка котировок и вывод в датагрид
                    Update_toolStripButton_Click(null, null);
                }
            }
        }