Hi
I found many examples of custom aggregates and I'm able to do aggregate function with those helps for specific class with specific property which is used in my grid. But now I have few situations that I want to get count of checked (in class type boolean with value true) from that column. I would like to get it done in one function so I don't need to do several almost same kind code (only class and property changed).
So how I have to change this function to get it work universally (without class 'DeliveriesForAccountsCls' and property name 'isChecked')?
public class CheckedDeliveriesCount : AggregateFunction<DeliveriesForAccountsCls, double>{ public CheckedDeliveriesCount () { this.AggregationExpression = items => Summary(items); } private double Summary(IEnumerable<DeliveriesForAccountsCls> source) { var itemCount = source.Count(); if (itemCount > 1) { var values = source.Where(x => x.isChecked); var sum = values.Count(); return sum; } return 0; }}
Regards
Harri