/// <summary>
 /// Creates an instance of MvcReportViewerIframe class.
 /// </summary>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="reportParameters">The report parameter properties for the report.</param>
 /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
 public MvcReportViewerIframe(
     IReportLoader reportLoader,
     IDictionary<string, object> reportParameters,
     IDictionary<string, object> htmlAttributes)
     : this(reportLoader, reportParameters, null, htmlAttributes, FormMethod.Get)
 {
 }
        // There are no unit tests for this file, as they would amount to a re-implementation of it.
        // It's simply too trivial to be worth testing with mocks.
        // However, it *is* tested via functional tests in the FunctionalTests class.

        /// <summary>
        /// Construct a ReportAnalyser that can read a report and count licenses.
        /// </summary>
        /// <param name="reportLoader">An IReportLoader to handle the file loading and parsing.</param>
        /// <param name="reportToModelConverter">An IReportToModelConverter to convert load results into model data.</param>
        /// <param name="installationCatalog">An IInstallationCatalog smart container that can perform efficient licesnse assessments.</param>
        /// <param name="licenseAssessor">An ILicenseAssessor to identify per-user license requirements.</param>
        public ReportAnalyser(IReportLoader reportLoader, IReportToModelConverter reportToModelConverter, IInstallationCatalog installationCatalog, ILicenseAssessor licenseAssessor)
        {
            _reportLoader           = reportLoader;
            _reportToModelConverter = reportToModelConverter;
            _installationCatalog    = installationCatalog;
            _licenseAssessor        = licenseAssessor;
        }
