Windows: Remove SeasonFinishWindow and TestWindow

This commit is contained in:
2024-03-31 17:11:10 +02:00
parent cbc0d0ebff
commit a9f38a3ccb
11 changed files with 205 additions and 294 deletions

View File

@ -35,6 +35,7 @@ namespace Elwig.Windows {
];
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
WineAttributeFillLowerLabel.Visibility = Visibility.Hidden;
ParameterAreaComGroup.Header = ParameterAreaComGroup.Header.ToString()!.Split('(')[0] + $"({Utils.CurrentLastSeason})";
}
protected override void ShortcutNew() { }
@ -85,6 +86,10 @@ namespace Elwig.Windows {
SeasonModifierNameInput.IsReadOnly = true;
SeasonModifierRelInput.TextBox.IsReadOnly = true;
SeasonModifierAbsInput.TextBox.IsReadOnly = true;
ParameterAllowAttrIntoLowerInput.IsEnabled = false;
ParameterAvoidUnderDeliveriesInput.IsEnabled = false;
ParameterHonorGebundenInput.IsEnabled = false;
}
new protected void UnlockInputs() {
@ -131,6 +136,10 @@ namespace Elwig.Windows {
SeasonModifierNameInput.IsReadOnly = false;
SeasonModifierRelInput.TextBox.IsReadOnly = false;
SeasonModifierAbsInput.TextBox.IsReadOnly = false;
ParameterAllowAttrIntoLowerInput.IsEnabled = true;
ParameterAvoidUnderDeliveriesInput.IsEnabled = true;
ParameterHonorGebundenInput.IsEnabled = true;
}
private void Window_Loaded(object sender, RoutedEventArgs evt) {
@ -211,6 +220,7 @@ namespace Elwig.Windows {
private async Task Save() {
await UpdateClientParameters(App.Client);
await UpdateParameters(Utils.CurrentLastSeason);
using var tx = await EditContext!.Database.BeginTransactionAsync();
await BranchesSave(EditContext!);
await WineAttributesSave(EditContext!);
@ -383,5 +393,19 @@ namespace Elwig.Windows {
ClientNameFull.Text = $"{ClientNameInput.Text}{(suffix != null ? $", {suffix}," : "")} {ClientNameTypeInput.Text}";
TextBox_TextChanged(sender, evt);
}
private async Task UpdateParameters(int year) {
try {
using var ctx = new AppDbContext();
if (await ctx.Seasons.FindAsync(year) is not Season s)
return;
s.Billing_AllowAttrsIntoLower = ParameterAllowAttrIntoLowerInput.IsChecked ?? false;
s.Billing_AvoidUnderDeliveries = ParameterAvoidUnderDeliveriesInput.IsChecked ?? false;
s.Billing_HonorGebunden = ParameterHonorGebundenInput.IsChecked ?? false;
ctx.Update(s);
await ctx.SaveChangesAsync();
} catch { }
}
}
}