Beispiel #1
0
        public DialogResult Run()
        {
            if (this.Report == null)
            {
                return(DialogResult.Cancel);
            }

            XtraReportWizardForm form = new XtraReportWizardForm(Wizard.DesignerHost);

            form.Controls.AddRange(new Control[] {
                new WizPageWelcome(this),
                new WizPageDataset(this),
                new WizPageConnectionCustom(this),          // Custom
                new WizPageDataOption(this),                // New
                new WizPageTablesCustom(this),              // Custom
                new WizPageQuery(this),                     // New
                new WizPageChooseFieldsCustom(this),        // Custom
                new WizPageGrouping(this),
                new WizPageSummary(this),
                new WizPageGroupedLayout(this),
                new WizPageUngroupedLayout(this),
                new WizPageStyle(this),
                new WizPageReportTitle(this),
                new WizPageLabelType(this),
                new WizPageLabelOptions(this)               //, and so on...
            });

            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                Wizard.BuildReport();
            }

            return(result);
        }
Beispiel #2
0
        public DialogResult Run()
        {
            if (this.Report == null)
            {
                return(DialogResult.Cancel);
            }

            XtraReportWizardForm form = new XtraReportWizardForm(Wizard.DesignerHost);

            form.Controls.AddRange(new Control[] {
                new WizPageWelcome(this),
                //new WizPageWelcomeCustom(this),
                //new WizPageDataset(this),
                //new WizPageConnectionCustom(this),          // Custom
                //new WizPageDataOption(this),                // New
                //new WizPageTablesCustom(this),              // Custom
                //new WizPageQuery(this),                     // New
                //new WizPageChooseFieldsCustom(this),        // Custom
                //new WizPageGrouping(this),
                //new WizPageSummary(this),
                ////new WizPageGroupedLayout(this),
                //new WizPageLayoutCustom(this),
                //new WizPageUngroupedLayout(this),
                ////new WizPageStyle(this),   //custom
                //new WizPageStylesCustom(this),
                //new WizPageReportTitle(this),
                //new WizPageLabelType(this),
                //new WizPageLabelOptions(this)               //, and so on...
            });



            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                Wizard.BuildReport();
                foreach (SqlParameter param in ((SqlDataAdapter)Report.DataAdapter).SelectCommand.Parameters)
                {
                    DevExpress.XtraReports.Parameters.Parameter xParam = new DevExpress.XtraReports.Parameters.Parameter();
                    xParam.Description = param.ParameterName.Replace('_', ' ');
                    xParam.Name        = param.ParameterName;
                    xParam.Visible     = true;
                    xParam.Value       = param.Value;
                    switch (param.SqlDbType.ToString())
                    {
                    case "BigInt":
                        xParam.Type = typeof(Int64);
                        break;

                    case "Bit":
                        xParam.Type = typeof(Boolean);
                        break;

                    case "DateTime":
                        xParam.Type = typeof(DateTime);
                        break;

                    case "Money":
                    case "Decimal":
                        xParam.Type = typeof(Decimal);
                        break;

                    case "Int":
                        xParam.Type = typeof(Int32);
                        break;

                    case "NVarChar":
                        xParam.Type = typeof(String);
                        break;
                    }

                    Report.Parameters.Add(xParam);
                }
            }

            return(result);
        }
Beispiel #3
0
        public DialogResult Run()
        {
            if (this.Report == null)
            {
                return(DialogResult.Cancel);
            }

            XtraReportWizardForm form = new XtraReportWizardForm(Wizard.DesignerHost);

            form.Controls.AddRange(new Control[] {
                new WizPageDataOption(this),                // New
                new WizPageTablesCustom(this),              // Custom
                new WizPageQuery(this),                     // New
                new WizPageChooseFieldsCustom(this),        // Custom
                new WizPageGrouping(this),
                new WizPageSummary(this),
                new WizPageGroupedLayout(this),
                new WizPageUngroupedLayout(this),
                new WizPageStylesCustom(this),
                new WizPageReportTitle(this),
                new WizPageLabelType(this),
                new WizPageLabelOptions(this)
            });

            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                //Wizard.BuildReport();


                //var kk = this.Wizard;
                NewStandardReportWizard wiz = this.Wizard as NewStandardReportWizard;
                //this.Report.DataSource = wiz.Dataset;
                //this.Report.DataMember = wiz.Dataset.Tables[0];
                //this.Report.DataAdapter = wiz.DataAdapters[0];
                this.adapter = wiz.DataAdapters[0] as DataAdapter;
                this.dataset = wiz.Dataset;

                //((NewStandardReportWizard)this.Wizard).Dataset.DataSetName = wiz.Dataset.Tables[0].ToString() + "DataSet";
                //((NewStandardReportWizard)this.Wizard).DatasetName = wiz.Dataset.Tables[0].ToString() + "DataSet";

                //this.dataset.DataSetName = wiz.Dataset.Tables[0].ToString() + "DataSet";
                //((DevExpress.XtraReports.Design.XRWizardRunnerBase)(this))

                var host = ((DevExpress.XtraReports.Design.XRWizardRunnerBase)(this)).Wizard.DesignerHost;
                //var component = ((DevExpress.XtraReports.Design.XRWizardRunnerBase)(this)).Report.DataSource as System.ComponentModel.IComponent;


                //if (component != null)
                //{
                //    host.Container.Remove(component);
                //}
                //host.Container.Add(((DevExpress.XtraReports.Design.NewStandardReportWizard)(this.Wizard)).DataAdapters[0] as DataAdapter);
                //host.Container.Add(((NewStandardReportWizard)this.Wizard).Dataset);
                host.Container.Add(wiz.DataAdapters[0] as DataAdapter);
                host.Container.Add(wiz.Dataset);
                //Report.DataSource = wiz.Dataset;

                //var fieldList = (DevExpress.XtraReports.UserDesigner.FieldListDockPanel)xrDesignDockManager1[DevExpress.XtraReports.UserDesigner.DesignDockPanelType.FieldList];
                //var host = (IDesignerHost)xrDesignMdiController1.ActiveDesignPanel.GetService(typeof(IDesignerHost));
                //var component = Report.DataSource as IComponent;
                //if (component != null)
                //{
                //    host.Container.Remove(component);
                //}
                //host.Container.Add(dataSet);
                //Report.DataSource = dataSet;
                //fieldList.UpdateDataSource(host);

                foreach (SqlParameter param in ((SqlDataAdapter)Report.DataAdapter).SelectCommand.Parameters)
                {
                    DevExpress.XtraReports.Parameters.Parameter xParam = new DevExpress.XtraReports.Parameters.Parameter();
                    xParam.Description = param.ParameterName.Replace('_', ' ');
                    xParam.Name        = param.ParameterName;
                    xParam.Visible     = true;
                    xParam.Value       = param.Value;
                    switch (param.SqlDbType.ToString())
                    {
                    case "BigInt":
                        xParam.Type = typeof(Int64);
                        break;

                    case "Bit":
                        xParam.Type = typeof(Boolean);
                        break;

                    case "DateTime":
                        xParam.Type = typeof(DateTime);
                        break;

                    case "Money":
                    case "Decimal":
                        xParam.Type = typeof(Decimal);
                        break;

                    case "Int":
                        xParam.Type = typeof(Int32);
                        break;

                    case "NVarChar":
                        xParam.Type = typeof(String);
                        break;
                    }

                    Report.Parameters.Add(xParam);
                }
            }

            return(result);
        }