Fixes for 7.2 pt 1

This commit is contained in:
Daniel Schick 2022-05-28 07:50:21 +02:00
parent 7a5442f2bd
commit 0533b579b2
5 changed files with 27 additions and 28 deletions

View File

@ -165,14 +165,17 @@ namespace ENI2.DetailViewControls
private void copyBKR(object sender, RoutedEventArgs e) private void copyBKR(object sender, RoutedEventArgs e)
{ {
foreach (BRKA brka in this.dataGridBKRA.Items) if (this.dataGridBKRA.SelectedItems != null)
{ {
BRKD copyBRKD = new BRKD(); foreach (BRKA brka in this.dataGridBKRA.SelectedItems)
copyBRKD.MessageHeader = this._brkdMessage; {
copyBRKD.CopyFromBKRA(brka); BRKD copyBRKD = new BRKD();
copyBRKD.Identifier = DatabaseEntity.GetNewIdentifier(this._brkdMessage.Elements); copyBRKD.MessageHeader = this._brkdMessage;
this._brkdMessage.Elements.Add(copyBRKD); copyBRKD.CopyFromBKRA(brka);
this.SublistElementChanged(Message.NotificationClass.BKRD); copyBRKD.Identifier = DatabaseEntity.GetNewIdentifier(this._brkdMessage.Elements);
this._brkdMessage.Elements.Add(copyBRKD);
this.SublistElementChanged(Message.NotificationClass.BKRD);
}
} }
} }

View File

