Neue Benutzerberechtigung 'Editor', die dazu verwendet wird, den Speichern Knopf der Templates freizuschalten (IsEnabled)
This commit is contained in:
parent
bd93f98460
commit
c29a936fa2
@ -67,6 +67,8 @@ namespace ENI2.DetailViewControls
|
|||||||
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
|
||||||
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
|
||||||
this.RegisterTextboxChange(this.textBox_AgentCountry, 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()
|
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)
|
if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._currentTemplate = createFromCurrentText(title, existingTemplate);
|
this._currentTemplate = createFromCurrentText(title, existingTemplate);
|
||||||
DBManager.Instance.Save(this._currentTemplate);
|
DBManager.Instance.Save(this._currentTemplate);
|
||||||
|
|
||||||
if(existingTemplate == null)
|
if(existingTemplate == null)
|
||||||
{
|
{
|
||||||
comboBox_AgentTemplate.ItemsSource = null;
|
comboBox_AgentTemplate.ItemsSource = null;
|
||||||
_agntTemplates.Add(this._currentTemplate);
|
_agntTemplates.Add(this._currentTemplate);
|
||||||
_agntTemplates.Sort();
|
_agntTemplates.Sort();
|
||||||
comboBox_AgentTemplate.ItemsSource = _agntTemplates;
|
comboBox_AgentTemplate.ItemsSource = _agntTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
|
private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -349,7 +351,7 @@ namespace ENI2.DetailViewControls
|
|||||||
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
|
|
||||||
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
|
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
|
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -48,6 +48,7 @@
|
|||||||
<Label Name="labelArchived" Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textArchived}" HorizontalContentAlignment="Right" />
|
<Label Name="labelArchived" Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textArchived}" HorizontalContentAlignment="Right" />
|
||||||
<Label Name="labelCreated" Grid.Row="9" Grid.Column="0" Content="{x:Static p:Resources.textCreated}" HorizontalContentAlignment="Right" />
|
<Label Name="labelCreated" Grid.Row="9" Grid.Column="0" Content="{x:Static p:Resources.textCreated}" HorizontalContentAlignment="Right" />
|
||||||
<Label Name="labelChanged" Grid.Row="9" Grid.Column="2" Content="{x:Static p:Resources.textChanged}" HorizontalContentAlignment="Right" />
|
<Label Name="labelChanged" Grid.Row="9" Grid.Column="2" Content="{x:Static p:Resources.textChanged}" HorizontalContentAlignment="Right" />
|
||||||
|
<Label Name="labelEditor" Grid.Row="8" Grid.Column="2" Content="{x:Static p:Resources.textEditor}" HorizontalContentAlignment="Right" />
|
||||||
|
|
||||||
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxName" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
|
<TextBox Grid.Row="0" Grid.Column="1" Width="auto" Name="textBoxName" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
|
||||||
<TextBox Grid.Row="0" Grid.Column="3" Width="auto" Name="textBoxEMail" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
|
<TextBox Grid.Row="0" Grid.Column="3" Width="auto" Name="textBoxEMail" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
|
||||||
@ -64,6 +65,7 @@
|
|||||||
<PasswordBox Grid.Row="6" Grid.Column="3" Width="auto" Name="passwordBoxPassword" Margin="2" VerticalContentAlignment="Center" />
|
<PasswordBox Grid.Row="6" Grid.Column="3" Width="auto" Name="passwordBoxPassword" Margin="2" VerticalContentAlignment="Center" />
|
||||||
<TextBox Grid.Row="7" Grid.Column="1" Width="auto" Name="textBoxUserEMail" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
|
<TextBox Grid.Row="7" Grid.Column="1" Width="auto" Name="textBoxUserEMail" Margin="2" MaxLength="100" VerticalContentAlignment="Center" />
|
||||||
<CheckBox Grid.Row="7" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxAdministrator" Margin="2" />
|
<CheckBox Grid.Row="7" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxAdministrator" Margin="2" />
|
||||||
|
<CheckBox Grid.Row="8" Grid.Column="3" VerticalAlignment="Center" Name="checkBoxEditor" Margin="2" />
|
||||||
<CheckBox Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxArchived" Margin="2" />
|
<CheckBox Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" Name="checkBoxArchived" Margin="2" />
|
||||||
|
|
||||||
<Label Grid.Row="9" Grid.Column="1" Name="dateTimePickerCreated" FontStyle="Italic" />
|
<Label Grid.Row="9" Grid.Column="1" Name="dateTimePickerCreated" FontStyle="Italic" />
|
||||||
|
|||||||
@ -39,6 +39,7 @@ namespace ENI2.EditControls
|
|||||||
|
|
||||||
this.checkBoxAdministrator.IsChecked = this.ReportingParty.IsAdmin;
|
this.checkBoxAdministrator.IsChecked = this.ReportingParty.IsAdmin;
|
||||||
this.checkBoxArchived.IsChecked = this.ReportingParty.IsArchived;
|
this.checkBoxArchived.IsChecked = this.ReportingParty.IsArchived;
|
||||||
|
this.checkBoxEditor.IsChecked = this.ReportingParty.IsEditor;
|
||||||
|
|
||||||
this.dateTimePickerChanged.Content = this.ReportingParty.Changed.HasValue ? this.ReportingParty.Changed.ToString() : "";
|
this.dateTimePickerChanged.Content = this.ReportingParty.Changed.HasValue ? this.ReportingParty.Changed.ToString() : "";
|
||||||
this.dateTimePickerCreated.Content = this.ReportingParty.Created.HasValue ? this.ReportingParty.Created.ToString() : "";
|
this.dateTimePickerCreated.Content = this.ReportingParty.Created.HasValue ? this.ReportingParty.Created.ToString() : "";
|
||||||
@ -67,8 +68,9 @@ namespace ENI2.EditControls
|
|||||||
this.ReportingParty.SetPassword(this.passwordBoxPassword.Password);
|
this.ReportingParty.SetPassword(this.passwordBoxPassword.Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ReportingParty.IsAdmin = this.checkBoxAdministrator.IsChecked ?? false;
|
this.ReportingParty.IsAdmin = this.checkBoxAdministrator.IsChecked ?? false;
|
||||||
this.ReportingParty.IsArchived = this.checkBoxArchived.IsChecked ?? false;
|
this.ReportingParty.IsArchived = this.checkBoxArchived.IsChecked ?? false;
|
||||||
|
this.ReportingParty.IsEditor = this.checkBoxEditor.IsChecked ?? false;
|
||||||
|
|
||||||
// save value
|
// save value
|
||||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.ReportingParty);
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.ReportingParty);
|
||||||
|
|||||||
9
ENI2/Properties/Resources.Designer.cs
generated
9
ENI2/Properties/Resources.Designer.cs
generated
@ -2040,6 +2040,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Editor.
|
||||||
|
/// </summary>
|
||||||
|
public static string textEditor {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textEditor", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Edit rules.
|
/// Looks up a localized string similar to Edit rules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1852,4 +1852,7 @@
|
|||||||
<data name="textNewDGItem" xml:space="preserve">
|
<data name="textNewDGItem" xml:space="preserve">
|
||||||
<value>New dangerous goods item</value>
|
<value>New dangerous goods item</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textEditor" xml:space="preserve">
|
||||||
|
<value>Editor</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -42,7 +42,11 @@ namespace bsmd.database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// System-User (Testing, Tool)
|
/// System-User (Testing, Tool)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SYSTEM = 4
|
SYSTEM = 4,
|
||||||
|
/// <summary>
|
||||||
|
/// kann bestimmte Dinge (e.g. templates) im ENI bearbeiten
|
||||||
|
/// </summary>
|
||||||
|
EDITOR = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -156,6 +160,12 @@ namespace bsmd.database
|
|||||||
set { this.SetUserFlag(value, UserFlags.ADMIN); }
|
set { this.SetUserFlag(value, UserFlags.ADMIN); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsEditor
|
||||||
|
{
|
||||||
|
get { return (this.Flags & (int)UserFlags.EDITOR) != 0; }
|
||||||
|
set { this.SetUserFlag(value, UserFlags.EDITOR); }
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user