From 0533b579b2a15dd4534fe6341e2267562deac2e3 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sat, 28 May 2022 07:50:21 +0200 Subject: [PATCH] Fixes for 7.2 pt 1 --- .../ArrivalNotificationDetailControl.xaml.cs | 17 ++++++++++------- .../DangerousGoodsDetailControl.xaml.cs | 15 +++++---------- .../DepartureNotificationDetailControl.xaml.cs | 17 ++++++++++------- ENI2/Excel/DakosyUtil.cs | 3 +-- ENI2/Excel/ExcelUtil.cs | 3 +-- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs index f7ef41a7..547076e3 100644 --- a/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs @@ -165,14 +165,17 @@ namespace ENI2.DetailViewControls private void copyBKR(object sender, RoutedEventArgs e) { - foreach (BRKA brka in this.dataGridBKRA.Items) + if (this.dataGridBKRA.SelectedItems != null) { - BRKD copyBRKD = new BRKD(); - copyBRKD.MessageHeader = this._brkdMessage; - copyBRKD.CopyFromBKRA(brka); - copyBRKD.Identifier = DatabaseEntity.GetNewIdentifier(this._brkdMessage.Elements); - this._brkdMessage.Elements.Add(copyBRKD); - this.SublistElementChanged(Message.NotificationClass.BKRD); + foreach (BRKA brka in this.dataGridBKRA.SelectedItems) + { + BRKD copyBRKD = new BRKD(); + copyBRKD.MessageHeader = this._brkdMessage; + copyBRKD.CopyFromBKRA(brka); + copyBRKD.Identifier = DatabaseEntity.GetNewIdentifier(this._brkdMessage.Elements); + this._brkdMessage.Elements.Add(copyBRKD); + this.SublistElementChanged(Message.NotificationClass.BKRD); + } } } diff --git a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index 117b8c2b..06fb8685 100644 --- a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -343,9 +343,8 @@ namespace ENI2.DetailViewControls private void DataGridMARPOLItems_DeleteRequested(DatabaseEntity obj) { - MARPOL_Annex_I_Position marpol = obj as MARPOL_Annex_I_Position; HAZ haz = this.IsDeparture ? hazd : haza; - if (marpol != null) + if (obj is MARPOL_Annex_I_Position marpol) { // are you sure dialog is in base class DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(marpol); @@ -428,8 +427,7 @@ namespace ENI2.DetailViewControls private void DataGridIMSBCItems_DeleteRequested(DatabaseEntity obj) { HAZ haz = this.IsDeparture ? hazd : haza; - IMSBCPosition imsbc = obj as IMSBCPosition; - if (imsbc != null) + if (obj is IMSBCPosition imsbc) { // are you sure dialog is in base class DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imsbc); @@ -511,8 +509,7 @@ namespace ENI2.DetailViewControls private void DataGridIGCItems_DeleteRequested(DatabaseEntity obj) { HAZ haz = this.IsDeparture ? hazd : haza; - IGCPosition igc = obj as IGCPosition; - if (igc != null) + if (obj is IGCPosition igc) { // are you sure dialog is in base class DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(igc); @@ -593,8 +590,7 @@ namespace ENI2.DetailViewControls private void DataGridIBCItems_DeleteRequested(DatabaseEntity obj) { HAZ haz = this.IsDeparture ? hazd : haza; - IBCPosition ibc = obj as IBCPosition; - if (ibc != null) + if (obj is IBCPosition ibc) { // are you sure dialog is in base class DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ibc); @@ -675,8 +671,7 @@ namespace ENI2.DetailViewControls private void DataGridIMDGItems_DeleteRequested(DatabaseEntity obj) { HAZ haz = this.IsDeparture ? hazd : haza; - IMDGPosition imdg = obj as IMDGPosition; - if (imdg != null) + if (obj is IMDGPosition imdg) { // are you sure dialog is in base class DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imdg); diff --git a/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs index 8d4c778d..b639df90 100644 --- a/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs @@ -242,14 +242,17 @@ namespace ENI2.DetailViewControls private void copyBKR(object sender, RoutedEventArgs e) { - foreach (BRKD brkd in this.dataGridBKRD.Items) + if (this.dataGridBKRD.SelectedItems != null) { - BRKA copyBRKA = new BRKA(); - copyBRKA.MessageHeader = this._brkaMessage; - copyBRKA.CopyFromBKRD(brkd); - copyBRKA.Identifier = DatabaseEntity.GetNewIdentifier(this._brkaMessage.Elements); - this._brkaMessage.Elements.Add(copyBRKA); - this.SublistElementChanged(Message.NotificationClass.BKRA); + foreach (BRKD brkd in this.dataGridBKRD.SelectedItems) + { + BRKA copyBRKA = new BRKA(); + copyBRKA.MessageHeader = this._brkaMessage; + copyBRKA.CopyFromBKRD(brkd); + copyBRKA.Identifier = DatabaseEntity.GetNewIdentifier(this._brkaMessage.Elements); + this._brkaMessage.Elements.Add(copyBRKA); + this.SublistElementChanged(Message.NotificationClass.BKRA); + } } } diff --git a/ENI2/Excel/DakosyUtil.cs b/ENI2/Excel/DakosyUtil.cs index ad574ee0..c4e84226 100644 --- a/ENI2/Excel/DakosyUtil.cs +++ b/ENI2/Excel/DakosyUtil.cs @@ -649,8 +649,7 @@ namespace ENI2.Excel pre72h.PlannedOperations = reader.ReadTextFromDropdown("port state control", "C14"); pre72h.PlannedWorks = reader.ReadCellAsText("port state control", "C15"); pre72h.DateOfLastExpandedInspection = reader.ReadCellAsDateTime("port state control", "C16"); - pre72h.PlannedPeriodOfStay_HUR = reader.ReadCellAsDecimal("port state control", "C17"); - if (pre72h.PlannedOperations.IsNullOrEmpty()) pre72h.PlannedOperations = "n"; + pre72h.PlannedPeriodOfStay_HUR = reader.ReadCellAsDecimal("port state control", "C17"); if (pre72h.PlannedWorks.IsNullOrEmpty()) pre72h.PlannedWorks = "n"; return true; diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index 1402ecb4..1f5bfb10 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -1893,8 +1893,7 @@ namespace ENI2.Excel // diese Nachricht bleibt auch wenn sie leer ist pre72h.ConditionCargoBallastTanks = reader.ReadConditionTanks("PRE72H.ConditionCargoBallastTanks"); pre72h.TankerHullConfiguration = reader.ReadHullConfiguration("PRE72H.TankerHullConfiguration"); - pre72h.PlannedWorks = reader.ReadText("PRE72H.PlannedWorks"); - if (pre72h.PlannedOperations.IsNullOrEmpty()) pre72h.PlannedOperations = "n"; + pre72h.PlannedWorks = reader.ReadText("PRE72H.PlannedWorks"); if (pre72h.PlannedWorks.IsNullOrEmpty()) pre72h.PlannedWorks = "n"; return true; }