@ -343,9 +343,8 @@ namespace ENI2.DetailViewControls
private void DataGridMARPOLItems_DeleteRequested(DatabaseEntity obj) private void DataGridMARPOLItems_DeleteRequested(DatabaseEntity obj)
{ {
MARPOL_Annex_I_Position marpol = obj as MARPOL_Annex_I_Position;
HAZ haz = this.IsDeparture ? hazd : haza; 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 // are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(marpol); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(marpol);
@ -428,8 +427,7 @@ namespace ENI2.DetailViewControls
private void DataGridIMSBCItems_DeleteRequested(DatabaseEntity obj) private void DataGridIMSBCItems_DeleteRequested(DatabaseEntity obj)
{ {
HAZ haz = this.IsDeparture ? hazd : haza; HAZ haz = this.IsDeparture ? hazd : haza;
IMSBCPosition imsbc = obj as IMSBCPosition; if (obj is IMSBCPosition imsbc)
if (imsbc != null)
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imsbc); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imsbc);
@ -511,8 +509,7 @@ namespace ENI2.DetailViewControls
private void DataGridIGCItems_DeleteRequested(DatabaseEntity obj) private void DataGridIGCItems_DeleteRequested(DatabaseEntity obj)
{ {
HAZ haz = this.IsDeparture ? hazd : haza; HAZ haz = this.IsDeparture ? hazd : haza;
IGCPosition igc = obj as IGCPosition; if (obj is IGCPosition igc)
if (igc != null)
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(igc); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(igc);
@ -593,8 +590,7 @@ namespace ENI2.DetailViewControls
private void DataGridIBCItems_DeleteRequested(DatabaseEntity obj) private void DataGridIBCItems_DeleteRequested(DatabaseEntity obj)
{ {
HAZ haz = this.IsDeparture ? hazd : haza; HAZ haz = this.IsDeparture ? hazd : haza;
IBCPosition ibc = obj as IBCPosition; if (obj is IBCPosition ibc)
if (ibc != null)
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ibc); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ibc);
@ -675,8 +671,7 @@ namespace ENI2.DetailViewControls
private void DataGridIMDGItems_DeleteRequested(DatabaseEntity obj) private void DataGridIMDGItems_DeleteRequested(DatabaseEntity obj)
{ {
HAZ haz = this.IsDeparture ? hazd : haza; HAZ haz = this.IsDeparture ? hazd : haza;
IMDGPosition imdg = obj as IMDGPosition; if (obj is IMDGPosition imdg)
if (imdg != null)
{ {
// are you sure dialog is in base class // are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imdg); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(imdg);

View File

@ -242,14 +242,17 @@ namespace ENI2.DetailViewControls
private void copyBKR(object sender, RoutedEventArgs e) private void copyBKR(object sender, RoutedEventArgs e)
{ {
foreach (BRKD brkd in this.dataGridBKRD.Items) if (this.dataGridBKRD.SelectedItems != null)
{ {
BRKA copyBRKA = new BRKA(); foreach (BRKD brkd in this.dataGridBKRD.SelectedItems)
copyBRKA.MessageHeader = this._brkaMessage; {
copyBRKA.CopyFromBKRD(brkd); BRKA copyBRKA = new BRKA();
copyBRKA.Identifier = DatabaseEntity.GetNewIdentifier(this._brkaMessage.Elements); copyBRKA.MessageHeader = this._brkaMessage;
this._brkaMessage.Elements.Add(copyBRKA); copyBRKA.CopyFromBKRD(brkd);
this.SublistElementChanged(Message.NotificationClass.BKRA); copyBRKA.Identifier = DatabaseEntity.GetNewIdentifier(this._brkaMessage.Elements);
this._brkaMessage.Elements.Add(copyBRKA);
this.SublistElementChanged(Message.NotificationClass.BKRA);
}
} }
} }

View File

@ -649,8 +649,7 @@ namespace ENI2.Excel
pre72h.PlannedOperations = reader.ReadTextFromDropdown("port state control", "C14"); pre72h.PlannedOperations = reader.ReadTextFromDropdown("port state control", "C14");
pre72h.PlannedWorks = reader.ReadCellAsText("port state control", "C15"); pre72h.PlannedWorks = reader.ReadCellAsText("port state control", "C15");
pre72h.DateOfLastExpandedInspection = reader.ReadCellAsDateTime("port state control", "C16"); pre72h.DateOfLastExpandedInspection = reader.ReadCellAsDateTime("port state control", "C16");
pre72h.PlannedPeriodOfStay_HUR = reader.ReadCellAsDecimal("port state control", "C17"); pre72h.PlannedPeriodOfStay_HUR = reader.ReadCellAsDecimal("port state control", "C17");
if (pre72h.PlannedOperations.IsNullOrEmpty()) pre72h.PlannedOperations = "n";
if (pre72h.PlannedWorks.IsNullOrEmpty()) pre72h.PlannedWorks = "n"; if (pre72h.PlannedWorks.IsNullOrEmpty()) pre72h.PlannedWorks = "n";
return true; return true;

View File

@ -1893,8 +1893,7 @@ namespace ENI2.Excel
// diese Nachricht bleibt auch wenn sie leer ist // diese Nachricht bleibt auch wenn sie leer ist
pre72h.ConditionCargoBallastTanks = reader.ReadConditionTanks("PRE72H.ConditionCargoBallastTanks"); pre72h.ConditionCargoBallastTanks = reader.ReadConditionTanks("PRE72H.ConditionCargoBallastTanks");
pre72h.TankerHullConfiguration = reader.ReadHullConfiguration("PRE72H.TankerHullConfiguration"); pre72h.TankerHullConfiguration = reader.ReadHullConfiguration("PRE72H.TankerHullConfiguration");
pre72h.PlannedWorks = reader.ReadText("PRE72H.PlannedWorks"); pre72h.PlannedWorks = reader.ReadText("PRE72H.PlannedWorks");
if (pre72h.PlannedOperations.IsNullOrEmpty()) pre72h.PlannedOperations = "n";
if (pre72h.PlannedWorks.IsNullOrEmpty()) pre72h.PlannedWorks = "n"; if (pre72h.PlannedWorks.IsNullOrEmpty()) pre72h.PlannedWorks = "n";
return true; return true;
} }