public override void CustomShowPreview(
            string reportContainerHandle,
            ReportParametersObjectBase parametersObject,
            DevExpress.Data.Filtering.CriteriaOperator criteria,
            bool canApplyCriteria,
            SortProperty[] sortProperty,
            bool canApplySortProperty,
            ShowViewParameters showViewParameters,
            bool isSinglePage)
        {
            IReportContainer reportContainer = ReportDataProvider.ReportsStorage.GetReportContainerByHandle(reportContainerHandle);

            Guard.ArgumentNotNull(reportContainer, "reportContainer");
            Type dataType = GetReportDataSourceObjectType(reportContainer.Report);

            objectSpace = Application.CreateObjectSpace(dataType);
            DetailView            previewDetailView   = new DetailView((IModelDetailView)Application.Model.Views[ReportsAspNetModuleV2.ReportViewDetailViewWebName], objectSpace, null, Application, false);
            ReportViewerContainer reportViewContainer = new ReportViewerContainer(parametersObject, criteria, canApplyCriteria, sortProperty, canApplySortProperty);

            DevExpress.ExpressApp.ReportsV2.Web.ReportViewerDetailItem reportViewer =
                new DevExpress.ExpressApp.ReportsV2.Web.ReportViewerDetailItem(
                    reportContainerHandle,
                    reportViewContainer,
                    "ReportViewer");
            reportViewer.QueryReport            += this.HandleQueryReportEvent;
            reportViewer.CustomParameterEditors += HandleCustomParameterEditorsEvent;
            previewDetailView.AddItem(reportViewer);
            previewDetailView.Caption = reportContainer.Report.DisplayName;

            if (isSinglePage)
            {
                Namoly.Module.Common.Utility.SinglePageHelper.GenerateSinglePageReport(reportContainer.Report, true, 6);
            }

            PreviewReportDialogController windowController = Application.CreateController <PreviewReportDialogController>();

            windowController.AcceptAction.Active["ReportPreview"] = false;
            if (showViewParameters == null)
            {
                showViewParameters = new ShowViewParameters();
                showViewParameters.Controllers.Add(windowController);
                showViewParameters.CreatedView  = previewDetailView;
                showViewParameters.TargetWindow = TargetWindow.NewWindow;
                Application.ShowViewStrategy.ShowView(showViewParameters, new ShowViewSource(Frame, null));
            }
            else
            {
                showViewParameters.Controllers.Add(windowController);
                showViewParameters.CreatedView  = previewDetailView;
                showViewParameters.TargetWindow = TargetWindow.NewWindow;
            }
        }
Ejemplo n.º 2
0
        private void AddStateMachineActionsContainerToDetailViewLayout(DetailView detailView, string actionsContainerId, string caption)
        {
            if (detailView.Model.Items[actionsContainerId] != null)
            {
                return;
            }
            var    containerViewItem1   = detailView.Model.Items.AddNode <IModelActionContainerViewItem>(actionsContainerId);
            var    modelApplicationBase = ( ModelApplicationBase )detailView.Model.Application;
            string currentAspect        = modelApplicationBase.CurrentAspect;

            modelApplicationBase.SetCurrentAspect("");
            containerViewItem1.Caption = caption;
            modelApplicationBase.SetCurrentAspect(currentAspect);
            IModelViewLayoutElement viewLayoutElement   = detailView.Model.Layout.Count > 0 ? detailView.Model.Layout[0] : null;
            IModelLayoutViewItem    modelLayoutViewItem = !(viewLayoutElement is IModelLayoutGroup)
                                                   ? detailView.Model.Layout.AddNode <IModelLayoutViewItem>(containerViewItem1.Id)
                                                   : viewLayoutElement.AddNode <IModelLayoutViewItem>(containerViewItem1.Id);

            modelLayoutViewItem.ViewItem    = containerViewItem1;
            modelLayoutViewItem.ShowCaption = true;
            var containerViewItem2 = ( ActionContainerViewItem )detailView.AddItem(containerViewItem1);
        }