Exemple #1
0
        private void WriteResult()
        {
            if (this.resultDataSet != null)
            {
                // check reordering of columns
                DataGridViewColumn[]         displayCols;
                DataGridViewColumnCollection dc = this.grdQuery.Columns;

                displayCols = new DataGridViewColumn[dc.Count];
                for (int i = 0; i < dc.Count; i++)
                {
                    if (dc[i].Visible)
                    {
                        displayCols[dc[i].DisplayIndex] = dc[i];
                    }
                }

                ReportItemCollection destItems = WizardHelper.CreateItemsCollection(this.resultDataSet, displayCols);
                reportStructure.ReportItemCollection.Clear();
                reportStructure.ReportItemCollection.AddRange(destItems);


                var abstractColumns = WizardHelper.AvailableFieldsCollection(this.resultDataSet);
                if (abstractColumns != null)
                {
                    reportStructure.AvailableFieldsCollection.Clear();
                    reportStructure.AvailableFieldsCollection.AddRange(abstractColumns);
                }
            }
            base.EnableNext   = true;
            base.EnableFinish = true;
        }
Exemple #2
0
        private void WriteResult()
        {
            if (this.resultDataSet != null)
            {
                // check reordering of columns
                DataGridViewColumn[]         displayCols;
                DataGridViewColumnCollection dc = this.grdQuery.Columns;

                displayCols = new DataGridViewColumn[dc.Count];
                for (int i = 0; i < dc.Count; i++)
                {
                    if (dc[i].Visible)
                    {
                        displayCols[dc[i].DisplayIndex] = dc[i];
                    }
                }


                ReportItemCollection sourceItems = WizardHelper.ReportItemCollection(this.resultDataSet);

                AvailableFieldsCollection abstractColumns = WizardHelper.AvailableFieldsCollection(this.resultDataSet);

                ReportItemCollection destItems = new ReportItemCollection();

                // only checked columns are used in the report
                foreach (DataGridViewColumn cc in displayCols)
                {
                    DataGridViewColumnHeaderCheckBoxCell hc = (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell;
                    if (hc.Checked)
                    {
                        BaseReportItem br = (BaseReportItem)sourceItems.Find(cc.HeaderText);
                        destItems.Add(br);
                    }
                }

                reportStructure.ReportItemCollection.Clear();
                reportStructure.ReportItemCollection.AddRange(destItems);

                /*
                 * if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) {
                 *      reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection);
                 * }
                 */
                if (abstractColumns != null)
                {
                    reportStructure.AvailableFieldsCollection.Clear();
                    reportStructure.AvailableFieldsCollection.AddRange(abstractColumns);
                }

                /*
                 * if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) {
                 *      reportStructure.SqlQueryParameters.Clear();
                 *      reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection);
                 * }
                 */
            }
            base.EnableNext   = true;
            base.EnableFinish = true;
        }
        void FillDataGrid(string fileName)
        {
            this.resultDataSet        = new DataSet();
            this.resultDataSet.Locale = CultureInfo.CurrentCulture;

            resultDataSet.ReadXml(fileName);
            this.grdQuery.DataSource = resultDataSet.Tables[0];
            this.abstractColumns     = WizardHelper.AvailableFieldsCollection(this.resultDataSet);
            foreach (DataGridViewColumn dd in this.grdQuery.Columns)
            {
                DataGridViewColumnHeaderCheckBoxCell cb = new DataGridViewColumnHeaderCheckBoxCell();
                cb.CheckBoxAlignment = HorizontalAlignment.Left;
                cb.Checked           = true;
                dd.HeaderCell        = cb;
            }
            base.EnableFinish = true;
        }