[Quantproject-developers] QuantProject/b7_Scripts/CallingReportsForRunScripts ShowReportFromFile.cs,
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-06-10 18:45:58
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunScripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19231/b7_Scripts/CallingReportsForRunScripts Modified Files: ShowReportFromFile.cs Log Message: Added the function to ShowReportFromFile for retrieving a report, through the ReportShower, from a serialized TransactionHistory object; Added new MenuItem to Main form for creating report from a serialized transaction History; Added new MenuItem to Report form for saving the TransactionHistory on which the current showed report is based Index: ShowReportFromFile.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunScripts/ShowReportFromFile.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ShowReportFromFile.cs 17 Apr 2005 13:31:50 -0000 1.4 --- ShowReportFromFile.cs 10 Jun 2005 18:45:44 -0000 1.5 *************** *** 21,28 **** --- 21,30 ---- */ using System; + using System.Collections; using QuantProject.Scripts; using QuantProject.Business.Timing; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; + using QuantProject.Business.Financial.Accounting.Transactions; using QuantProject.Business.DataProviders; using QuantProject.ADT.FileManaging; *************** *** 47,51 **** (Account)ObjectArchiver.Extract(serializedAccountFullPath); Report report = new Report(account, new HistoricalAdjustedQuoteProvider()); ! report.Text = serializedAccountFullPath.Substring(serializedAccountFullPath.LastIndexOf("\\") + 1); ReportShower reportShower = new ReportShower(report); --- 49,54 ---- (Account)ObjectArchiver.Extract(serializedAccountFullPath); Report report = new Report(account, new HistoricalAdjustedQuoteProvider()); ! ! report.Text = serializedAccountFullPath.Substring(serializedAccountFullPath.LastIndexOf("\\") + 1); ReportShower reportShower = new ReportShower(report); *************** *** 74,78 **** --- 77,107 ---- } } + + + + public static void ShowReportFromSerializedTransactionHistory(string serializedTransactionHistoryFullPath) + { + try + { + TransactionHistory transactions = + (TransactionHistory)ObjectArchiver.Extract(serializedTransactionHistoryFullPath); + Account account = new Account("FromSerializedTransactions"); + foreach(Object key in transactions.Keys) + { + foreach(EndOfDayTransaction transaction in (ArrayList)transactions[key]) + { + account.Add(transaction); + } + } + Report report = new Report(account, new HistoricalAdjustedQuoteProvider()); + ReportShower reportShower = new ReportShower(report); + reportShower.Show(); + } + catch(System.Exception ex) + { + System.Windows.Forms.MessageBox.Show(ex.ToString()); + } + } } } |