|
|
|
|
@ -13,10 +13,13 @@ using System.Collections.ObjectModel;
@@ -13,10 +13,13 @@ using System.Collections.ObjectModel;
|
|
|
|
|
using System.ComponentModel; |
|
|
|
|
using System.Globalization; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Reflection; |
|
|
|
|
|
|
|
|
|
using ICSharpCode.Reporting.BaseClasses; |
|
|
|
|
using ICSharpCode.Reporting.DataManager.Listhandling; |
|
|
|
|
using ICSharpCode.Reporting.DataSource; |
|
|
|
|
using ICSharpCode.Reporting.DataSource.Comparer; |
|
|
|
|
using ICSharpCode.Reporting.Interfaces; |
|
|
|
|
using ICSharpCode.Reporting.Interfaces.Data; |
|
|
|
|
using ICSharpCode.Reporting.Items; |
|
|
|
|
|
|
|
|
|
@ -31,13 +34,13 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -31,13 +34,13 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
private PropertyDescriptorCollection listProperties; |
|
|
|
|
private DataCollection<object> baseList; |
|
|
|
|
private ReportSettings reportSettings; |
|
|
|
|
private object current; |
|
|
|
|
private Type itemType; |
|
|
|
|
|
|
|
|
|
public CollectionSource(IList list,ReportSettings reportSettings) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if (list.Count > 0) { |
|
|
|
|
var itemType = list[0].GetType(); |
|
|
|
|
itemType = list[0].GetType(); |
|
|
|
|
this.baseList = new DataCollection <object>(itemType); |
|
|
|
|
this.baseList.AddRange(list); |
|
|
|
|
} |
|
|
|
|
@ -65,10 +68,47 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -65,10 +68,47 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
|
|
|
|
|
public object Current { |
|
|
|
|
get { |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
return baseList[((BaseComparer)IndexList[CurrentPosition]).ListIndex]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// public object CurrentFromPosition(int pos)
|
|
|
|
|
// {
|
|
|
|
|
// BaseComparer bc = GetComparer(value);
|
|
|
|
|
// Current = baseList[bc.ListIndex];
|
|
|
|
|
// return baseList[((BaseComparer)IndexList[CurrentPosition]).ListIndex];
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int CurrentPosition { |
|
|
|
|
|
|
|
|
|
get { |
|
|
|
|
return IndexList.CurrentPosition; |
|
|
|
|
} |
|
|
|
|
set { |
|
|
|
|
if ((value > -1)|| (value > this.IndexList.Count)){ |
|
|
|
|
this.IndexList.CurrentPosition = value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// BaseComparer bc = GetComparer(value);
|
|
|
|
|
// Current = baseList[bc.ListIndex];
|
|
|
|
|
|
|
|
|
|
// current = this.baseList[((BaseComparer)IndexList[value]).ListIndex];
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool MoveNext() |
|
|
|
|
{ |
|
|
|
|
this.IndexList.CurrentPosition ++; |
|
|
|
|
return this.IndexList.CurrentPosition<this.IndexList.Count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IndexList IndexList {get; private set;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Bind() |
|
|
|
|
{ |
|
|
|
|
if (reportSettings.GroupColumnCollection.Any()) { |
|
|
|
|
@ -76,64 +116,104 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -76,64 +116,104 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
} else { |
|
|
|
|
this.Sort (); |
|
|
|
|
} |
|
|
|
|
Reset(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region Fill
|
|
|
|
|
|
|
|
|
|
public void Fill(IDataItem item) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
// PropertyInfo pi = itemType.GetProperty(item.ColumnName);
|
|
|
|
|
// var pi1 = pi.GetValue(Current);
|
|
|
|
|
|
|
|
|
|
var p = listProperties.Find(item.ColumnName,true); |
|
|
|
|
item.DBValue = p.GetValue(Current).ToString(); |
|
|
|
|
if (String.IsNullOrEmpty(item.DataType)) { |
|
|
|
|
item.DataType = p.PropertyType.ToString(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Grouping
|
|
|
|
|
|
|
|
|
|
public void Group() |
|
|
|
|
{ |
|
|
|
|
var sortedList = this.BuildSortIndex (reportSettings.GroupColumnCollection); |
|
|
|
|
IndexList = BuildGroup(sortedList); |
|
|
|
|
var unsortedList = this.BuildIndexInternal(reportSettings.GroupColumnCollection); |
|
|
|
|
// IndexList = BuildGroup(unsortedList,reportSettings.GroupColumnCollection);
|
|
|
|
|
var sorted = unsortedList.OrderBy(a => a.ObjectArray[0]); |
|
|
|
|
var x = sorted.GroupBy(a => a.ObjectArray[0]); |
|
|
|
|
|
|
|
|
|
Console.WriteLine("GroupBy()"); |
|
|
|
|
foreach (var element in x) { |
|
|
|
|
Console.WriteLine("{0} - {1} ",element.Key.ToString(),element is BaseComparer); |
|
|
|
|
foreach (var xx in element) { |
|
|
|
|
Console.WriteLine("...{0}",((BaseComparer)xx).ObjectArray[0].ToString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Console.WriteLine("--------------- "); |
|
|
|
|
|
|
|
|
|
// ShowIndexList(gl);
|
|
|
|
|
var aa = BuildGroup_1(unsortedList,reportSettings.GroupColumnCollection); |
|
|
|
|
// ShowIndexList(IndexList);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
private Dictionary<string,IndexList> BuildGroup (IndexList list) { |
|
|
|
|
|
|
|
|
|
private Dictionary<string,IndexList> BuildGroup_1 (IndexList list,GroupColumnCollection groups) { |
|
|
|
|
var dictionary = new Dictionary<string,IndexList>(); |
|
|
|
|
PropertyDescriptor[] groupProperties = BuildSortProperties (groups); |
|
|
|
|
foreach (var element in list) { |
|
|
|
|
string groupValue = ExtractValue (element); |
|
|
|
|
string groupValue = ExtractValue (element,groupProperties); |
|
|
|
|
if (!dictionary.ContainsKey(groupValue)) { |
|
|
|
|
dictionary[groupValue] = new IndexList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dictionary[groupValue].Add(element); |
|
|
|
|
} |
|
|
|
|
foreach (var el in dictionary) { |
|
|
|
|
Console.WriteLine (el.Key.ToString()); |
|
|
|
|
|
|
|
|
|
Console.WriteLine("Dictonary "); |
|
|
|
|
foreach (var el in dictionary.Values) { |
|
|
|
|
Console.WriteLine(el.Count.ToString()); |
|
|
|
|
foreach (var element in el) { |
|
|
|
|
Console.WriteLine("-- {0}",element.ToString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return dictionary; |
|
|
|
|
return dictionary; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
private IndexList BuildGroup (IndexList list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IndexList BuildGroup (IndexList source,GroupColumnCollection groups) |
|
|
|
|
{ |
|
|
|
|
string compareValue = String.Empty; |
|
|
|
|
var idlist = new IndexList(); |
|
|
|
|
// GroupComparer groupComparer = null;
|
|
|
|
|
/* |
|
|
|
|
foreach (BaseComparer element in list) |
|
|
|
|
{ |
|
|
|
|
var groupValue = ExtractValue (element); |
|
|
|
|
|
|
|
|
|
PropertyDescriptor[] groupProperties = BuildSortProperties (groups); |
|
|
|
|
|
|
|
|
|
GroupComparer groupComparer = null; |
|
|
|
|
|
|
|
|
|
foreach (BaseComparer element in source) { |
|
|
|
|
var groupValue = ExtractValue(element,groupProperties); |
|
|
|
|
// var query2 = idlist.FirstOrDefault( s => ((GroupComparer)s).ObjectArray[0] == groupValue) as GroupComparer;
|
|
|
|
|
// if (query2 == null) {
|
|
|
|
|
// groupComparer = CreateGroupHeader(element);
|
|
|
|
|
// idlist.Add(groupComparer);
|
|
|
|
|
// } else {
|
|
|
|
|
// Console.WriteLine("xx");
|
|
|
|
|
// }
|
|
|
|
|
if (compareValue != groupValue) { |
|
|
|
|
groupComparer = CreateGroupHeader(element); |
|
|
|
|
idlist.Add(groupComparer); |
|
|
|
|
} |
|
|
|
|
groupComparer.IndexList.Add(element); |
|
|
|
|
|
|
|
|
|
compareValue = groupValue; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GroupInternal(compareValue, ref idlist, list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShowGrouping(ref idlist); |
|
|
|
|
// ShowIndexList(IndexList);
|
|
|
|
|
return idlist; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ShowGrouping(ref IndexList idlist) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("----ShowGrouping---"); |
|
|
|
|
@ -146,36 +226,18 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -146,36 +226,18 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GroupInternal(string compareValue, ref IndexList idlist, IndexList list) |
|
|
|
|
{ |
|
|
|
|
GroupComparer groupComparer = null; |
|
|
|
|
foreach (BaseComparer element in list) { |
|
|
|
|
var groupValue = ExtractValue(element); |
|
|
|
|
if (compareValue != groupValue) { |
|
|
|
|
groupComparer = CreateGroupHeader(element); |
|
|
|
|
idlist.Add(groupComparer); |
|
|
|
|
} |
|
|
|
|
groupComparer.IndexList.Add(element); |
|
|
|
|
compareValue = groupValue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static string ExtractValue(BaseComparer element) |
|
|
|
|
string ExtractValue(BaseComparer element,PropertyDescriptor[] groupProperties) |
|
|
|
|
{ |
|
|
|
|
// string val = String.Empty;
|
|
|
|
|
// GroupColumn gc = element.ColumnCollection[0] as GroupColumn;
|
|
|
|
|
// if (gc != null) {
|
|
|
|
|
// val = element.ObjectArray[0].ToString();
|
|
|
|
|
// }
|
|
|
|
|
// return val;
|
|
|
|
|
return element.ObjectArray[0].ToString(); |
|
|
|
|
var rowItem = baseList[element.ListIndex]; |
|
|
|
|
var values = FillComparer(groupProperties, rowItem); |
|
|
|
|
// return element.ObjectArray[0].ToString();
|
|
|
|
|
return values[0].ToString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected GroupComparer CreateGroupHeader (BaseComparer sc) |
|
|
|
|
static GroupComparer CreateGroupHeader (BaseComparer sc) |
|
|
|
|
{ |
|
|
|
|
var gc = new GroupComparer(sc.ColumnCollection,sc.ListIndex,sc.ObjectArray); |
|
|
|
|
gc.IndexList = new IndexList(); |
|
|
|
|
@ -184,63 +246,16 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -184,63 +246,16 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public void Sort() |
|
|
|
|
{ |
|
|
|
|
if ((this.reportSettings.SortColumnsCollection != null)) { |
|
|
|
|
if (this.reportSettings.SortColumnsCollection.Count > 0) { |
|
|
|
|
IndexList = this.BuildSortIndex (reportSettings.SortColumnsCollection); |
|
|
|
|
} else { |
|
|
|
|
IndexList = this.UnsortedIndexList(reportSettings.SortColumnsCollection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool MoveNext() |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Reset() |
|
|
|
|
{ |
|
|
|
|
this.CurrentPosition = 0; |
|
|
|
|
this.IndexList.CurrentPosition = -1; |
|
|
|
|
} |
|
|
|
|
#region BuildIndexList
|
|
|
|
|
|
|
|
|
|
public IndexList IndexList {get; private set;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IndexList BuildSortIndex(SortColumnCollection sortColumnsCollection) |
|
|
|
|
IndexList BuildSortIndex(Collection<AbstractColumn> sortColumnsCollection) |
|
|
|
|
{ |
|
|
|
|
var indexList = new IndexList(); |
|
|
|
|
PropertyDescriptor[] sortProperties = BuildSortProperties (sortColumnsCollection); |
|
|
|
|
for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++){ |
|
|
|
|
object rowItem = this.baseList[rowIndex]; |
|
|
|
|
object[] values = new object[sortColumnsCollection.Count]; |
|
|
|
|
|
|
|
|
|
// Hier bereits Wertabruf um dies nicht während des Sortierens tun zu müssen.
|
|
|
|
|
for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++){ |
|
|
|
|
object value = sortProperties[criteriaIndex].GetValue(rowItem); |
|
|
|
|
// Hier auf Verträglichkeit testen um Vergleiche bei Sortierung zu vereinfachen.
|
|
|
|
|
// Muss IComparable und gleicher Typ sein.
|
|
|
|
|
|
|
|
|
|
if (value != null && value != DBNull.Value) |
|
|
|
|
{ |
|
|
|
|
if (!(value is IComparable)){ |
|
|
|
|
throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
values[criteriaIndex] = value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
indexList.Add(new SortComparer(sortColumnsCollection, rowIndex, values)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IndexList indexList = BuildIndexInternal(sortColumnsCollection); |
|
|
|
|
|
|
|
|
|
if (indexList[0].ObjectArray.GetLength(0) == 1) { |
|
|
|
|
|
|
|
|
|
List<BaseComparer> sortedList = GenericSorter (indexList); |
|
|
|
|
IEnumerable<BaseComparer> sortedList = GenericSorter (indexList); |
|
|
|
|
indexList.Clear(); |
|
|
|
|
indexList.AddRange(sortedList); |
|
|
|
|
} |
|
|
|
|
@ -249,42 +264,78 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -249,42 +264,78 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
} |
|
|
|
|
return indexList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IndexList BuildIndexInternal(Collection<AbstractColumn> sortColumnsCollection) |
|
|
|
|
{ |
|
|
|
|
var indexList = new IndexList(); |
|
|
|
|
PropertyDescriptor[] sortProperties = BuildSortProperties(sortColumnsCollection); |
|
|
|
|
for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++) { |
|
|
|
|
var rowItem = this.baseList[rowIndex]; |
|
|
|
|
var values = FillComparer(sortProperties, rowItem); |
|
|
|
|
indexList.Add(new SortComparer(sortColumnsCollection, rowIndex, values)); |
|
|
|
|
} |
|
|
|
|
return indexList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Sorting delegates
|
|
|
|
|
|
|
|
|
|
static List<BaseComparer> GenericSorter (List<BaseComparer> list) |
|
|
|
|
public void Sort() |
|
|
|
|
{ |
|
|
|
|
if ((this.reportSettings.SortColumnsCollection != null)) { |
|
|
|
|
if (this.reportSettings.SortColumnsCollection.Count > 0) { |
|
|
|
|
IndexList = this.BuildSortIndex (reportSettings.SortColumnsCollection); |
|
|
|
|
} else { |
|
|
|
|
IndexList = this.BuildIndexInternal(reportSettings.SortColumnsCollection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static IEnumerable<BaseComparer> GenericSorter (List<BaseComparer> list) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
List<BaseComparer> sortedList = null; |
|
|
|
|
ListSortDirection sortDirection = GetSortDirection(list); |
|
|
|
|
|
|
|
|
|
if (sortDirection == ListSortDirection.Ascending) { |
|
|
|
|
sortedList = list.AsQueryable().AscendingOrder().ToList(); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
sortedList = list.AsQueryable().DescendingOrder().ToList(); |
|
|
|
|
} |
|
|
|
|
sortedList = sortDirection == ListSortDirection.Ascending ? list.AsQueryable().AscendingOrder().ToList() : list.AsQueryable().DescendingOrder().ToList(); |
|
|
|
|
return sortedList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static ListSortDirection GetSortDirection(List<BaseComparer> list) |
|
|
|
|
{ |
|
|
|
|
BaseComparer bc = list[0]; |
|
|
|
|
SortColumn sortColumn = bc.ColumnCollection[0] as SortColumn; |
|
|
|
|
var sortColumn = bc.ColumnCollection[0] as SortColumn; |
|
|
|
|
ListSortDirection sd = sortColumn.SortDirection; |
|
|
|
|
return sd; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
Object[] FillComparer(PropertyDescriptor[] sortProperties, object rowItem) |
|
|
|
|
{ |
|
|
|
|
object[] values = new object[sortProperties.Length]; |
|
|
|
|
for (int criteriaIndex = 0; criteriaIndex < sortProperties.Length; criteriaIndex++) { |
|
|
|
|
object value = sortProperties[criteriaIndex].GetValue(rowItem); |
|
|
|
|
if (value != null && value != DBNull.Value) { |
|
|
|
|
if (!(value is IComparable)) { |
|
|
|
|
throw new InvalidOperationException("ReportDataSource:BuildSortArray - > This type doesn't support IComparable." + value.ToString()); |
|
|
|
|
} |
|
|
|
|
values[criteriaIndex] = value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return values; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private PropertyDescriptor[] BuildSortProperties (SortColumnCollection sortColumnCollection) |
|
|
|
|
private PropertyDescriptor[] BuildSortProperties (Collection<AbstractColumn> sortColumnCollection) |
|
|
|
|
{ |
|
|
|
|
PropertyDescriptor[] sortProperties = new PropertyDescriptor[sortColumnCollection.Count]; |
|
|
|
|
PropertyDescriptorCollection descriptorCollection = this.baseList.GetItemProperties(null); |
|
|
|
|
var sortProperties = new PropertyDescriptor[sortColumnCollection.Count]; |
|
|
|
|
var descriptorCollection = this.baseList.GetItemProperties(null); |
|
|
|
|
|
|
|
|
|
for (int criteriaIndex = 0; criteriaIndex < sortColumnCollection.Count; criteriaIndex++){ |
|
|
|
|
PropertyDescriptor descriptor = descriptorCollection.Find (sortColumnCollection[criteriaIndex].ColumnName,true); |
|
|
|
|
for (var criteriaIndex = 0; criteriaIndex < sortColumnCollection.Count; criteriaIndex++){ |
|
|
|
|
var descriptor = descriptorCollection.Find (sortColumnCollection[criteriaIndex].ColumnName,true); |
|
|
|
|
|
|
|
|
|
if (descriptor == null){ |
|
|
|
|
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, |
|
|
|
|
@ -297,70 +348,42 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
@@ -297,70 +348,42 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IndexList UnsortedIndexList(SortColumnCollection sortColumnsCollection) |
|
|
|
|
BaseComparer GetComparer(int position) |
|
|
|
|
{ |
|
|
|
|
IndexList arrayList = new IndexList(); |
|
|
|
|
for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++){ |
|
|
|
|
object[] values = new object[1]; |
|
|
|
|
arrayList.Add(new SortComparer(sortColumnsCollection, rowIndex, values)); |
|
|
|
|
} |
|
|
|
|
return arrayList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int CurrentPosition { |
|
|
|
|
|
|
|
|
|
get { |
|
|
|
|
return IndexList.CurrentPosition; |
|
|
|
|
} |
|
|
|
|
set { |
|
|
|
|
if ((value > -1)|| (value > this.IndexList.Count)){ |
|
|
|
|
this.IndexList.CurrentPosition = value; |
|
|
|
|
} |
|
|
|
|
// var a = this.baseList[((BaseComparer)IndexList[value])];
|
|
|
|
|
|
|
|
|
|
BaseComparer bc = GetComparer(value); |
|
|
|
|
// var bc = (BaseComparer)IndexList[value];
|
|
|
|
|
// var i = bc.ListIndex;
|
|
|
|
|
|
|
|
|
|
var myCurrent = baseList[bc.ListIndex]; |
|
|
|
|
current = baseList[bc.ListIndex]; |
|
|
|
|
|
|
|
|
|
// current = this.baseList[((BaseComparer)IndexList[value]).ListIndex];
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseComparer GetComparer(int value) |
|
|
|
|
{ |
|
|
|
|
var bc = (BaseComparer)IndexList[value]; |
|
|
|
|
// var i = bc.ListIndex;
|
|
|
|
|
var bc = (BaseComparer)IndexList[position]; |
|
|
|
|
return bc; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Debug Code
|
|
|
|
|
|
|
|
|
|
protected static void ShowIndexList (IndexList list) |
|
|
|
|
|
|
|
|
|
private static void ShowIndexList (IndexList list) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
foreach (BaseComparer element in list) { |
|
|
|
|
string s = String.Format("{0} ",element.ObjectArray[0]); |
|
|
|
|
GroupComparer gc = element as GroupComparer; |
|
|
|
|
if ( gc != null) { |
|
|
|
|
s = s + "GroupHeader"; |
|
|
|
|
if (gc.IndexList != null) { |
|
|
|
|
s = s + String.Format(" <{0}> Childs",gc.IndexList.Count); |
|
|
|
|
} |
|
|
|
|
System.Console.WriteLine(s); |
|
|
|
|
foreach (BaseComparer c in gc.IndexList) { |
|
|
|
|
var groupComparer = element as GroupComparer; |
|
|
|
|
if (groupComparer == null) continue; |
|
|
|
|
if (groupComparer.IndexList.Any()) { |
|
|
|
|
var ss = String.Format("{0} with {1} Children",element.ObjectArray[0],groupComparer.IndexList.Count); |
|
|
|
|
System.Console.WriteLine(ss); |
|
|
|
|
foreach (BaseComparer c in groupComparer.IndexList) { |
|
|
|
|
Console.WriteLine("---- {0}",c.ObjectArray[0]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static string WrongColumnName(string propertyName) |
|
|
|
|
{ |
|
|
|
|
return String.Format(CultureInfo.InvariantCulture, "Error : <{0}> missing!", propertyName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Reset() |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|