[Quantproject-developers] QuantDownloader/Downloader/TickerSelectors TickerGroupsViewer.cs,1.8,1.9
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-08-27 19:21:44
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3981/Downloader/TickerSelectors Modified Files: TickerGroupsViewer.cs Log Message: Modified database's structure. New fields added to tickers_tickerGroups table. Index: TickerGroupsViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerGroupsViewer.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TickerGroupsViewer.cs 10 Jun 2005 18:35:30 -0000 1.8 --- TickerGroupsViewer.cs 27 Aug 2005 19:21:35 -0000 1.9 *************** *** 32,35 **** --- 32,36 ---- using QuantProject.Data.DataTables; using QuantProject.Data.Selectors; + using QuantProject.ADT; namespace QuantProject.Applications.Downloader.TickerSelectors *************** *** 539,543 **** this.oleDbConnection.Open(); this.oleDbDataAdapter.SelectCommand.CommandText = ! "SELECT ttTiId, tiCompanyName, ttTgId FROM tickers INNER JOIN " + "tickers_tickerGroups ON tickers.tiTicker = tickers_tickerGroups.ttTiId WHERE ttTgId ='" + (string)selectedNode.Tag + "'"; --- 540,544 ---- this.oleDbConnection.Open(); this.oleDbDataAdapter.SelectCommand.CommandText = ! "SELECT DISTINCT ttTiId, tiCompanyName, ttTgId FROM tickers INNER JOIN " + "tickers_tickerGroups ON tickers.tiTicker = tickers_tickerGroups.ttTiId WHERE ttTgId ='" + (string)selectedNode.Tag + "'"; *************** *** 760,786 **** } ! private bool isRowInsertedInDataBase(DataRow row) { ! try ! { ! this.oleDbDataAdapter.InsertCommand = ! new OleDbCommand("INSERT INTO tickers_tickerGroups(ttTiId, ttTgId) " + ! "VALUES('" + (string)row[0] + "','" + ! (string)this.treeViewGroups.SelectedNode.Tag + "')", this.oleDbConnection); ! if(this.oleDbDataAdapter.InsertCommand.ExecuteNonQuery()>0) ! { ! return true; ! } ! else ! { ! return false; ! } ! } ! catch(Exception ex) ! { ! string neverUsed = ex.ToString(); ! return false; ! } ! } --- 761,770 ---- } ! private void insertRow(DataRow row) { ! QuantProject.DataAccess.Tables.Tickers_tickerGroups.Add((string)row[0], ! (string)this.treeViewGroups.SelectedNode.Tag, ! EventType.Entry, ! ConstantsProvider.DefaultDateForTickersAddedToGroups); } *************** *** 831,846 **** if(this.oleDbConnection.State != ConnectionState.Open) this.oleDbConnection.Open(); - int numRowsInserted = 0; foreach (DataRow row in tickers.Rows) ! { ! if(this.isRowInsertedInDataBase(row)) ! numRowsInserted ++; ! } ! if(numRowsInserted != tickers.Rows.Count) ! MessageBox.Show("Some selected tickers have not been added", ! "Warning after paste operation", MessageBoxButtons.OK, ! MessageBoxIcon.Exclamation); this.updateListView(this.treeViewGroups.SelectedNode); - } catch(Exception ex) --- 815,821 ---- if(this.oleDbConnection.State != ConnectionState.Open) this.oleDbConnection.Open(); foreach (DataRow row in tickers.Rows) ! this.insertRow(row); this.updateListView(this.treeViewGroups.SelectedNode); } catch(Exception ex) |