From 9353da42e5c8a08ece67266d138b2d6d54218ab8 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 11 May 2022 09:05:04 +0200 Subject: [PATCH] =?UTF-8?q?Korrekturen=20f=C3=BCr=20Dakosy=20Sheet=20einle?= =?UTF-8?q?sen=20Pt.=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OverViewDetailControl.xaml.cs | 8 ++++-- ENI2/ENI2.csproj | 4 +-- ENI2/Excel/DakosyUtil.cs | 25 +++++++++-------- ENI2/Excel/ExcelReader.cs | 28 +++++++++++++++++-- 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index d622f76d..040e3017 100644 --- a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -67,12 +67,16 @@ namespace ENI2.DetailViewControls if (this.Messages == null) return; if (this.Core == null) return; - if(DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin) + if (DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin) { this.textBoxENI.IsReadOnly = false; this.textBoxIMO.IsReadOnly = false; this.locodePoC.IsEnabled = true; - this.textBoxDisplayId.IsReadOnly = false; + this.textBoxDisplayId.IsReadOnly = false; + } + else + { + this.buttonExcelExport.Visibility = Visibility.Hidden; } this.textBoxENI.DataContext = this.Core; diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 668f18dd..58815865 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 0 - 7.1.0.0 + 1 + 7.1.0.1 false true true diff --git a/ENI2/Excel/DakosyUtil.cs b/ENI2/Excel/DakosyUtil.cs index eb52cdf4..36543016 100644 --- a/ENI2/Excel/DakosyUtil.cs +++ b/ENI2/Excel/DakosyUtil.cs @@ -228,6 +228,9 @@ namespace ENI2.Excel } WAS was = wasMessage.Elements[0] as WAS; was.WasteDisposalValidExemption = reader.ReadCellAsBool("waste", "C8"); + was.ConfirmationOfCorrectness = true; + was.ConfirmationOfSufficiency = true; + if(!(was.WasteDisposalValidExemption ?? false)) { was.LastWasteDisposalPort = reader.ReadCellAsText("waste", "C10"); @@ -515,8 +518,8 @@ namespace ENI2.Excel string issuerType = reader.ReadCellAsText("security", "D20"); if(!issuerType.IsNullOrEmpty()) { - if (isscType.Equals("ADMINISTRATION", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 0; - if (isscType.Equals("RSO", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 1; + if (issuerType.Equals("ADMINISTRATION", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 0; + if (issuerType.Equals("RSO", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 1; } sec.ISSCIssuerName = reader.ReadCellAsText("security", "D21"); sec.ISSCDateOfExpiration = reader.ReadCellAsDateTime("security", "D22"); @@ -763,21 +766,21 @@ namespace ENI2.Excel pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16)); pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger arrival", string.Format("P{0}", i + 16)); - if(pas.NotificationPAX ?? false) - { + //if(pas.NotificationPAX ?? false) + //{ pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16)); pas.EmergencyContactNumber = reader.ReadCellAsText("passenger arrival", string.Format("R{0}", i + 16)); - } + //} - if(pas.NotificationSchengen ?? false) - { + //if(pas.NotificationSchengen ?? false) + //{ pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger arrival", string.Format("I{0}", i + 16))); pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger arrival", string.Format("J{0}", i + 16)); pas.PassengerVisaNumber = reader.ReadCellAsText("passenger arrival", string.Format("K{0}", i + 16)); pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger arrival", string.Format("L{0}", i + 16)); pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger arrival", string.Format("M{0}", i + 16)); pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16)); - } + //} result = true; } @@ -1186,15 +1189,15 @@ namespace ENI2.Excel crew.CrewMemberGender = ParseGender(gender); crew.CrewMemberNationality = reader.ReadCellAsText("crew arrival", string.Format("H{0}", i + 15)); - if(crew.NotificationSchengen ?? false) - { + //if(crew.NotificationSchengen ?? false) + //{ string idDocType = reader.ReadCellAsText("crew arrival", string.Format("I{0}", i + 15)); crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType); crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew arrival", string.Format("J{0}", i + 15)); crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew arrival", string.Format("K{0}", i + 15)); crew.CrewMemberIdentityDocumentIssuingState = reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15)); crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew arrival", string.Format("N{0}", i + 15)); - } + //} crew.CrewMemberDuty = reader.ReadCellAsText("crew arrival", string.Format("L{0}", i + 15)); diff --git a/ENI2/Excel/ExcelReader.cs b/ENI2/Excel/ExcelReader.cs index 28a53008..83d4a968 100644 --- a/ENI2/Excel/ExcelReader.cs +++ b/ENI2/Excel/ExcelReader.cs @@ -566,7 +566,7 @@ namespace ENI2.Excel try { Worksheet workSheet = (Worksheet) _workBook.Worksheets[sheetName]; - string result = workSheet.Range[range].Text.ToString(); + string result = workSheet.Range[range].Text.ToString(); return result; } catch(Exception e) @@ -576,6 +576,26 @@ namespace ENI2.Excel return null; } + // TODO THIS IS NOT WORKING + internal string ReadTextFromDropdown(string sheetName, string range) + { + try + { + Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName]; + + Shapes shapes = workSheet.Shapes; + Shape aShape = shapes.Item("bla"); + Range aRange = workSheet.Range[range]; + + string formulaRange = aRange.Validation.Formula1; + } + catch (Exception e) + { + _log.Warn(e.Message); + } + return null; + } + internal bool? ReadCellAsBool(string sheetName, string range) { string boolString = ReadCellAsText(sheetName, range); @@ -632,11 +652,13 @@ namespace ENI2.Excel CultureInfo provider = CultureInfo.InvariantCulture; const string dateTimeFormat = "yyyy/MM/dd HH:mm"; if (DateTime.TryParseExact(dateString, dateTimeFormat, provider, DateTimeStyles.None, out DateTime tmpDate)) - return tmpDate; + return tmpDate.ToUniversalTime(); const string dateFormat = "yyyy/MM/dd"; if (DateTime.TryParseExact(dateString, dateFormat, provider, DateTimeStyles.None, out DateTime tmpDate2)) return tmpDate2; - + const string dateFormat2 = "dd.MM.yyyy"; + if (DateTime.TryParseExact(dateString, dateFormat2, provider, DateTimeStyles.None, out DateTime tmpDate3)) + return tmpDate3; return null; } else return null;