[Quantproject-developers] QuantProject/b5_Presentation/Reporting/WindowsForm Report.cs,1.13,1.14
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-06-10 18:45:57
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19231/b5_Presentation/Reporting/WindowsForm Modified Files: Report.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: Report.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/Report.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Report.cs 7 Jun 2005 13:54:42 -0000 1.13 --- Report.cs 10 Jun 2005 18:45:44 -0000 1.14 *************** *** 45,48 **** --- 45,49 ---- private System.Windows.Forms.MenuItem saveAccount; private System.Windows.Forms.MenuItem saveReport; + private System.Windows.Forms.MenuItem saveTransactions; private SaveFileDialog saveFileDialog; *************** *** 85,88 **** --- 86,92 ---- this.saveReport = new MenuItem(); this.saveReport.Text = "Save Report"; + + this.saveTransactions = new MenuItem(); + this.saveTransactions.Text = "Save Transactions"; this.file = new MenuItem(); *************** *** 93,101 **** this.file.MenuItems.AddRange(new MenuItem[] {this.saveAccount, ! this.saveReport}); this.Menu = this.mainMenu; this.saveAccount.Click += new System.EventHandler(this.saveAccount_Click); this.saveReport.Click += new System.EventHandler(this.saveReport_Click); ! } --- 97,105 ---- this.file.MenuItems.AddRange(new MenuItem[] {this.saveAccount, ! this.saveReport, this.saveTransactions}); this.Menu = this.mainMenu; this.saveAccount.Click += new System.EventHandler(this.saveAccount_Click); this.saveReport.Click += new System.EventHandler(this.saveReport_Click); ! this.saveTransactions.Click += new System.EventHandler(this.saveTransactions_Click); } *************** *** 165,173 **** } ! #region save account or report private void saveAccount_Click(object sender, System.EventArgs e) { ! this.saveAccountOrReport((MenuItem)sender); } --- 169,177 ---- } ! #region save account or report or transactions private void saveAccount_Click(object sender, System.EventArgs e) { ! this.saveObject((MenuItem)sender); } *************** *** 175,182 **** private void saveReport_Click(object sender, System.EventArgs e) { ! this.saveAccountOrReport((MenuItem)sender); } ! private void saveAccountOrReport_setSaveFileDialog(MenuItem sender) { this.saveFileDialog = new SaveFileDialog(); --- 179,191 ---- private void saveReport_Click(object sender, System.EventArgs e) { ! this.saveObject((MenuItem)sender); } ! private void saveTransactions_Click(object sender, System.EventArgs e) ! { ! this.saveObject((MenuItem)sender); ! } ! ! private void saveObject_setSaveFileDialog(MenuItem sender) { this.saveFileDialog = new SaveFileDialog(); *************** *** 189,193 **** System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"]; } ! else //else the text property of the menu item sender contains at the end // the word "Account"; so it will be saved an account object --- 198,202 ---- System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"]; } ! else if(sender.Text.EndsWith("Account")) //else the text property of the menu item sender contains at the end // the word "Account"; so it will be saved an account object *************** *** 197,200 **** --- 206,215 ---- System.Configuration.ConfigurationSettings.AppSettings["AccountsArchive"]; } + else if(sender.Text.EndsWith("Transactions")) + //else the text property of the menu item sender contains at the end + // the word "Transactions"; so it will be saved a TransactionHistory object + { + this.saveFileDialog.DefaultExt = "qPt"; + } this.saveFileDialog.AddExtension = true; *************** *** 207,213 **** } ! private void saveAccountOrReport(MenuItem sender) { ! this.saveAccountOrReport_setSaveFileDialog(sender); this.saveFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.fileOk_Click); this.saveFileDialog.ShowDialog(); --- 222,228 ---- } ! private void saveObject(MenuItem sender) { ! this.saveObject_setSaveFileDialog(sender); this.saveFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.fileOk_Click); this.saveFileDialog.ShowDialog(); *************** *** 219,225 **** QuantProject.ADT.FileManaging.ObjectArchiver.Archive(this.accountReport, this.saveFileDialog.FileName); ! else QuantProject.ADT.FileManaging.ObjectArchiver.Archive(this.account, this.saveFileDialog.FileName); } --- 234,243 ---- QuantProject.ADT.FileManaging.ObjectArchiver.Archive(this.accountReport, this.saveFileDialog.FileName); ! else if(((SaveFileDialog)sender).Title.EndsWith("Account")) QuantProject.ADT.FileManaging.ObjectArchiver.Archive(this.account, this.saveFileDialog.FileName); + else if(((SaveFileDialog)sender).Title.EndsWith("Transactions")) + QuantProject.ADT.FileManaging.ObjectArchiver.Archive(this.account.Transactions, + this.saveFileDialog.FileName); } |