Esempio n. 1
0
 public ComputeTotalValuesEventArgs(ConfigTotalValues configTotalValues, object row, string group, IExportColumn column)
 {
     ConfigTotalValues = configTotalValues;
     Row    = row;
     Group  = group;
     Column = column;
 }
Esempio n. 2
0
 public TotalValuesEventArgs(ConfigTotalValues configTotalValues, string group, IExportColumn column, string totalRowFilter)
 {
     ConfigTotalValues = configTotalValues;
     Group             = group;
     Column            = column;
     TotalRowFilter    = totalRowFilter;
 }
Esempio n. 3
0
        public static ConfigTotalValues Total(this JournalExportEventArgs args, IEnumerable <GridColumn> columns)
        {
            var agg = new AggregateDataSimple();
            var configTotalValues = new ConfigTotalValues {
                Aggregate = agg
            };

            args.ComputeTotalValue = (r, group, column) =>
            {
                if (configTotalValues.ComputeTotalValue(r, group, column))
                {
                    return;
                }

                if (!column.IsNumericColumn)
                {
                    return;
                }

                var aggregateType = GetAggType(column as GridColumn);
                if (aggregateType == ColumnAggregateType.None)
                {
                    return;
                }

                var row      = (BaseRow)r;
                var strValue = column.GetValue(row);
                if (string.IsNullOrEmpty(strValue))
                {
                    return;
                }

                var value    = Convert.ToDouble(strValue);
                var groupAgg = agg.GetChildGroup(column.ColumnName);
                groupAgg.StrValue      = column.ColumnName;
                groupAgg.AggregateType = aggregateType;
                Aggregate(groupAgg, value);

                groupAgg = groupAgg.GetChildGroup(group);
                groupAgg.AggregateType = aggregateType;
                groupAgg.StrValue      = group;
                Aggregate(groupAgg, value);

                var rowAgg = groupAgg.GetChildGroup(row.Value);
                rowAgg.StrValue = strValue;
                Aggregate(rowAgg, value);
                rowAgg.Value = value;
            };
            args.GetTotalValue = (group, column, totalRowFilter) =>
            {
                if (configTotalValues.HasTotalValue(column))
                {
                    return(configTotalValues.GetTotalValue(group, column, totalRowFilter));
                }

                if (!column.IsNumericColumn)
                {
                    return(null);
                }

                var gridColumn = (GridHtmlGenerator.Column)column;
                var value      = configTotalValues.GetTotalValue(group, column.ColumnName);
                return(string.Format(gridColumn.Format ?? "{0}", value));
            };

            return(configTotalValues);
        }
Esempio n. 4
0
 public double?GetTotalValue(string group, string column)
 {
     return(ConfigTotalValues.GetTotalValue(group, column));
 }
Esempio n. 5
0
 public double?GetTotalValue(string group, IExportColumn column)
 {
     return(ConfigTotalValues.GetTotalValue(group, column.ColumnName));
 }