[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-02-06 20:40:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27773/a1_Financial/a2_Accounting/h5_Reporting/Tables Added Files: StatisticsSummary.cs Log Message: Added new tab page to Report: StatisticsSummary and the skeleton file for a new row for this Tab Page (AverageReturnOnMonday, that has not been implemented yet) --- NEW FILE: StatisticsSummary.cs --- using System; using System.Data; using System.Reflection; using System.Runtime.Serialization; using QuantProject.ADT; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows; namespace QuantProject.Business.Financial.Accounting.Reporting.Tables { /// <summary> /// Summary description for StatisticsSummary. /// </summary> [Serializable] public class StatisticsSummary : ReportTable, ISerializable { private AccountReport accountReport; private IHistoricalQuoteProvider historicalQuoteProvider; private AverageReturnOnMonday averageReturnOnMonday; public AccountReport AccountReport { get { return accountReport; } } public AverageReturnOnMonday AverageReturnOnMonday { get { return this.averageReturnOnMonday; } } private void statisticsSummary( AccountReport accountReport ) { this.accountReport = accountReport; this.getStatisticsSummary(); } public StatisticsSummary( AccountReport accountReport ) : base( accountReport.Name + " - StatisticsSummary" ) { this.statisticsSummary( accountReport ); } public StatisticsSummary( AccountReport accountReport , IHistoricalQuoteProvider historicalDataProvider ) : base( accountReport.Name + " - StatisticsSummary" ) { this.historicalQuoteProvider = historicalDataProvider; this.statisticsSummary( accountReport ); } #region Serialization /// <summary> /// This constructor allows custom deserialization (see the ISerializable /// interface documentation) /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected StatisticsSummary( SerializationInfo info , StreamingContext context ) : base( "Summary" ) { // get the set of serializable members for this class and its base classes Type thisType = this.GetType(); MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // deserialize the fields from the info object for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; // set the field to the deserialized value try { fieldInfo.SetValue( this , info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); } catch(Exception ex) {ex = ex;} } } /// <summary> /// serialize the set of serializable members for this class and base classes /// </summary> /// <param name="info"></param> /// <param name="context"></param> void ISerializable.GetObjectData( SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); } } #endregion #region "getStatisticsSummary" private void getStatisticsSummary() { if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) throw new Exception( "A StatisticsSummary computation has been requested, but the equity line is empty" ); this.averageReturnOnMonday = new AverageReturnOnMonday(this); } #endregion } } |