public static byte?GetGroupRowLevel(SortedListController controller, int reportBandLevel) { // Compare to SortedListController.ComposeGroupFields var composedFields = new List <ComposedGroupFieldInfo>(); var lastBand = (GroupHeaderBand)null; var lastCountWithNonNullLevel = 0; foreach (var field in get_originalGroupFields.Invoke(controller)) { var headerBand = get_Band.Invoke(field) as GroupHeaderBand; if (headerBand == null) { composedFields.Add(new ComposedGroupFieldInfo(field)); } else if (lastBand != headerBand) { if (headerBand.Level < reportBandLevel) { break; } composedFields.Add(new ComposedGroupFieldInfo(field)); lastCountWithNonNullLevel = composedFields.Count; } else { composedFields[composedFields.Count - 1] = ComposedGroupFieldInfo.Composite; } lastBand = headerBand; } composedFields.RemoveRange(lastCountWithNonNullLevel, composedFields.Count - lastCountWithNonNullLevel); // At this point, either the list is empty or at the end of the list is a ComposedGroupFieldInfo with ReportBandLevel no less than reportBandLevel. // That last item is the composed field by which the report is actually sorting when you put a summary on reportBandLevel's group. // All that remains is to count the number of levels to get to that field. // Compare to SortedListController.CreateSortInfo var dataController = controller.GetDataController(); var hashSet = new HashSet <Tuple <int, bool> >(); var level = -1; foreach (var field in composedFields) { if (!field.IsComposite) { var columnInfo = dataController.Columns[field.GroupField.FieldName]; if (columnInfo == null || !hashSet.Add(Tuple.Create(columnInfo.Index, field.GroupField.SortOrder == XRColumnSortOrder.Ascending))) { continue; } } // Assign the next level to the field level++; } return(level == -1 ? null : (byte?)level); }
public static XRGroupSortingSummary[] GetSortingSummary(this SortedListController listController) { return(get_sortingSummary(listController)); }
public static GroupField[] GetOriginalGroupFields(this SortedListController listController) { return(get_originalGroupFields(listController)); }
public static RowIndicesMapper GetIndicesMapper(this SortedListController listController) { return(get_IndicesMapper(listController)); }
public static ListSourceDataController GetDataController(this SortedListController listController) { return(get_dataController(listController)); }
public static byte? GetGroupRowLevel(SortedListController controller, int reportBandLevel) { // Compare to SortedListController.ComposeGroupFields var composedFields = new List<ComposedGroupFieldInfo>(); var lastBand = (GroupHeaderBand)null; var lastCountWithNonNullLevel = 0; foreach (var field in get_originalGroupFields.Invoke(controller)) { var headerBand = get_Band.Invoke(field) as GroupHeaderBand; if (headerBand == null) { composedFields.Add(new ComposedGroupFieldInfo(field)); } else if (lastBand != headerBand) { if (headerBand.Level < reportBandLevel) break; composedFields.Add(new ComposedGroupFieldInfo(field)); lastCountWithNonNullLevel = composedFields.Count; } else composedFields[composedFields.Count - 1] = ComposedGroupFieldInfo.Composite; lastBand = headerBand; } composedFields.RemoveRange(lastCountWithNonNullLevel, composedFields.Count - lastCountWithNonNullLevel); // At this point, either the list is empty or at the end of the list is a ComposedGroupFieldInfo with ReportBandLevel no less than reportBandLevel. // That last item is the composed field by which the report is actually sorting when you put a summary on reportBandLevel's group. // All that remains is to count the number of levels to get to that field. // Compare to SortedListController.CreateSortInfo var dataController = controller.GetDataController(); var hashSet = new HashSet<Tuple<int, bool>>(); var level = -1; foreach (var field in composedFields) { if (!field.IsComposite) { var columnInfo = dataController.Columns[field.GroupField.FieldName]; if (columnInfo == null || !hashSet.Add(Tuple.Create(columnInfo.Index, field.GroupField.SortOrder == XRColumnSortOrder.Ascending))) { continue; } } // Assign the next level to the field level++; } return level == -1 ? null : (byte?)level; }