Beispiel #1
0
        void BaseValues()
        {
            this.UseStandardPrinter = true;
            this.GraphicsUnit       = GraphicsUnit.Pixel;
            this.Padding            = new Padding(5);
            this.DefaultFont        = GlobalValues.DefaultFont;
            this.ReportType         = GlobalEnums.ReportType.FormSheet;

            this.DataModel = GlobalEnums.PushPullModel.FormSheet;

            this.CommandType      = System.Data.CommandType.Text;
            this.ConnectionString = String.Empty;
            this.CommandText      = String.Empty;

            this.TopMargin    = GlobalValues.DefaultPageMargin.Left;
            this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom;
            this.LeftMargin   = GlobalValues.DefaultPageMargin.Left;
            this.RightMargin  = GlobalValues.DefaultPageMargin.Right;

            this.availableFields     = new AvailableFieldsCollection();
            this.groupingsCollection = new GroupColumnCollection();
            this.sortingCollection   = new SortColumnCollection();
            this.sqlParameters       = new SqlParameterCollection();
            this.parameterCollection = new ParameterCollection();
            this.NoDataMessage       = "No Data for this Report";
        }
Beispiel #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);
        }
Beispiel #3
0
 void BaseValues()
 {
     this.useStandardPrinter  = true;
     this.graphicsUnit        = GraphicsUnit.Pixel;
     this.padding             = new Padding(5);
     this.defaultFont         = GlobalValues.DefaultFont;
     this.reportType          = GlobalEnums.ReportType.FormSheet;
     this.dataModel           = GlobalEnums.PushPullModel.FormSheet;
     this.pageSize            = GlobalValues.DefaultPageSize;
     this.topMargin           = GlobalValues.DefaultPageMargin.Left;
     this.bottomMargin        = GlobalValues.DefaultPageMargin.Bottom;
     this.leftMargin          = GlobalValues.DefaultPageMargin.Left;
     this.rightMargin         = GlobalValues.DefaultPageMargin.Right;
     this.availableFields     = new AvailableFieldsCollection();
     this.groupingsCollection = new ColumnCollection();
     this.sortingCollection   = new SortColumnCollection();
     this.parameterCollection = new ParameterCollection();
 }
Beispiel #4
0
        private PropertyDescriptor[] BuildSortProperties(SortColumnCollection col)
        {
            PropertyDescriptor[]         sortProperties = new PropertyDescriptor[col.Count];
            PropertyDescriptorCollection c = this.baseList.GetItemProperties(null);

            for (int criteriaIndex = 0; criteriaIndex < col.Count; criteriaIndex++)
            {
                PropertyDescriptor descriptor = c.Find(col[criteriaIndex].ColumnName, true);

                if (descriptor == null)
                {
                    throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                                                                      "Die Liste enthält keine Spalte [{0}].",
                                                                      col[criteriaIndex].ColumnName));
                }
                sortProperties[criteriaIndex] = descriptor;
            }
            return(sortProperties);
        }
Beispiel #5
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);
        }