[Quantproject-developers] QuantDownloader/Downloader DataBaseImporter.cs,1.3,1.4 TickerViewer.cs,1.2
Brought to you by:
glauco_1
|
From: <mi...@pr...> - 2004-01-26 15:58:09
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32282/Downloader Modified Files: DataBaseImporter.cs TickerViewer.cs WebDownloader.cs Log Message: Some bugs have been fixed and the code now is more readable Index: DataBaseImporter.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/DataBaseImporter.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DataBaseImporter.cs 30 Nov 2003 22:36:47 -0000 1.3 --- DataBaseImporter.cs 26 Jan 2004 15:57:15 -0000 1.4 *************** *** 60,65 **** myRow[ "quVolume" ]=Double.Parse( LineIn[5] ); myRow[ "quAdjustedClose" ]=Double.Parse( LineIn[6] ); ! myRow[ "quAdjustedOpen" ]=Convert.ToDouble(myRow[ "quOpen" ])* ! (Convert.ToDouble(myRow[ "quAdjustedClose" ])/Convert.ToDouble(myRow[ "quOpen" ])); // myRow["date"]=DateTime.Parse(LineIn[0]); --- 60,65 ---- myRow[ "quVolume" ]=Double.Parse( LineIn[5] ); myRow[ "quAdjustedClose" ]=Double.Parse( LineIn[6] ); ! //myRow[ "quAdjustedOpen" ]=Convert.ToDouble(myRow[ "quOpen" ])* ! // (Convert.ToDouble(myRow[ "quAdjustedClose" ])/Convert.ToDouble(myRow[ "quOpen" ])); // myRow["date"]=DateTime.Parse(LineIn[0]); Index: TickerViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerViewer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TickerViewer.cs 25 Jan 2004 19:10:54 -0000 1.2 --- TickerViewer.cs 26 Jan 2004 15:57:15 -0000 1.3 *************** *** 54,58 **** InitializeComponent(); this.oleDbConnection = ConnectionProvider.OleDbConnection; - this.oleDbConnection.Open(); this.tableTickers = new DataTable("tickers"); this.dataGrid1.DataSource = this.tableTickers; --- 54,57 ---- *************** *** 200,203 **** --- 199,204 ---- try { + Cursor.Current = Cursors.WaitCursor; + this.oleDbConnection.Open(); string criteria = "SELECT * FROM tickers WHERE tiTicker LIKE '" + this.textBoxStringToFind.Text + "'"; *************** *** 225,229 **** finally { ! ; } --- 226,231 ---- finally { ! Cursor.Current = Cursors.Default; ! this.oleDbConnection.Close(); } Index: WebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/WebDownloader.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WebDownloader.cs 25 Jan 2004 19:12:57 -0000 1.7 --- WebDownloader.cs 26 Jan 2004 15:57:15 -0000 1.8 *************** *** 42,53 **** // InitializeComponent(); this.Text = "Download quotes of all tickers in the database"; this.buttonDownloadQuotesOfSelectedTickers.Visible = false; // ! // TODO: Add any constructor code after InitializeComponent call ! // ! //this.oleDbDataAdapter1.Fill(this.dataSet11); ! this.OleDbConnection1.Open(); ! //this.OleDbConnection1.Close(); } --- 42,50 ---- // InitializeComponent(); + // this.Text = "Download quotes of all tickers in the database"; this.buttonDownloadQuotesOfSelectedTickers.Visible = false; // ! } *************** *** 58,70 **** // InitializeComponent(); this.Text = "Download quotes of selected tickers"; this.button1.Visible = false; this.tableOfSelectedTickers = tableOfSelectedTickers; // ! // TODO: Add any constructor code after InitializeComponent call ! // ! //this.oleDbDataAdapter1.Fill(this.dataSet11); ! this.OleDbConnection1.Open(); ! //this.OleDbConnection1.Close(); } --- 55,65 ---- // InitializeComponent(); + + // this.Text = "Download quotes of selected tickers"; this.button1.Visible = false; this.tableOfSelectedTickers = tableOfSelectedTickers; // ! } *************** *** 107,113 **** this.button1.Location = new System.Drawing.Point(48, 24); this.button1.Name = "button1"; ! this.button1.Size = new System.Drawing.Size(112, 24); this.button1.TabIndex = 0; ! this.button1.Text = "button1"; this.button1.Click += new System.EventHandler(this.button1_Click); // --- 102,108 ---- this.button1.Location = new System.Drawing.Point(48, 24); this.button1.Name = "button1"; ! this.button1.Size = new System.Drawing.Size(112, 32); this.button1.TabIndex = 0; ! this.button1.Text = "Download all Tickers\'quotes"; this.button1.Click += new System.EventHandler(this.button1_Click); // *************** *** 200,206 **** // buttonDownloadQuotesOfSelectedTickers // ! this.buttonDownloadQuotesOfSelectedTickers.Location = new System.Drawing.Point(48, 72); this.buttonDownloadQuotesOfSelectedTickers.Name = "buttonDownloadQuotesOfSelectedTickers"; ! this.buttonDownloadQuotesOfSelectedTickers.Size = new System.Drawing.Size(112, 24); this.buttonDownloadQuotesOfSelectedTickers.TabIndex = 2; this.buttonDownloadQuotesOfSelectedTickers.Text = "Download quotes"; --- 195,201 ---- // buttonDownloadQuotesOfSelectedTickers // ! this.buttonDownloadQuotesOfSelectedTickers.Location = new System.Drawing.Point(48, 80); this.buttonDownloadQuotesOfSelectedTickers.Name = "buttonDownloadQuotesOfSelectedTickers"; ! this.buttonDownloadQuotesOfSelectedTickers.Size = new System.Drawing.Size(112, 32); this.buttonDownloadQuotesOfSelectedTickers.TabIndex = 2; this.buttonDownloadQuotesOfSelectedTickers.Text = "Download quotes"; *************** *** 392,401 **** this.OleDbConnection1.Close(); } private void button1_Click(object sender, System.EventArgs e) { ! oleDbCommand1.Connection = this.OleDbConnection1; ! this.oleDbCommand1.ExecuteNonQuery(); ! downloadQuotes(); } --- 387,419 ---- this.OleDbConnection1.Close(); } + + private void openDbAndExecuteNonQuery() + { + try + { + Cursor.Current = Cursors.WaitCursor; + this.OleDbConnection1.Open(); + oleDbCommand1.Connection = this.OleDbConnection1; + this.oleDbCommand1.ExecuteNonQuery(); + + } + catch(Exception ex) + { + MessageBox.Show(ex.ToString()); + } + + finally + { + this.OleDbConnection1.Close(); + Cursor.Current = Cursors.Default; + } + + } + private void button1_Click(object sender, System.EventArgs e) { ! this.openDbAndExecuteNonQuery(); ! downloadQuotes(); } *************** *** 407,423 **** private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! try ! { ! Cursor.Current = Cursors.WaitCursor; ! oleDbCommand1.Connection = this.OleDbConnection1; ! this.oleDbCommand1.ExecuteNonQuery(); ! downloadQuotes(this.tableOfSelectedTickers); ! ! } ! finally ! { ! Cursor.Current = Cursors.Default; ! } ! } --- 425,430 ---- private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! this.openDbAndExecuteNonQuery(); ! downloadQuotes(this.tableOfSelectedTickers); } |