public RowFieldCollection(ReportRow row) { _internalFields = new Dictionary <string, RowField>(); foreach (var reportField in row.Report.DataFields) { _internalFields.Add(reportField.Name, new RowField(row, reportField)); //if (!reportField.Hidden) //{ // _internalFields.Add(reportField.Name, new RowField(row, reportField)); //} } }
public RowField(ReportRow row, ReportField field) { Row = row; Hidden = field.Hidden; Name = field.Name; DataType = field.DataType; DataFormatString = field.DataFormatString; FormatAsDelegate = field.FormatAsDelegate; HeaderText = field.HeaderText; DataStyle = field.DataStyle.Copy(); FooterStyle = field.FooterStyle; HeaderStyle = field.HeaderStyle; ShowTotals = field.ShowTotals; UrlDelegate = field.UrlDelegate; }
private void AddTotalsIfRowSupports(ReportRow row) { foreach (var field in row.Fields) { if (field.ShowTotals && field.DataType.IsNumericType()) { var numericType = field.DataType.IsGenericType ? field.DataType.GetGenericArguments().Single() : field.DataType; var addFieldTotalMethod = typeof(Report).GetMethod("AddFieldTotal", BindingFlags.Instance | BindingFlags.NonPublic).MakeGenericMethod(numericType); object value = row[field]; if (value as string == string.Empty) { value = null; } addFieldTotalMethod.Invoke(this, new object[] { field, value }); } } }
private void AddFooterRow(ReportRowCollection rows) { if (_totals.Count == 0) { return; } var footerRow = new ReportRow(this, ReportRowType.FooterRow, null); foreach (var total in _totals) { footerRow[total.Key] = string.Format(total.Key.DataFormatString, total.Value); } foreach (var field in DataFields.Where(field => !string.IsNullOrEmpty(field.FooterText))) { footerRow[field.Name] = field.FooterText; } rows.Add(footerRow); }
public virtual ReportRowCollection GetRows() { var rows = new ReportRowCollection(this); rows.RowAdding += RenderingRow; var headerRow = new ReportRow(this, ReportRowType.HeaderRow, null); rows.Add(headerRow); foreach (var dataItem in Source.GetItems()) { var row = new ReportRow(this, ReportRowType.DataRow, dataItem); AddTotalsIfRowSupports(row); rows.Add(row); } AddFooterRow(rows); return(rows); }
public ReportRowEventArgs(ReportRow row) { Row = row; }