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)
{
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);
}
}
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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;
}