ChartWindow: Automatically calculate variant when saved

This commit is contained in:
2025-07-03 11:48:03 +02:00
parent 913129f155
commit c6c8fd9b68
2 changed files with 7 additions and 1 deletions

View File

@ -101,7 +101,7 @@
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<Button x:Name="SaveButton" Content="Speichern" IsEnabled="False" <Button x:Name="SaveButton" Content="Speichern &amp; Berechnen" IsEnabled="False"
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10,5,35,10" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10,5,35,10" Grid.Column="0" Grid.Row="2"
Click="SaveButton_Click"/> Click="SaveButton_Click"/>

View File

@ -651,6 +651,12 @@ namespace Elwig.Windows {
ctx.Update(PaymentVar); ctx.Update(PaymentVar);
await ctx.SaveChangesAsync(); await ctx.SaveChangesAsync();
} }
try {
var b = new BillingVariant(PaymentVar.Year, PaymentVar.AvNr);
await b.Calculate();
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Berechnungsfehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
LockContext = false; LockContext = false;
App.HintContextChange(); App.HintContextChange();
} catch (Exception exc) { } catch (Exception exc) {