[Quantproject-developers] QuantDownloader/Downloader/Validate QuotesToBeValidated.cs,1.4,1.5 Validat
Brought to you by:
glauco_1
|
From: <mi...@pr...> - 2004-01-23 04:47:45
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/Validate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12428/Downloader/Validate Modified Files: QuotesToBeValidated.cs ValidateDataGrid.cs ValidateDataTable.cs Log Message: Added new constructors, methods on overload and new members in order to interact with TickerViewer object Index: QuotesToBeValidated.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Validate/QuotesToBeValidated.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QuotesToBeValidated.cs 21 Dec 2003 21:18:53 -0000 1.4 --- QuotesToBeValidated.cs 22 Jan 2004 23:46:57 -0000 1.5 *************** *** 24,28 **** public QuotesToBeValidated( string tickerIsLike ) ! { // this.selectStatement = // "select * from quotes where quTicker like '" + tickerIsLike + "'"; --- 24,28 ---- public QuotesToBeValidated( string tickerIsLike ) ! { // this.selectStatement = // "select * from quotes where quTicker like '" + tickerIsLike + "'"; *************** *** 39,43 **** Console.WriteLine( exception.ToString() ); } ! } // public delegate void SuspiciousDataRowEventHandler( --- 39,64 ---- Console.WriteLine( exception.ToString() ); } ! } ! ! public QuotesToBeValidated(DataTable tableOfTickersToBeValidated) ! { ! this.oleDbDataAdapter = ! new OleDbDataAdapter( "" , ConnectionProvider.OleDbConnection ); ! foreach(DataRow row in tableOfTickersToBeValidated.Rows) ! { ! this.oleDbDataAdapter.SelectCommand.CommandText = ! "select * from quotes where quTicker = '" + ! (string)row[0] + "'"; ! try ! { ! this.oleDbDataAdapter.Fill( this ); ! } ! catch (Exception exception) ! { ! Console.WriteLine( exception.ToString() ); ! } ! } ! ! } // public delegate void SuspiciousDataRowEventHandler( Index: ValidateDataGrid.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Validate/ValidateDataGrid.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ValidateDataGrid.cs 21 Dec 2003 21:17:46 -0000 1.2 --- ValidateDataGrid.cs 22 Jan 2004 23:47:00 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- using System; using System.Windows.Forms; + using System.Data; namespace QuantProject.Applications.Downloader.Validate *************** *** 56,59 **** --- 57,71 ---- return this.validateDataTable; } + public ValidateDataTable Validate(DataTable dataTable, string suspiciousRatio ) + { + this.validateDataTable = new ValidateDataTable(dataTable); + this.DataSource = validateDataTable; + if ( this.TableStyles.Count == 0 ) + // styles have not been defined yet + validate_setTableStyle(); + validateDataTable.AddRows(Convert.ToDouble( suspiciousRatio ) ); + return this.validateDataTable; + } + #endregion } Index: ValidateDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Validate/ValidateDataTable.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ValidateDataTable.cs 21 Dec 2003 21:16:04 -0000 1.5 --- ValidateDataTable.cs 22 Jan 2004 23:47:02 -0000 1.6 *************** *** 16,19 **** --- 16,20 ---- private OleDbCommandBuilder oleDbCommandBuilder; private OleDbDataAdapter oleDbDataAdapter; + private DataTable tableOfTickersToBeValidated; public ValidateDataTable() *************** *** 27,32 **** --- 28,47 ---- this.oleDbDataAdapter.Fill( this ); this.TableName = "quotes"; + } + public ValidateDataTable(DataTable tableOfTickers) + { + this.tableOfTickersToBeValidated = tableOfTickers; + + this.selectStatement = + "select * from quotes where 1=2"; + this.oleDbDataAdapter = + new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); + this.oleDbCommandBuilder = new OleDbCommandBuilder( oleDbDataAdapter ); + this.oleDbDataAdapter.UpdateCommand = this.oleDbCommandBuilder.GetUpdateCommand(); + this.oleDbDataAdapter.Fill( this ); + this.TableName = "quotes"; + } /// <summary> /// Adds quotesRow to the ValidateDataTable *************** *** 53,57 **** this.AcceptChanges(); } ! /// <summary> /// Commits the ValidateDataTable changes to the database --- 68,81 ---- this.AcceptChanges(); } ! public void AddRows(double suspiciousRatio ) ! { ! QuotesToBeValidated quotesToBeValidated = new QuotesToBeValidated(this.tableOfTickersToBeValidated); ! quotesToBeValidated.SuspiciousRatio = suspiciousRatio; ! quotesToBeValidated.SuspiciousDataRow += ! new SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler ); ! // new QuotesToBeValidated.SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler ); ! quotesToBeValidated.Validate(); ! this.AcceptChanges(); ! } /// <summary> /// Commits the ValidateDataTable changes to the database |