diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index ed6e4407..c1bdc90f 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -218,6 +218,7 @@ namespace ENI2.DetailViewControls this.hazd.MARPOLPositions.Add(copyMARPOL); this.SublistElementChanged(Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); + this.SetHAZGlobalFlags(this.hazd); } } } @@ -237,6 +238,7 @@ namespace ENI2.DetailViewControls this.hazd.IMSBCPositions.Add(copyIMSBC); this.SublistElementChanged(Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); + this.SetHAZGlobalFlags(this.hazd); } } } @@ -256,6 +258,7 @@ namespace ENI2.DetailViewControls this.hazd.IMDGPositions.Add(copyIMDG); this.SublistElementChanged(Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); + this.SetHAZGlobalFlags(this.hazd); } } } @@ -275,6 +278,7 @@ namespace ENI2.DetailViewControls this.hazd.IGCPositions.Add(copyIGC); this.SublistElementChanged(Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); + this.SetHAZGlobalFlags(this.hazd); } } } @@ -296,6 +300,7 @@ namespace ENI2.DetailViewControls this.hazd.IBCPositions.Add(copyIBC); this.SublistElementChanged(Message.NotificationClass.HAZD); this.OnControlCacheReset(Properties.Resources.textDGDeparture); + this.SetHAZGlobalFlags(this.hazd); } } } @@ -306,14 +311,23 @@ namespace ENI2.DetailViewControls /// /// Beim Hinzufügen der allerersten Gefahrgutposition sollen die Flags vorbelegt werden /// - void SetHAZGlobalFlags() + void SetHAZGlobalFlags(HAZ theHAZ) { - int totalCount = this.haz.MARPOLPositions.Count + this.haz.IMDGPositions.Count + this.haz.IGCPositions.Count + this.haz.IBCPositions.Count + this.haz.IMSBCPositions.Count; + int totalCount = theHAZ.MARPOLPositions.Count + theHAZ.IMDGPositions.Count + theHAZ.IGCPositions.Count + theHAZ.IBCPositions.Count + theHAZ.IMSBCPositions.Count; if(totalCount == 1) { - if (!(this.checkBoxDangerousGoodsOnBoard.IsChecked ?? false)) this.checkBoxDangerousGoodsOnBoard.IsChecked = true; - if(!(this.checkBoxDGManifestOnBoard.IsChecked ?? false)) this.checkBoxDGManifestOnBoard.IsChecked = true; - if (this.checkBoxMoUBaltic.IsChecked ?? true) this.checkBoxMoUBaltic.IsChecked = false; + if (theHAZ == this.haz) + { + if (!(this.checkBoxDangerousGoodsOnBoard.IsChecked ?? false)) this.checkBoxDangerousGoodsOnBoard.IsChecked = true; + if (!(this.checkBoxDGManifestOnBoard.IsChecked ?? false)) this.checkBoxDGManifestOnBoard.IsChecked = true; + if (this.checkBoxMoUBaltic.IsChecked ?? true) this.checkBoxMoUBaltic.IsChecked = false; + } + else + { + theHAZ.NoDPGOnBoardOnArrival = false; + theHAZ.DPGManifestOnBoardOnArrival = true; + theHAZ.MOUBaltic = false; + } } } @@ -348,7 +362,7 @@ namespace ENI2.DetailViewControls eld.Identifier = DatabaseEntity.GetNewIdentifier(haz.MARPOLPositions, "MARPOL-"); eld.MARPOL.HAZ = this.haz; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); }; if (eld.ShowDialog() ?? false) @@ -383,7 +397,7 @@ namespace ENI2.DetailViewControls ebd.MARPOL.HAZ = this.haz; ebd.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.MARPOLPositions, "MARPOL-"); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); }; if (ebd.ShowDialog() ?? false) @@ -392,7 +406,7 @@ namespace ENI2.DetailViewControls haz.MARPOLPositions.Add(ebd.MARPOL); this.dataGridMARPOLItems.Items.Refresh(); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); } } @@ -429,7 +443,7 @@ namespace ENI2.DetailViewControls eld.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions, "IMSBC-"); eld.IMSBC.HAZ = this.haz; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); }; if (eld.ShowDialog() ?? false) @@ -463,7 +477,7 @@ namespace ENI2.DetailViewControls ebd.IMSBC.HAZ = this.haz; ebd.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IMSBCPositions, "IMSBC-"); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); }; if (ebd.ShowDialog() ?? false) @@ -472,7 +486,7 @@ namespace ENI2.DetailViewControls haz.IMSBCPositions.Add(ebd.IMSBC); this.dataGridIMSBCItems.Items.Refresh(); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); } } @@ -509,7 +523,7 @@ namespace ENI2.DetailViewControls eld.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IGCPositions, "IGC-"); eld.IGC.HAZ = this.haz; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); }; if (eld.ShowDialog() ?? false) @@ -551,7 +565,7 @@ namespace ENI2.DetailViewControls haz.IGCPositions.Add(ebd.IGC); this.dataGridIGCItems.Items.Refresh(); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); } } @@ -588,7 +602,7 @@ namespace ENI2.DetailViewControls eld.Identifier = DatabaseEntity.GetNewIdentifier(this.haz.IBCPositions, "IBC-"); eld.IBC.HAZ = this.haz; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); }; if (eld.ShowDialog() ?? false) @@ -630,7 +644,7 @@ namespace ENI2.DetailViewControls haz.IBCPositions.Add(ebd.IBC); this.dataGridIBCItems.Items.Refresh(); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); } } @@ -675,7 +689,7 @@ namespace ENI2.DetailViewControls haz.IMDGPositions.Add(eld.IMDG); this.dataGridIMDGItems.Items.Refresh(); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); } } @@ -709,7 +723,7 @@ namespace ENI2.DetailViewControls haz.IMDGPositions.Add(ebd.IMDG); this.dataGridIMDGItems.Items.Refresh(); this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); - this.SetHAZGlobalFlags(); + this.SetHAZGlobalFlags(this.haz); } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml index 91421d0f..ccb12adc 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml @@ -79,7 +79,7 @@