/// <summary> /// Handles the InitializeRow of the grid. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void grdCashflowSources_InitializeRow(object sender, InitializeRowEventArgs e) { // If there's no current month data, yet, just bail out. if (null == this.currentMonthData) { return; } // Each row in the grid is an Activity. Get the Activity for the row. Showcase.CashflowDashboard.Data.Activity activity = (Showcase.CashflowDashboard.Data.Activity)e.Row.ListObject; // Get the values we need to fill up the unbound columns in the grid. // This is done with a call to an absract method so that the InflowDetails and // Outflow Details can return the appropriate values. // decimal value; decimal projected; decimal?lastMonth = null; decimal?lastYear = null; Image legend; this.GetGridRowValues(activity, ref lastMonth, ref lastYear, out value, out projected, out legend); // Populate the grid cells with the calculated values. // e.Row.Cells["projected"].Value = Utilities.GetComparisonString(value, projected); if (null != lastMonth) { e.Row.Cells["last month"].Value = Utilities.GetComparisonString(value, lastMonth.Value); } else { e.Row.Cells["last month"].Value = Utilities.LocalizeString("CashflowDetails_Category_Label_noPreviousData"); } if (null != lastYear) { e.Row.Cells["last year"].Value = Utilities.GetComparisonString(value, lastYear.Value); } else { e.Row.Cells["last year"].Value = Utilities.LocalizeString("CashflowDetails_Category_Label_noPreviousData"); } e.Row.Cells["label"].Value = legend; }
/// <summary> /// Returns the specified values for use in the grid. /// </summary> /// <param name="activity">The activity from which to retrieve the value</param> /// <param name="lastMonth">The inflow value of the previous month.</param> /// <param name="lastYear">The inflow value of the previous year.</param> /// <param name="value">The inflow value of the current month</param> /// <param name="projected">The projected inflow value of the current month.</param> /// <param name="legend">The legend image for the source of the activity.</param> internal override void GetGridRowValues(Showcase.CashflowDashboard.Data.Activity activity, ref decimal?lastMonth, ref decimal?lastYear, out decimal value, out decimal projected, out Image legend) { value = activity.ActualInflow; projected = activity.ProjectedInflow; if (null != this.lastMonthData) { lastMonth = this.lastMonthData.GetInflow(activity.Source); } if (null != this.lastYearData) { lastYear = this.lastYearData.GetInflow(activity.Source); } legend = this.GetLegend(activity.Source); }
/// <summary> /// Returns the specified values for use in the grid. /// </summary> /// <param name="activity">The activity from which to retrieve the value</param> /// <param name="lastMonth">The value (inflow or outflow) of the previous month.</param> /// <param name="lastYear">The value (inflow or outflow) of the previous year.</param> /// <param name="value">The value (inflow or outflow) of the current month</param> /// <param name="projected">The projected value (inflow or outflow) of the current month.</param> /// <param name="legend">The legend image for the source of the activity.</param> internal abstract void GetGridRowValues(Showcase.CashflowDashboard.Data.Activity activity, ref decimal?lastMonth, ref decimal?lastYear, out decimal value, out decimal projected, out Image legend);