From 0c9b38ddd90d15b3b8de945ef034486566533e4d Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sat, 26 Jul 2025 10:58:39 +0200 Subject: [PATCH] Add a confirmation dialog if the waste service disposal provider field is not empty when the template is applied --- ENI2/DetailViewControls/PortCallDetailControl.xaml.cs | 7 +++++++ ENI2/Properties/Resources.Designer.cs | 9 +++++++++ ENI2/Properties/Resources.resx | 3 +++ ENI2/SheetDisplayControls/PortControl.xaml.cs | 7 +++++++ 4 files changed, 26 insertions(+) diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs index e59ea133..aaf976c8 100644 --- a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs @@ -361,6 +361,13 @@ namespace ENI2.DetailViewControls { if (this._currentTemplate == null) return; + // confirm overwrite of waste disposal service provider + if (this.textBox_WasteDisposalServiceProvider.Text.Length > 0) + { + if (MessageBox.Show(Properties.Resources.textConfirmWSDPOverwrite, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) + == MessageBoxResult.No) { return; } + } + this._undoTemplate = createFromCurrentText(null, null); this.textBox_AgentCity.Text = this._currentTemplate.AgentCity; diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs index cfca18fc..c499c4c4 100644 --- a/ENI2/Properties/Resources.Designer.cs +++ b/ENI2/Properties/Resources.Designer.cs @@ -2173,6 +2173,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to The existing value for the waste disposal service provider will be overwritten. Proceed?. + /// + public static string textConfirmWSDPOverwrite { + get { + return ResourceManager.GetString("textConfirmWSDPOverwrite", resourceCulture); + } + } + /// /// Looks up a localized string similar to Construction characteristics. /// diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx index bdca0024..81f42998 100644 --- a/ENI2/Properties/Resources.resx +++ b/ENI2/Properties/Resources.resx @@ -2257,4 +2257,7 @@ NSW-Status + + The existing value for the waste disposal service provider will be overwritten. Proceed? + \ No newline at end of file diff --git a/ENI2/SheetDisplayControls/PortControl.xaml.cs b/ENI2/SheetDisplayControls/PortControl.xaml.cs index 4c0680c3..e8b70e4c 100644 --- a/ENI2/SheetDisplayControls/PortControl.xaml.cs +++ b/ENI2/SheetDisplayControls/PortControl.xaml.cs @@ -339,6 +339,13 @@ namespace ENI2.SheetDisplayControls { if (this._currentTemplate == null) return; + // confirm overwrite of waste disposal service provider + if (this.textBox_WasteDisposalServiceProvider.Text.Length > 0) + { + if (MessageBox.Show(Properties.Resources.textConfirmWSDPOverwrite, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) + == MessageBoxResult.No) { return; } + } + this._undoTemplate = createFromCurrentText(null, null); this.textBox_AgentCity.Text = this._currentTemplate.AgentCity;