From c29a936fa2e1f2e8f07151f043914f8531732e79 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Fri, 9 Dec 2022 09:32:13 +0100 Subject: [PATCH] Neue Benutzerberechtigung 'Editor', die dazu verwendet wird, den Speichern Knopf der Templates freizuschalten (IsEnabled) --- .../PortCallDetailControl.xaml.cs | 16 +++++++++------- ENI2/EditControls/EditReportingPartyDialog.xaml | 2 ++ .../EditReportingPartyDialog.xaml.cs | 4 +++- ENI2/Properties/Resources.Designer.cs | 9 +++++++++ ENI2/Properties/Resources.resx | 3 +++ bsmd.database/ReportingParty.cs | 12 +++++++++++- 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs index 69190627..1d646158 100644 --- a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs @@ -67,6 +67,8 @@ namespace ENI2.DetailViewControls this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT); + + this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor; } public override void Initialize() @@ -308,21 +310,21 @@ namespace ENI2.DetailViewControls { if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No) return; - } - + } + this._currentTemplate = createFromCurrentText(title, existingTemplate); - DBManager.Instance.Save(this._currentTemplate); - + DBManager.Instance.Save(this._currentTemplate); + if(existingTemplate == null) { comboBox_AgentTemplate.ItemsSource = null; _agntTemplates.Add(this._currentTemplate); _agntTemplates.Sort(); comboBox_AgentTemplate.ItemsSource = _agntTemplates; - } + } MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information); - } + } private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e) { @@ -349,7 +351,7 @@ namespace ENI2.DetailViewControls this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo - } + } private void buttonSetTemplate_Click(object sender, RoutedEventArgs e) { diff --git a/ENI2/EditControls/EditReportingPartyDialog.xaml b/ENI2/EditControls/EditReportingPartyDialog.xaml index 8944d277..2867e0b2 100644 --- a/ENI2/EditControls/EditReportingPartyDialog.xaml +++ b/ENI2/EditControls/EditReportingPartyDialog.xaml @@ -48,6 +48,7 @@