public ReportResult(ReportFormat format, string outReportName, string reportPath, ReportDataSource [] ds, SubreportProcessingEventHandler[] subReportProcessing = null) { var local = new LocalReport(); local.ReportPath = reportPath; if (ds != null) { for(int i = 0 ; i < ds.Count() ; i++ ) local.DataSources.Add(ds[i]); } // подключение обработчиков вложенных отчетов if (subReportProcessing != null) { for (int i = 0; i < subReportProcessing.Count(); i++ ) local.SubreportProcessing += subReportProcessing[i]; } ReportType = format.ToString(); DeviceInfo = String.Empty; ReportName = outReportName; RenderBytes = local.Render(ReportType, DeviceInfo , out this.MimiType , out this.Encoding , out this.FileExt , out this.Streams , out this.Warnings ); }
/// <summary> /// Update an existing scheduled report /// </summary> /// <param name="idReport">The ID of the report to update</param> /// <param name="idSite">ID of the piwik site</param> /// <param name="description">Description of the report</param> /// <param name="period">A piwik period</param> /// <param name="hour">Defines the hour at which the report will be sent</param> /// <param name="reportType">The report type</param> /// <param name="reportFormat">The report format</param> /// <param name="includedStatistics">The included statistics</param> /// <param name="emailMe">true if the report should be sent to the own user</param> /// <param name="additionalEmails">A string array of additional email recipients</param> /// <returns>True if update was successful</returns> public Boolean updateReport( int idReport, int idSite, string description, PiwikPeriod period, int hour, ReportType reportType, ReportFormat reportFormat, List <Statistic> includedStatistics, Boolean emailMe, string[] additionalEmails = null ) { Dictionary <string, Object> additionalParameters = new Dictionary <string, Object>() { { "emailMe", emailMe.ToString().ToLower() }, { "displayFormat", 1 }, { "additionalEmails", additionalEmails } }; Parameter[] p = { new SimpleParameter("idReport", idReport), new SimpleParameter("idSite", idSite), new SimpleParameter("description", description), new PeriodParameter("period", period), new SimpleParameter("hour", hour), new SimpleParameter("reportType", reportType.ToString()), new SimpleParameter("reportFormat", reportFormat.ToString()), new ArrayParameter("reports", includedStatistics.Select(i => i.ToString()).ToArray(),false), new DictionaryParameter("parameters", additionalParameters) }; return(this.sendRequest <Boolean>("updateReport", new List <Parameter>(p))); }
/// <summary> /// Save test report to disk. /// </summary> public void SaveTestReport(string filename, ReportFormat format, IEnumerable <Outcome> outcomes) { bool pass = outcomes.Contains(Outcome.Pass); bool fail = outcomes.Contains(Outcome.Fail); bool inconclusive = outcomes.Contains(Outcome.Inconclusive); var testcases = util.SelectTestCases(pass, fail, inconclusive, false); TestReport report = TestReport.GetInstance(format.ToString(), testcases); if (report == null) { throw new Exception(String.Format(StringResources.UnknownReportFormat, format.ToString())); } report.ExportReport(filename); }
private void VerifyReports(GlobalOptions globals, PathFixtures pf, ReportFormat reportFormat, IEnumerable <Tuple <ConsumerOptions, IMessage> > toSend) { globals.FileSystemOptions.ExtractRoot = pf.ExtractRootAbsolute; globals.CohortPackagerOptions.JobWatcherTimeoutInSeconds = 5; globals.CohortPackagerOptions.ReporterType = "FileReporter"; globals.CohortPackagerOptions.ReportFormat = reportFormat.ToString(); MongoClient client = MongoClientHelpers.GetMongoClient(globals.MongoDatabases.ExtractionStoreOptions, "test", true); globals.MongoDatabases.ExtractionStoreOptions.DatabaseName += "-" + Guid.NewGuid().ToString().Split('-')[0]; client.DropDatabase(globals.MongoDatabases.ExtractionStoreOptions.DatabaseName); using (var tester = new MicroserviceTester( globals.RabbitOptions, globals.CohortPackagerOptions.ExtractRequestInfoOptions, globals.CohortPackagerOptions.FileCollectionInfoOptions, globals.CohortPackagerOptions.NoVerifyStatusOptions, globals.CohortPackagerOptions.VerificationStatusOptions)) { foreach ((ConsumerOptions consumerOptions, IMessage message) in toSend) { tester.SendMessage(consumerOptions, new MessageHeader(), message); } var host = new CohortPackagerHost(globals); host.Start(); var timeoutSecs = 10; while (!HaveFiles(pf) && timeoutSecs > 0) { --timeoutSecs; Thread.Sleep(TimeSpan.FromSeconds(1)); } host.Stop("Test end"); } var firstLine = $"# SMI extraction validation report for testProj1/{pf.ExtractName}"; switch (reportFormat) { case ReportFormat.Combined: { string reportContent = File.ReadAllText(Path.Combine(pf.ProjReportsDirAbsolute, $"{pf.ExtractName}_report.txt")); Assert.True(reportContent.StartsWith(firstLine)); break; } case ReportFormat.Split: { string extractReportsDirAbsolute = Path.Combine(pf.ProjReportsDirAbsolute, pf.ExtractName); Assert.AreEqual(6, Directory.GetFiles(extractReportsDirAbsolute).Length); string reportContent = File.ReadAllText(Path.Combine(extractReportsDirAbsolute, "README.md")); Assert.True(reportContent.StartsWith(firstLine)); break; } default: Assert.Fail($"No case for ReportFormat {reportFormat}"); break; } }
/// <summary> /// Update an existing scheduled report /// </summary> /// <param name="idReport">The ID of the report to update</param> /// <param name="idSite">ID of the piwik site</param> /// <param name="description">Description of the report</param> /// <param name="period">A piwik period</param> /// <param name="hour">Defines the hour at which the report will be sent</param> /// <param name="reportType">The report type</param> /// <param name="reportFormat">The report format</param> /// <param name="includedStatistics">The included statistics</param> /// <param name="emailMe">true if the report should be sent to the own user</param> /// <param name="additionalEmails">A string array of additional email recipients</param> /// <returns>True if update was successful</returns> public Boolean updateReport( int idReport, int idSite, string description, PiwikPeriod period, int hour, ReportType reportType, ReportFormat reportFormat, List<Statistic> includedStatistics, Boolean emailMe, string[] additionalEmails = null ) { Dictionary<string, Object> additionalParameters = new Dictionary<string, Object>() { { "emailMe", emailMe.ToString().ToLower() }, { "displayFormat", 1 }, { "additionalEmails", additionalEmails } }; Parameter[] p = { new SimpleParameter("idReport", idReport), new SimpleParameter("idSite", idSite), new SimpleParameter("description", description), new PeriodParameter("period", period), new SimpleParameter("hour", hour), new SimpleParameter("reportType", reportType.ToString()), new SimpleParameter("reportFormat", reportFormat.ToString()), new ArrayParameter("reports", includedStatistics.Select(i => i.ToString()).ToArray(), false), new DictionaryParameter("parameters", additionalParameters) }; return this.sendRequest<Boolean>("updateReport", new List<Parameter>(p)); }
private byte[] GetReportInternal(ReportType reportType, ReportFormat format, ES.ParameterValue[] parameters) { //Reading configuration File string reportServerUrl = ConfigurationManager.AppSettings["ReportServerURL"]; string reportServerFolder = ConfigurationManager.AppSettings["ReportServerFolder"]; // using (var reportService = new RS.ReportingService2005()) { using (var reportExecutionService = new ES.ReportExecutionService()) { reportService.Url = String.Format(@"{0}/ReportService2005.asmx", reportServerUrl); reportExecutionService.Url = String.Format(@"{0}/ReportExecution2005.asmx", reportServerUrl); var environment = SafeConvert.ToEnum<DvsEnvironment>(ConfigurationManager.AppSettings["Environment"]); if (environment.HasValue && (environment.Value == DvsEnvironment.Staging || environment.Value == DvsEnvironment.Production)) { reportService.Credentials = new System.Net.NetworkCredential("ReportSeverUser", "Password10"); reportExecutionService.Credentials = new System.Net.NetworkCredential("ReportSeverUser", "Password10"); } else { reportService.Credentials = System.Net.CredentialCache.DefaultCredentials; reportExecutionService.Credentials = System.Net.CredentialCache.DefaultCredentials; } Dictionary<string, string> metadata = new Dictionary<string, string>(); RS.ReportParameter[] reportParameters = null; string fullReportName = String.Format("{0}/{1}", reportServerFolder, reportType.ToString()); reportParameters = reportService.GetReportParameters(fullReportName, null, false, null, null); ES.ExecutionInfo execInfo = reportExecutionService.LoadReport(fullReportName, null); if (reportParameters.Count() > 0) { List<ES.ParameterValue> execParams = new List<ES.ParameterValue>(); foreach (RS.ReportParameter reportParam in reportParameters) { if (metadata.ContainsKey(reportParam.Name)) execParams.Add(new ES.ParameterValue() { Label = reportParam.Name, Name = reportParam.Name, Value = metadata[reportParam.Name] }); } foreach (var item in parameters) { execParams.Add(item); } reportExecutionService.SetExecutionParameters(execParams.ToArray(), "en-us"); } string encoding = String.Empty; string mimeType = String.Empty; string extension = String.Empty; ES.Warning[] warnings = null; string[] streamIDs = null; byte[] readyReport = reportExecutionService.Render(format.ToString("G"), null, out extension, out mimeType, out encoding, out warnings, out streamIDs); return readyReport; } } }
private string ReportFormat2String(ReportFormat format) { return format == ReportFormat.Html ? "HTML4.0" : format.ToString(); }
public void QuickReport(ReportFormat format) { var quickReportsViewModel = OrderQuickReportsViewModel.Create(SelectedEntity, format); DocumentManagerService.CreateDocument(string.Format("Order{0}QuickReportView", format.ToString()), quickReportsViewModel, null, this).Show(); }
/// <summary> /// Get Parameters /// </summary> /// <param name="parameters">Anonymous object type of report parameters</param> /// <param name="reportFormat">ReportFormat enum</param> /// <returns>Url (encoded) querystring</returns> private string GetParameters(object parameters, ReportFormat reportFormat) { var routeValues = new RouteValueDictionary(parameters); routeValues.Add("rs:Format", reportFormat.ToString()); var queryString = HttpUtility.ParseQueryString(string.Empty); routeValues.ToList().ForEach(x => queryString.Add(x.Key, x.Value.ToString())); return queryString.ToString(); }
private string ReportFormat2String(ReportFormat format) { return(format == ReportFormat.Html ? "HTML4.0" : format.ToString()); }
public byte[] GetReportFile(string reportName, string reportFoldersPath, ReportFormat reportFormat, List<ReportParameter> parameters) { byte[] file = null; try { reportName += "." + reportFormat.ToString().ToLower(); var report = String.Format("rest_v2/reports/reports{0}/{1}", reportFoldersPath, reportName); // Recupera o arquivo no formato byte array. if (parameters.Count > 0) { var urlParams = this.GetUrlParameters(parameters); file = this._client.DownloadData(String.Format("{0}/{1}?{2}", this._urlServer, report, urlParams)); } else { file = this._client.DownloadData(String.Format("{0}/{1}", this._urlServer, report)); } return file; } catch (Exception ex) { throw ex; } }