public void ComputeTotals() { foreach (var item in CategoryGroups) { item.ComputeTotals(); } var totals = new BigTableValue[Dates.Length]; for (var i = 0; i < totals.Length; i++) { var sum = new BigTableValue(); foreach (var item in CategoryGroups) { sum += item.Totals[i]; } totals[i] = sum; } Totals = totals; Total = totals.Aggregate(new BigTableValue(), (acc, value) => acc + value); }
public void ComputeTotals() { foreach (var item in Categories) { item.ComputeTotals(); } var amounts = new BigTableValue[BigTable.Dates.Length]; for (var i = 0; i < amounts.Length; i++) { var sum = new BigTableValue(); foreach (var item in Categories) { sum += item.Totals[i]; } amounts[i] = sum; } Totals = amounts; _total = amounts.Aggregate(new BigTableValue(), (acc, value) => acc + value); }
public BigTableCategory(BigTableCategoryGroup categoryGroup) { CategoryGroup = categoryGroup ?? throw new ArgumentNullException(nameof(categoryGroup)); Totals = new BigTableValue[categoryGroup.BigTable.Dates.Length]; }
public void ComputeTotals() { Total = Totals.Aggregate(new BigTableValue(), (acc, value) => acc + value); }