From a3bd851f932a5a2587f80912d118e81856802580 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 14 Jun 2022 18:00:13 +0200 Subject: [PATCH 01/20] Fixes Part 1 (collection..) --- ENI2/DetailBaseControl.cs | 4 ++- .../BorderPoliceDetailControl.xaml.cs | 32 +++++++++---------- .../DangerousGoodsDetailControl.xaml.cs | 5 +++ .../TowageDetailControl.xaml.cs | 4 +-- ENI2/ENI2.csproj | 4 +-- ENI2/Excel/ExcelReader.cs | 7 +++- bsmd.database/Extensions.cs | 12 +++++++ .../Properties/AssemblyProductInfo.cs | 2 +- .../Properties/AssemblyProjectInfo.cs | 2 +- 9 files changed, 48 insertions(+), 24 deletions(-) diff --git a/ENI2/DetailBaseControl.cs b/ENI2/DetailBaseControl.cs index b1c00860..70ecc986 100644 --- a/ENI2/DetailBaseControl.cs +++ b/ENI2/DetailBaseControl.cs @@ -280,7 +280,9 @@ namespace ENI2 int minute = Int32.Parse(timevalText.Substring(10, 2)); thePicker.Value = new DateTime(year, month, day, hour, minute, 0); } - catch (Exception) { } + catch (Exception) { + thePicker.Value = null; + } } } diff --git a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs index b3bc701a..9f1f7d34 100644 --- a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs @@ -768,20 +768,20 @@ namespace ENI2.DetailViewControls } CREW crew = new CREW(); if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue; - if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0); + if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0).Clean(); if (crew.CrewMemberLastName.Equals("Family Name") || (crew.CrewMemberLastName.Trim().Length == 0)) continue; - if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1); + if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1).Clean(); if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2)); - if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3); + if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3).Clean(); if (!reader.IsDBNull(4)) crew.CrewMemberNationality = reader.GetString(4).Substring(0, 2).ToUpper(); - if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5); + if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5).Clean(); if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper(); if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7); if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8)); - if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = this.getValueAsString(reader, 9); + if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = this.getValueAsString(reader, 9).Clean(); if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper(); if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11); - if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = this.getValueAsString(reader, 12); + if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = this.getValueAsString(reader, 12).Clean(); crew.MessageHeader = this._crewMessage; crew.IsDirty = true; @@ -925,28 +925,28 @@ namespace ENI2.DetailViewControls PAS pas = new PAS(); if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue; - if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetValue(0).ToString(); + if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetValue(0).ToString().Clean(); if (pas.PassengerLastName.Equals("Family Name") || (pas.PassengerLastName.Trim().Length == 0)) continue; - if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetValue(1).ToString(); + if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetValue(1).ToString().Clean(); if (!reader.IsDBNull(2)) pas.PassengerGender = GlobalStructures.ParseGender(reader.GetString(2)); - if (!reader.IsDBNull(3)) pas.PassengerPortOfEmbarkation = reader.GetString(3); + if (!reader.IsDBNull(3)) pas.PassengerPortOfEmbarkation = reader.GetString(3).Clean(); if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null) pas.PassengerPortOfEmbarkation = null; - if (!reader.IsDBNull(4)) pas.PassengerPortOfDisembarkation = reader.GetString(4); + if (!reader.IsDBNull(4)) pas.PassengerPortOfDisembarkation = reader.GetString(4).Clean(); if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null) pas.PassengerPortOfDisembarkation = null; if (!reader.IsDBNull(5)) pas.PassengerInTransit = GlobalStructures.ReadBoolean(reader.GetString(5)); if (!reader.IsDBNull(6)) pas.PassengerNationality = reader.GetString(6).Substring(0, 2).ToUpper(); - if (!reader.IsDBNull(7)) pas.PassengerPlaceOfBirth = reader.GetString(7); - if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper(); + if (!reader.IsDBNull(7)) pas.PassengerPlaceOfBirth = reader.GetString(7).Clean(); + if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper().Clean(); if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9); if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10)); - if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = this.getValueAsString(reader, 11); + if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = this.getValueAsString(reader, 11).Clean(); if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper(); if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13); - if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = this.getValueAsString(reader, 14); - if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15); - if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = this.getValueAsString(reader, 16); + if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = this.getValueAsString(reader, 14).Clean(); + if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15).Clean(); + if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = this.getValueAsString(reader, 16).Clean(); pas.MessageHeader = this._pasMessage; pas.IsDirty = true; diff --git a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index 06fb8685..7b188990 100644 --- a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -220,6 +220,7 @@ namespace ENI2.DetailViewControls copyMARPOL.CopyFromMARPOL(selectedMARPOL); copyMARPOL.Identifier = DatabaseEntity.GetNewIdentifier(target_haz.MARPOLPositions, "MARPOL-"); target_haz.MARPOLPositions.Add(copyMARPOL); + target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.SetHAZGlobalFlags(); @@ -241,6 +242,7 @@ namespace ENI2.DetailViewControls copyIMSBC.CopyFromIMSBC(selectedIMSBC); copyIMSBC.Identifier = DatabaseEntity.GetNewIdentifier(target_haz.IMSBCPositions, "IMSBC-"); target_haz.IMSBCPositions.Add(copyIMSBC); + target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.SetHAZGlobalFlags(); @@ -262,6 +264,7 @@ namespace ENI2.DetailViewControls copyIMDG.CopyFromIMDG(selectedIMDG); copyIMDG.Identifier = DatabaseEntity.GetNewIdentifier(target_haz.IMDGPositions, "IMDG-"); target_haz.IMDGPositions.Add(copyIMDG); + target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.SetHAZGlobalFlags(); @@ -283,6 +286,7 @@ namespace ENI2.DetailViewControls copyIGC.CopyFromIGC(selectedIGC); copyIGC.Identifier = DatabaseEntity.GetNewIdentifier(target_haz.IGCPositions, "IGC-"); target_haz.IGCPositions.Add(copyIGC); + target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.SetHAZGlobalFlags(); @@ -306,6 +310,7 @@ namespace ENI2.DetailViewControls copyIBC.CopyFromIBC(selectedIBC); copyIBC.Identifier = DatabaseEntity.GetNewIdentifier(target_haz.IBCPositions, "IBC-"); target_haz.IBCPositions.Add(copyIBC); + target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); this.SetHAZGlobalFlags(); diff --git a/ENI2/DetailViewControls/TowageDetailControl.xaml.cs b/ENI2/DetailViewControls/TowageDetailControl.xaml.cs index 6bfae9f9..2ad50d4f 100644 --- a/ENI2/DetailViewControls/TowageDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/TowageDetailControl.xaml.cs @@ -77,9 +77,9 @@ namespace ENI2.DetailViewControls foreach (TOWD selectedTOWD in this.dataGridTowageOnDeparture.SelectedItems) { TOWA copyTOWA = new TOWA(); - copyTOWA.MessageHeader = _towdMessage; + copyTOWA.MessageHeader = _towaMessage; copyTOWA.CopyFromTOWD(selectedTOWD); - copyTOWA.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements); + copyTOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements); this._towaMessage.Elements.Add(copyTOWA); this.dataGridTowageOnArrival.Items.Refresh(); this.SublistElementChanged(Message.NotificationClass.TOWA); diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index b093b377..b9363d13 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 2 - 7.2.0.2 + 0 + 7.3.0.0 false true true diff --git a/ENI2/Excel/ExcelReader.cs b/ENI2/Excel/ExcelReader.cs index bd21b971..c5fe8066 100644 --- a/ENI2/Excel/ExcelReader.cs +++ b/ENI2/Excel/ExcelReader.cs @@ -18,6 +18,7 @@ using System.Linq; using System.Runtime.InteropServices; using ENI2.Locode; using bsmd.database; +using System.Text.RegularExpressions; namespace ENI2.Excel { @@ -77,6 +78,10 @@ namespace ENI2.Excel if (result != null) { result = result.Trim(); + if(result.Length > 0) + { + result = result.Clean(); + } this.ImportValues[lookup] = result; } @@ -569,7 +574,7 @@ namespace ENI2.Excel Worksheet workSheet = (Worksheet) _workBook.Worksheets[sheetName]; string result = workSheet.Range[range].Text.ToString(); if (!result.IsNullOrEmpty()) - result = result.Trim(); + result = result.Trim().Clean(); return result; } catch(Exception e) diff --git a/bsmd.database/Extensions.cs b/bsmd.database/Extensions.cs index fe65bb6c..e1ba2a3a 100644 --- a/bsmd.database/Extensions.cs +++ b/bsmd.database/Extensions.cs @@ -15,6 +15,7 @@ using System.Text.RegularExpressions; using log4net; using System.Linq; using System.Collections; +using System.Text; namespace bsmd.database { @@ -77,6 +78,17 @@ namespace bsmd.database return false; } + public static string Clean(this String str) + { + StringBuilder sb = new StringBuilder(); + foreach (char c in str) + { + if ((c > '\u0020' && c < '\u007E') || c == ' ' || c == '\t' || c == '\n') + sb.Append(c); + } + return sb.ToString(); + } + public static bool Contains(this string source, string toCheck, StringComparison comp) { return source.IndexOf(toCheck, comp) >= 0; diff --git a/bsmd.database/Properties/AssemblyProductInfo.cs b/bsmd.database/Properties/AssemblyProductInfo.cs index 35318206..ee133160 100644 --- a/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("7.2.0")] +[assembly: AssemblyInformationalVersion("7.3.0")] [assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/bsmd.database/Properties/AssemblyProjectInfo.cs b/bsmd.database/Properties/AssemblyProjectInfo.cs index 8111450c..1d4cc244 100644 --- a/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("7.2.0.*")] +[assembly: AssemblyVersion("7.3.0.*")] From c2af7cbca1d213346f2265073d8f95dc557b7bf9 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 14 Jun 2022 18:07:54 +0200 Subject: [PATCH 02/20] ReadLoCode(..) auch bei HAZ beim Excelimport (war ReadText(..)) --- ENI2/Excel/ExcelUtil.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index 7c6be159..d1d3fbf4 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -427,8 +427,8 @@ namespace ENI2.Excel imdgPosition.GrossQuantity_KGM = reader.ReadNumber(imdg_grossQuantity); imdgPosition.VehicleLicenseNumber = reader.ReadText(imdg_number); imdgPosition.StowagePosition = reader.ReadText(imdg_stowagePosition); - imdgPosition.PortOfLoading = reader.ReadText(imdg_portOfLoading); - imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge); + imdgPosition.PortOfLoading = reader.ReadLoCode(imdg_portOfLoading); + imdgPosition.PortOfDischarge = reader.ReadLoCode(imdg_portOfDischarge); imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber); imdgPosition.Remarks = reader.ReadText(imdg_remarks); } @@ -491,8 +491,8 @@ namespace ENI2.Excel ibcPosition.Quantity_KGM = (int ?) reader.ReadNumber(ibc_quantity); ibcPosition.StowagePosition = reader.ReadText(ibc_stowagePosition); - ibcPosition.PortOfLoading = reader.ReadText(ibc_portOfLoading); - ibcPosition.PortOfDischarge = reader.ReadText(ibc_portOfDischarge); + ibcPosition.PortOfLoading = reader.ReadLoCode(ibc_portOfLoading); + ibcPosition.PortOfDischarge = reader.ReadLoCode(ibc_portOfDischarge); ibcPosition.Hazards = reader.ReadHazards(ibc_hazards); ibcPosition.SpecRef15_19 = reader.ReadBoolean(ibc_specrefs); ibcPosition.Remarks = reader.ReadText(ibc_remarks); @@ -529,8 +529,8 @@ namespace ENI2.Excel igcPosition.ProductName = productName; igcPosition.Quantity_KGM = reader.ReadNumber(igc_quantity); igcPosition.StowagePosition = reader.ReadText(igc_stowagePosition); - igcPosition.PortOfLoading = reader.ReadText(igc_portOfLoading); - igcPosition.PortOfDischarge = reader.ReadText(igc_portOfDischarge); + igcPosition.PortOfLoading = reader.ReadLoCode(igc_portOfLoading); + igcPosition.PortOfDischarge = reader.ReadLoCode(igc_portOfDischarge); igcPosition.UNNumber = reader.ReadText(igc_unnumber); igcPosition.IMOClass = reader.ReadText(igc_imoclass); igcPosition.Remarks = reader.ReadText(igc_remarks); @@ -570,8 +570,8 @@ namespace ENI2.Excel imsbcPosition.MHB = reader.ReadBoolean(imsbc_mhb); imsbcPosition.Quantity_KGM = reader.ReadNumber(imsbc_quantity); imsbcPosition.StowagePosition = reader.ReadText(imsbc_stowagePosition); - imsbcPosition.PortOfLoading = reader.ReadText(imsbc_portOfLoading); - imsbcPosition.PortOfDischarge = reader.ReadText(imsbc_portOfDischarge); + imsbcPosition.PortOfLoading = reader.ReadLoCode(imsbc_portOfLoading); + imsbcPosition.PortOfDischarge = reader.ReadLoCode(imsbc_portOfDischarge); imsbcPosition.IMOHazardClass = reader.ReadHazardClass(imsbc_hazardclass); imsbcPosition.UNNumber = reader.ReadText(imsbc_unnumber); imsbcPosition.IMOClass = reader.ReadText(imsbc_imoclass); @@ -622,8 +622,8 @@ namespace ENI2.Excel marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity); marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition); - marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading); - marpolPosition.PortOfDischarge = reader.ReadText(marpol_portOfDischarge); + marpolPosition.PortOfLoading = reader.ReadLoCode(marpol_portOfLoading); + marpolPosition.PortOfDischarge = reader.ReadLoCode(marpol_portOfDischarge); marpolPosition.Remarks = reader.ReadText(marpol_remarks); } From 6721ecf9e29f129cab7b2659955529ea10e79a7c Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 14 Jun 2022 18:15:50 +0200 Subject: [PATCH 03/20] STAT Flag wird beim Excel Import versucht zu importieren, auch wenn der Locode nix ist --- ENI2/Excel/ExcelUtil.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index d1d3fbf4..62d4d3dd 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -980,7 +980,15 @@ namespace ENI2.Excel stat.PortOfRegistry = reader.ReadLoCode("STAT.PortOfRegistry", false); if (stat.PortOfRegistry.Length == 5) + { stat.Flag = stat.PortOfRegistry.Substring(0, 2); + } + else + { + string statFlagString = reader.ReadText("STAT.PortOfRegistry")?.ToUpper(); + if (statFlagString.Length >= 2) + stat.Flag = statFlagString.Substring(0, 2); + } stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber"); stat.CallSign = reader.ReadTextNoWhitespace("STAT.CallSign"); stat.ISMCompanyId = reader.ReadTextNoWhitespace("STAT.ISMCompanyId"); From ba8456b920e157eefdf337732816ed4ec3b63ebd Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 14 Jun 2022 18:21:15 +0200 Subject: [PATCH 04/20] =?UTF-8?q?beim=20manuellen=20Waste-Import=20wird=20?= =?UTF-8?q?der=20last=20harbour=20Eintrag=20in=20Gro=C3=9Fbuchstaben=20ver?= =?UTF-8?q?wandelt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENI2/DetailViewControls/WasteDetailControl.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs index 2850e023..a5fb8751 100644 --- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs @@ -548,7 +548,7 @@ namespace ENI2.DetailViewControls if (!reader.IsDBNull(7)) o = reader.GetValue(7); else o = null; if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o); - if (!reader.IsDBNull(8)) waste.WasteDisposalPort = reader.GetString(8); + if (!reader.IsDBNull(8)) waste.WasteDisposalPort = reader.GetString(8).ToUpper(); if (!reader.IsDBNull(9)) o = reader.GetValue(9); else o = null; if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o); From d0324d8568314b5bb7f8af8dfdbc1f4c8fc77345 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 15 Jun 2022 17:31:58 +0200 Subject: [PATCH 05/20] erste Testversion 7.3 --- ENI2/DetailViewControls/OverViewDetailControl.xaml.cs | 10 ++++++---- bsmd.hisnord/Request.cs | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index 1bb1ba98..4a86d304 100644 --- a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -62,15 +62,17 @@ namespace ENI2.DetailViewControls public override void Initialize() { + bool iAmAdmin = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin; + base.Initialize(); Message.NotificationClass notificationClass = this.Core.IsTransit ? Message.NotificationClass.TRANSIT : Message.NotificationClass.VISIT; if (this.Messages == null) return; if (this.Core == null) return; - this.textBoxENI.IsReadOnly = false; - this.textBoxIMO.IsReadOnly = false; - this.locodePoC.IsEnabled = true; - this.textBoxDisplayId.IsReadOnly = false; + this.textBoxENI.IsReadOnly = !iAmAdmin; + this.textBoxIMO.IsReadOnly = !iAmAdmin; + this.locodePoC.IsEnabled = iAmAdmin; + this.textBoxDisplayId.IsReadOnly = !iAmAdmin; this.textBoxENI.DataContext = this.Core; this.textBoxIMO.DataContext = this.Core; diff --git a/bsmd.hisnord/Request.cs b/bsmd.hisnord/Request.cs index 9bf1c726..8940b5a4 100644 --- a/bsmd.hisnord/Request.cs +++ b/bsmd.hisnord/Request.cs @@ -711,8 +711,10 @@ namespace bsmd.hisnord lu.CargoNumberOfItems = ladg.CargoNumberOfItems.Value.ToString(); if (ladg.CargoGrossQuantity_TNE.HasValue) lu.CargoGrossQuantity_TNE = Math.Round((decimal)ladg.CargoGrossQuantity_TNE.Value, 3); - lu.CargoPortOfLoading = ladg.PortOfLoading; - lu.CargoPortOfDischarge = ladg.PortOfDischarge; + if(!ladg.PortOfLoading.IsNullOrEmpty()) + lu.CargoPortOfLoading = ladg.PortOfLoading; + if(!ladg.PortOfDischarge.IsNullOrEmpty()) + lu.CargoPortOfDischarge = ladg.PortOfDischarge; hn_generalcargo.Cargo[i] = lu; } From 4bbaa1db08577aa20bdfd47be7ce9279429d73cb Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 16 Jun 2022 12:22:15 +0200 Subject: [PATCH 06/20] small bugfix --- ENI2/Controls/POListControl.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ENI2/Controls/POListControl.xaml.cs b/ENI2/Controls/POListControl.xaml.cs index c6b0e3eb..0985b92f 100644 --- a/ENI2/Controls/POListControl.xaml.cs +++ b/ENI2/Controls/POListControl.xaml.cs @@ -233,7 +233,7 @@ namespace ENI2.Controls // suche auslösen this.searchResult = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict); // alle anderen Häfen weg - this.searchResult.RemoveAll(item => !item.PoC.Equals("DEBRV") && !item.PoC.Equals("DEWHV") && !item.PoC.Equals("DEWVN")); + this.searchResult.RemoveAll(item => (item.PoC == null) || (!item.PoC.Equals("DEBRV") && !item.PoC.Equals("DEWHV") && !item.PoC.Equals("DEWVN"))); // rückwärts iterieren um nach ETA und ATA zu filtern if (this.searchResult.Count > 0) From 77ae4a7c407375f165adc2c79159c7c33ea7f6b1 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 16 Jun 2022 13:24:40 +0200 Subject: [PATCH 07/20] Updateabgleich Dialogbox Teil 1 --- ENI2/ENI2.csproj | 15 +++- ENI2/EditControls/CompareExcelDialog.xaml | 35 +++++++++ ENI2/EditControls/CompareExcelDialog.xaml.cs | 78 ++++++++++++++++++++ ENI2/MainWindow.xaml | 4 +- ENI2/MainWindow.xaml.cs | 21 +++++- ENI2/Properties/Resources.Designer.cs | 9 +++ ENI2/Properties/Resources.resx | 3 + 7 files changed, 158 insertions(+), 7 deletions(-) create mode 100644 ENI2/EditControls/CompareExcelDialog.xaml create mode 100644 ENI2/EditControls/CompareExcelDialog.xaml.cs diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index b9363d13..ec89f23c 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -228,6 +228,9 @@ LocodeControl.xaml + + CompareExcelDialog.xaml + EditWasteReceiptDialog.xaml @@ -532,6 +535,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -777,10 +784,10 @@ - - - - + + + + diff --git a/ENI2/EditControls/CompareExcelDialog.xaml b/ENI2/EditControls/CompareExcelDialog.xaml new file mode 100644 index 00000000..e8096095 --- /dev/null +++ b/ENI2/EditControls/CompareExcelDialog.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/ENI2/EditControls/CompareExcelDialog.xaml.cs b/ENI2/EditControls/CompareExcelDialog.xaml.cs new file mode 100644 index 00000000..e60f774c --- /dev/null +++ b/ENI2/EditControls/CompareExcelDialog.xaml.cs @@ -0,0 +1,78 @@ +using System; +using System.IO; +using System.Windows; +using System.Windows.Media.Imaging; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for CompareExcelDialog.xaml + /// + public partial class CompareExcelDialog : Controls.StatusWindowBase + { + private string _sourcePath = null; + private string _targetPath = null; + + public CompareExcelDialog() + { + InitializeComponent(); + } + + private void imageSource_Drop(object sender, DragEventArgs e) + { + string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop); + foreach (string file in files) + Console.WriteLine(file); + if(files.Length > 0) + { + if(File.Exists(files[0])) + { + if(files[0].EndsWith("xls") || files[0].EndsWith("xlsx")) + { + _sourcePath = files[0]; + imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png")); + } + else + { + imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png")); + } + } + else + { + imageSource.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png")); + } + } + } + + private void imageTarget_Drop(object sender, DragEventArgs e) + { + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + foreach (string file in files) + Console.WriteLine(file); + if (files.Length > 0) + { + if (File.Exists(files[0])) + { + if (files[0].EndsWith("xls") || files[0].EndsWith("xlsx")) + { + _targetPath = files[0]; + imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_green.png")); + } + else + { + imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_yellow.png")); + } + } + else + { + imageTarget.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/trafficlight_red.png")); + } + } + } + + private void imageSource_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effects = DragDropEffects.Copy; + } + } +} diff --git a/ENI2/MainWindow.xaml b/ENI2/MainWindow.xaml index a33af61f..37d9d068 100644 --- a/ENI2/MainWindow.xaml +++ b/ENI2/MainWindow.xaml @@ -72,6 +72,7 @@ + @@ -84,7 +85,8 @@ -