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) 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/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index ef0d533e..72deed89 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -636,7 +636,7 @@ namespace ENI2 DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); } - if (!ata_queued_or_sent) + if ((!ata_queued_or_sent ) && !DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin) { aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; aMessage.ChangedBy = ""; 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 b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml index 683af440..fe9d1837 100644 --- a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml +++ b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml @@ -63,13 +63,14 @@ - + - + + diff --git a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index 06fb8685..1c28b2cb 100644 --- a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -220,9 +220,9 @@ 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(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -241,9 +241,9 @@ 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(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -262,9 +262,9 @@ 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(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -283,9 +283,9 @@ 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(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -306,9 +306,9 @@ 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(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -322,20 +322,14 @@ namespace ENI2.DetailViewControls void SetHAZGlobalFlags() { HAZ haz = this.IsDeparture ? this.hazd : this.haza; + int totalCount = haz.MARPOLPositions.Count + haz.IMDGPositions.Count + haz.IGCPositions.Count + haz.IBCPositions.Count + haz.IMSBCPositions.Count; if(totalCount == 1) { - if (!this.IsDeparture) - { - if (!(this.checkBoxDangerousGoodsOnBoard.IsChecked ?? false)) this.checkBoxDangerousGoodsOnBoard.IsChecked = true; - if (this.checkBoxMoUBaltic.IsChecked ?? true) this.checkBoxMoUBaltic.IsChecked = false; - } - else - { - haz.NoDPGOnBoardOnArrival = false; - // theHAZ.DPGManifestOnBoardOnArrival = true; - haz.MOUBaltic = false; - } + if (!(this.checkBoxDangerousGoodsOnBoard.IsChecked ?? false)) this.checkBoxDangerousGoodsOnBoard.IsChecked = true; + if (this.checkBoxMoUBaltic.IsChecked ?? true) this.checkBoxMoUBaltic.IsChecked = false; + haz.NoDPGOnBoardOnArrival = false; + haz.MOUBaltic = false; } } 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/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index 605f2730..45787c79 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -423,7 +423,7 @@ namespace ENI2.DetailViewControls { SERV newServ = new SERV(); newServ.ServiceBeneficiary = "Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655"; - newServ.ServiceInvoiceRecipient = "Sealand Europe Deutschland A/S & Co. KG, Ericusspitze 2-4, 20457 Hamburg"; + newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Ericusspitze 2-4, 20457 Hamburg"; newServ.ServiceName = "SeaGo BHV"; newServ.MessageHeader = this._servMessage; newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); 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/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); diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 7456d833..e3825e8f 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 + 3 + 7.3.0.3 false true true @@ -228,6 +228,9 @@ LocodeControl.xaml + + CompareExcelDialog.xaml + EditWasteReceiptDialog.xaml @@ -236,6 +239,7 @@ + @@ -532,6 +536,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -777,10 +785,10 @@ - - - - + + + + @@ -814,6 +822,8 @@ + + Always diff --git a/ENI2/EditControls/CompareExcelDialog.xaml b/ENI2/EditControls/CompareExcelDialog.xaml new file mode 100644 index 00000000..cf243be2 --- /dev/null +++ b/ENI2/EditControls/CompareExcelDialog.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + Drop your Excel file here + + + + + + + + +