public static List <AggregateFunctionsGroup> GetGroupedData(List <DataGroupModel> subGroups, DataListModelCallBack callBack) { List <AggregateFunctionsGroup> groups = new List <AggregateFunctionsGroup>(); foreach (var subGroup in subGroups) { AggregateFunctionsGroup group = new AggregateFunctionsGroup() { HasSubgroups = subGroup.SubGroups.Count > 0, ItemCount = subGroup.GridGroupModel.ItemCount, Key = subGroup.GridGroupModel.Key, Member = subGroup.GridGroupModel.Member, Items = callBack(subGroup), }; if (subGroup.SubGroups.Count > 0) { group.Items = GetGroupedData(subGroup.SubGroups.ToList(), callBack); } groups.Add(group); } return(groups); }
private static TelerikGroupModel CreateTelerikGroupModel(AggregateFunctionsGroup group) { return(new TelerikGroupModel() { ItemCount = group.ItemCount, Key = group.Key?.ToString(), Member = group.Member }); }
{//AggregateFunctionsGroup.Items are a list of TData items. public static AggregateFunctionsGroupModel <T> Converter <T>(AggregateFunctionsGroup src, ResolutionContext context) { System.Collections.IEnumerable items = null; if (src.Items != null && src.Items.GetType().UnderlyingElementTypeIsFunctionsGroup()) { items = context.Mapper.Map <IEnumerable <AggregateFunctionsGroupModel <T> > >(src.Items); } else { items = context.Mapper.Map <IEnumerable <T> >(src.Items); } return(new AggregateFunctionsGroupModel <T> { Items = items }); }
private static Dictionary <string, object> SerializeGroupItem(DataTable ownerDataTable, IGroup group) { Dictionary <string, object> dictionary2 = new Dictionary <string, object>(); dictionary2.Add("Key", group.Key); dictionary2.Add("HasSubgroups", group.HasSubgroups); dictionary2.Add("Member", group.Member); dictionary2.Add("Items", group.Items.SerializeToDictionary(ownerDataTable)); dictionary2.Add("Subgroups", group.Subgroups.SerializeToDictionary(ownerDataTable)); Dictionary <string, object> dictionary = dictionary2; AggregateFunctionsGroup group2 = group as AggregateFunctionsGroup; if (group2 != null) { dictionary.Add("AggregateFunctionsProjection", group2.AggregateFunctionsProjection); dictionary.Add("Aggregates", group2.Aggregates); } return(dictionary); }
private void GetGroupItems(AggregateFunctionsGroup group, List <TimeEntryViewModel> sourceList) { if (group.HasSubgroups) { foreach (var subGroup in group.Items) { GetGroupItems(subGroup as AggregateFunctionsGroup, sourceList); } } else { var tmpTable = new List <TimeEntryViewModel>(); foreach (var item in group.Items) { tmpTable.Add(item as TimeEntryViewModel); } sourceList.AddRange(tmpTable); } }