Ejemplo n.º 1
0
        protected GroupComparer CreateGroupHeader(BaseComparer sc)
        {
            GroupComparer gc = new GroupComparer(sc.ColumnCollection, sc.ListIndex, sc.ObjectArray);

            IndexList.Add(gc);
            return(gc);
        }
Ejemplo n.º 2
0
        // if we have no sorting, we build the indexlist as well, so we don't need to
        private IndexList IndexBuilder(SortColumnCollection col)
        {
            IndexList arrayList = new IndexList();

            for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++)
            {
                object[] values = new object[1];
                arrayList.Add(new SortComparer(col, rowIndex, values));
            }
            return(arrayList);
        }
Ejemplo n.º 3
0
        private IndexList IndexBuilder(Collection <AbstractColumn> col)
        {
            IndexList arrayList = new IndexList();

            for (int rowIndex = 0; rowIndex < this.table.Rows.Count; rowIndex++)
            {
                object[] values = new object[1];
                arrayList.Add(new SortComparer(col, rowIndex, values));
            }
            return(arrayList);
        }
Ejemplo n.º 4
0
        private IndexList BuildSortIndex(SortColumnCollection col)
        {
            IndexList arrayList = new IndexList();

            PropertyDescriptor[] sortProperties = BuildSortProperties(col);
            for (int rowIndex = 0; rowIndex < this.baseList.Count; rowIndex++)
            {
                object   rowItem = this.baseList[rowIndex];
                object[] values  = new object[col.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;
                    }
                }
                arrayList.Add(new SortComparer(col, rowIndex, values));
            }

            if (arrayList[0].ObjectArray.GetLength(0) == 1)
            {
                List <BaseComparer> lbc = BaseListStrategy.GenericSorter(arrayList);
                arrayList.Clear();
                arrayList.AddRange(lbc);
            }
            else
            {
                arrayList.Sort();
            }
            return(arrayList);
        }
Ejemplo n.º 5
0
        private IndexList  BuildSortIndex(Collection <AbstractColumn> col)
        {
            IndexList arrayList = new IndexList();

            for (int rowIndex = 0; rowIndex < this.table.Rows.Count; rowIndex++)
            {
                DataRow  rowItem = this.table.Rows[rowIndex];
                object[] values  = new object[col.Count];
                for (int criteriaIndex = 0; criteriaIndex < col.Count; criteriaIndex++)
                {
                    AbstractColumn c     = (AbstractColumn)col[criteriaIndex];
                    object         value = rowItem[c.ColumnName];

                    if (value != null && value != DBNull.Value)
                    {
                        if (!(value is IComparable))
                        {
                            throw new InvalidOperationException(value.ToString());
                        }

                        values[criteriaIndex] = value;
                    }
                    else
                    {
                        values[criteriaIndex] = DBNull.Value;
                    }
                }
                arrayList.Add(new SortComparer(col, rowIndex, values));
            }

            if (arrayList[0].ObjectArray.GetLength(0) == 1)
            {
                List <BaseComparer> lbc = BaseListStrategy.GenericSorter(arrayList);
                arrayList.Clear();
                arrayList.AddRange(lbc);
            }
            else
            {
                arrayList.Sort();
            }
            return(arrayList);
        }
Ejemplo n.º 6
0
 protected static void CreateGroupeChildren(IndexList list, BaseComparer sc)
 {
     list.Add(sc);
 }