PaymentVariantsWindow: Select last variant by default and ask user before deleting
All checks were successful
Test / Run tests (push) Successful in 2m33s
All checks were successful
Test / Run tests (push) Successful in 2m33s
This commit is contained in:
@@ -55,6 +55,9 @@ namespace Elwig.Windows {
|
|||||||
.OrderBy(v => v.AvNr)
|
.OrderBy(v => v.AvNr)
|
||||||
.Include(v => v.Season.Currency)
|
.Include(v => v.Season.Currency)
|
||||||
.ToListAsync());
|
.ToListAsync());
|
||||||
|
if (PaymentVariantList.SelectedItem == null && PaymentVariantList.Items.Count > 0) {
|
||||||
|
PaymentVariantList.SelectedIndex = PaymentVariantList.Items.Count - 1;
|
||||||
|
}
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +122,11 @@ namespace Elwig.Windows {
|
|||||||
private async void DeleteButton_Click(object sender, RoutedEventArgs evt) {
|
private async void DeleteButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
if (PaymentVariantList.SelectedItem is not PaymentVar v || !v.TestVariant)
|
if (PaymentVariantList.SelectedItem is not PaymentVar v || !v.TestVariant)
|
||||||
return;
|
return;
|
||||||
|
var res = MessageBox.Show(
|
||||||
|
$"Soll die Auszahlungsvariante \"{v.Name}\" wirklich unwiderruflich gelöscht werden?",
|
||||||
|
"Auszahlungsvariante löschen", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel);
|
||||||
|
if (res != MessageBoxResult.OK)
|
||||||
|
return;
|
||||||
Mouse.OverrideCursor = Cursors.Wait;
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
try {
|
try {
|
||||||
await PaymentVariantService.DeletePaymentVariant(v.Year, v.AvNr);
|
await PaymentVariantService.DeletePaymentVariant(v.Year, v.AvNr);
|
||||||
|
|||||||
Reference in New Issue
Block a user