From 04a086548ad85caac69310fa5e6751607f16e96f Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 21 Dec 2021 18:29:38 +0100 Subject: [PATCH] =?UTF-8?q?Report=20Erzeugung=20aus=20ENI=20funktional,=20?= =?UTF-8?q?das=20alte=20Kontext-men=C3=BC=20ist=20aber=20noch=20drin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OverViewDetailControl.xaml.cs | 3 ++- ENI2/ENI2.csproj | 8 ++++++++ ENI2/Report/LabelStorage.cs | 2 +- ENI2/Report/ReportDocument.cs | 14 ++++++-------- ENI2/Report/ReportManager.cs | 3 ++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index 2162d1ea..907fb9b1 100644 --- a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -556,7 +556,8 @@ namespace ENI2.DetailViewControls // create PDF from message classes if (rm.Create(sfd.FileName, this.Core, sicd.SelectedClasses, out string importResultText)) { - MessageBox.Show("Report created", "Success", MessageBoxButton.OK, MessageBoxImage.Information); + MessageBox.Show("Report created: " + sfd.FileName, "Success", MessageBoxButton.OK, MessageBoxImage.Information); + // Clipboard.SetText(sfd.FileName); } else { diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index d22aa614..74b56cbb 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -702,6 +702,14 @@ Settings.settings True + + Report\Logo.gif + PreserveNewest + + + report.db + PreserveNewest + diff --git a/ENI2/Report/LabelStorage.cs b/ENI2/Report/LabelStorage.cs index 70d3d0f0..65c8d63c 100644 --- a/ENI2/Report/LabelStorage.cs +++ b/ENI2/Report/LabelStorage.cs @@ -22,7 +22,7 @@ namespace ENI2.Report static LabelStorage() { _con = new SQLiteConnection(string.Format("data source={0}; Version=3;", _locode_DB_NAME)); - _con.Open(); + _con.Open(); } #region public static properties diff --git a/ENI2/Report/ReportDocument.cs b/ENI2/Report/ReportDocument.cs index 93113301..12ca62b6 100644 --- a/ENI2/Report/ReportDocument.cs +++ b/ENI2/Report/ReportDocument.cs @@ -77,10 +77,8 @@ namespace ENI2.Report #region create document - internal static Document CreateSingleClassDocument(MessageCore reportCore, List reportMessages, - Dictionary coverInfos, string classes, ReportingParty rp) + internal static Document CreateSingleClassDocument(MessageCore reportCore, Dictionary coverInfos, string classes, ReportingParty rp) { - Document document = new Document(); document.Info.Title = string.Format("{0} for {1}", classes, reportCore.DisplayId); document.Info.Subject = "Reporting class info"; @@ -260,7 +258,7 @@ namespace ENI2.Report table.AddColumn(140); Row row = table.AddRow(); - Image logoImage = row.Cells[0].AddImage("Logo.gif"); // kann man offenbar nur von einem Pfad laden + Image logoImage = row.Cells[0].AddImage(@"Report\Logo.gif"); // kann man offenbar nur von einem Pfad laden logoImage.Width = 80; row.Cells[0].MergeDown = 6; @@ -880,7 +878,7 @@ namespace ENI2.Report for (int i = 0; i < mdh.InfectedAreas.Count; i++) { Row row = table.AddRow(); - row.Cells[0].AddParagraph(mdh.InfectedAreas[i].Identifier); + row.Cells[0].AddParagraph(mdh.InfectedAreas[i].Identifier ?? i.ToString()); row.Cells[1].AddParagraph(mdh.InfectedAreas[i].InfectedAreaPort); row.Cells[2].AddParagraph(mdh.InfectedAreas[i].InfectedAreaDate.HasValue ? mdh.InfectedAreas[i].InfectedAreaDate.Value.ToShortDateString() : ""); } @@ -1447,10 +1445,10 @@ namespace ENI2.Report row.Cells[5].AddParagraph(towd.TowageOnDepartureDraught_DMT.HasValue ? towd.TowageOnDepartureDraught_DMT.Value.ToString() : ""); row.Cells[6].AddParagraph(towd.TowageOnDepartureRemarks ?? ""); row.Cells[7].AddParagraph(towd.TowageOnDepartureOperatorCompanyName ?? ""); - row.Cells[8].AddParagraph(towd.TowageOnDepartureOperatorStreetNameAndNumber); - row.Cells[9].AddParagraph(towd.TowageOnDepartureOperatorPostalCode); + row.Cells[8].AddParagraph(towd.TowageOnDepartureOperatorStreetNameAndNumber ?? ""); + row.Cells[9].AddParagraph(towd.TowageOnDepartureOperatorPostalCode ?? ""); row.Cells[10].AddParagraph(towd.TowageOnDepartureOperatorCountry ?? ""); - row.Cells[11].AddParagraph(towd.TowageOnDepartureOperatorPhone); + row.Cells[11].AddParagraph(towd.TowageOnDepartureOperatorPhone ?? ""); row.Cells[12].AddParagraph(towd.TowageOnDepartureOperatorFax ?? ""); row.Cells[13].AddParagraph(towd.TowageOnDepartureOperatorEmail ?? ""); } diff --git a/ENI2/Report/ReportManager.cs b/ENI2/Report/ReportManager.cs index 804badca..f2187eb0 100644 --- a/ENI2/Report/ReportManager.cs +++ b/ENI2/Report/ReportManager.cs @@ -55,7 +55,7 @@ namespace ENI2.Report coverInfos.Add("Visit-ID", core.DisplayId); coverInfos.Add("Class", classes); - Document migraDocument = ReportDocument.CreateSingleClassDocument(core, reportMessages, coverInfos, classes, ReportingParty.CurrentReportingParty); + Document migraDocument = ReportDocument.CreateSingleClassDocument(core, coverInfos, classes, ReportingParty.CurrentReportingParty); // print messages to document foreach (Message message in reportMessages) @@ -65,6 +65,7 @@ namespace ENI2.Report ReportDocument.RenderDocument(migraDocument, filePath); _log.InfoFormat("Created PDF document: {0}", filePath); + result = true; } catch (Exception ex) {