示例#3
0
        /// <summary>
        /// Конструктор, принимающие интерфейс загрузки отчетов
        /// </summary>
        /// <param name="reportLoader"></param>
        public ReportsPage(IReportLoader reportLoader)
        {
            InitializeComponent();

            Title = Droid.Resources.Messages.Text_Reports;

            _viewModel          = new ReportsViewModel(reportLoader);
            this.BindingContext = _viewModel;
        }
 /// <summary>
 /// Returns an HTML <b>iframe</b> rendering ASP.NET ReportViewer control with Remote Processing Mode.
 /// </summary>
 /// <param name="helper">The HTML helper instance that this method extends.</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
 /// <returns>An HTML <b>iframe</b> element.</returns>
 public static MvcReportViewerIframe MvcReportViewer(
     this HtmlHelper helper,
     IReportLoader reportLoader,
     object htmlAttributes)
 {
     return new MvcReportViewerIframe(
         reportLoader,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
        public UploadController(IReportLoader reportLoader)
        {
            if (reportLoader == null)
            {
                throw new ArgumentNullException("reportLoader");
            }

            this.reportLoader = reportLoader;
        }
示例#6
0
        public UploadController(IReportLoader reportLoader)
        {
            if (reportLoader == null)
            {
                throw new ArgumentNullException("reportLoader");
            }

            this.reportLoader = reportLoader;
        }
 /// <summary>
 /// Returns an HTML <b>iframe</b> rendering ASP.NET ReportViewer control with Remote Processing Mode.
 /// </summary>
 /// <param name="helper">The HTML helper instance that this method extends.</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="reportParameters">The report parameter properties for the report.</param>
 /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
 /// <returns>An HTML <b>iframe</b> element.</returns>
 public static MvcReportViewerIframe MvcReportViewer(
     this HtmlHelper helper,
     IReportLoader reportLoader,
     IEnumerable<KeyValuePair<string, object>> reportParameters,
     object htmlAttributes)
 {
     return new MvcReportViewerIframe(
         reportLoader,
         reportParameters,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
 /// <summary>
 /// Returns an HTML <b>iframe</b> rendering ASP.NET ReportViewer control with Remote Processing Mode.
 /// </summary>
 /// <param name="helper">The HTML helper instance that this method extends.</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="reportServerUrl">The URL for the report server.</param>
 /// <param name="username">The report server username.</param>
 /// <param name="password">The report server password.</param>
 /// <param name="reportParameters">The report parameter properties for the report.</param>
 /// <param name="controlSettings">The Report Viewer control's UI settings.</param>
 /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
 /// <param name="method">Method for sending parameters to the iframe, either GET or POST.</param>
 /// <returns>An HTML <b>iframe</b> element.</returns>
 public static MvcReportViewerIframe MvcReportViewer(
     this HtmlHelper helper,
     IReportLoader reportLoader,
     IEnumerable<KeyValuePair<string, object>> reportParameters = null,
     ControlSettings controlSettings = null,
     object htmlAttributes = null,
     FormMethod method = FormMethod.Get)
 {
     return new MvcReportViewerIframe(
         reportLoader,
         reportParameters,
         controlSettings,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes),
         method);
 }
 /// <summary>
 /// Creates a FileContentResult object by using Report Viewer Web Control.
 /// </summary>
 /// <param name="controller">The Controller instance that this method extends.</param>
 /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="mode">Report processing mode: remote or local.</param>
 /// <param name="localReportDataSources">Local report data sources</param>
 /// <returns>The file-content result object.</returns>
 public static FileStreamResult Report(
     this Controller controller,
     ReportFormat reportFormat,
     IReportLoader reportLoader,
     ProcessingMode mode,
     IEnumerable<IDataSource> reportDataSources = null,
     IEnumerable<ISubReportDataSource> subReportDataSources = null)
 {
     var reportRunner = new ReportRunner(
         reportFormat,
         reportLoader,
         mode,
         reportDataSources,
         subReportDataSources);
     return reportRunner.Run();
 }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            IReportLoader reportLoader,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode,
            IEnumerable<IDataSource> reportDataSources = null,
            IEnumerable<ISubReportDataSource> subReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportLoader,
                reportParameters,
                mode,
                reportDataSources,
                subReportDataSources);

            return reportRunner.Run();
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            IReportLoader reportLoader,
            object reportParameters,
            ProcessingMode mode,
            IEnumerable<IDataSource> reportDataSources = null,
            IEnumerable<ISubReportDataSource> subReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportLoader,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters),
                mode,
                reportDataSources,
                subReportDataSources);

            return reportRunner.Run();
        }
 /// <summary>
 /// Returns fluent interface to HTML <b>iframe</b> rendering ASP.NET ReportViewer control. 
 /// IMPORTANT: Unit-tests only!
 /// </summary>
 /// <param name="helper">The HTML helper instance that this method extends.</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <returns>Fluent interface HTML <b>iframe</b> element.</returns>
 internal static IMvcReportViewerOptions MvcReportViewerFluent(
     this HtmlHelper helper,
     IReportLoader reportLoader,
     Guid controlId)
 {
     var iframe = new MvcReportViewerIframe(reportLoader);
     iframe.ControlId = controlId;
     return iframe;
 }
 /// <summary>
 /// Returns fluent interface to HTML <b>iframe</b> rendering ASP.NET ReportViewer control.
 /// </summary>
 /// <param name="helper">The HTML helper instance that this method extends.</param>
 /// <param name="reportLoader">The path to the report on the server.</param>
 /// <returns>Fluent interface HTML <b>iframe</b> element.</returns>
 public static IMvcReportViewerOptions MvcReportViewerFluent(
     this HtmlHelper helper,
     IReportLoader reportLoader)
 {
     return new MvcReportViewerIframe(reportLoader);
 }
 /// <summary>
 /// Creates an instance of MvcReportViewerIframe class.
 /// </summary>
 /// <param name="reportPath">The path to the report on the server.</param>
 public MvcReportViewerIframe(IReportLoader reportLoader)
     : this(reportLoader, null, null, null, FormMethod.Get)
 {
 }
        /// <summary>
        /// Creates an instance of MvcReportViewerIframe class.
        /// </summary>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportServerUrl">The URL for the report server.</param>
        /// <param name="username">The report server username.</param>
        /// <param name="password">The report server password.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="controlSettings">The Report Viewer control's UI settings.</param>
        /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param>
        /// <param name="method">Method for sending parameters to the iframe, either GET or POST.</param>
        public MvcReportViewerIframe(
            IReportLoader reportLoader,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ControlSettings controlSettings,
            IDictionary<string, object> htmlAttributes,
            FormMethod method)
        {
            var javaScriptApi = ConfigurationManager.AppSettings[WebConfigSettings.JavaScriptApi];
            if (string.IsNullOrEmpty(javaScriptApi))
            {
                throw new MvcReportViewerException("MvcReportViewer.js location is not found. Make sure you have MvcReportViewer.AspxViewerJavaScript in your Web.config.");
            }

            _reportLoader = reportLoader;

            _controlSettings = controlSettings;
            _reportParameters = reportParameters != null ? reportParameters.ToList() : null;
            _htmlAttributes = htmlAttributes;
            _method = method;
            _aspxViewer = ConfigurationManager.AppSettings[WebConfigSettings.AspxViewer];
            if (string.IsNullOrEmpty(_aspxViewer))
            {
                throw new MvcReportViewerException("ASP.NET Web Forms viewer is not set. Make sure you have MvcReportViewer.AspxViewer in your Web.config.");
            }

            _aspxViewer = _aspxViewer.Trim();
            if (_aspxViewer.StartsWith("~"))
            {
                _aspxViewer = VirtualPathUtility.ToAbsolute(_aspxViewer);
            }

            var encryptParametesConfig = ConfigurationManager.AppSettings[WebConfigSettings.EncryptParameters];
            if (!bool.TryParse(encryptParametesConfig, out _encryptParameters))
            {
                _encryptParameters = false;
            }

            ControlId = Guid.NewGuid();
        }