DeliveryAdminWindow: Fix ModifierInput source
All checks were successful
Test / Run tests (push) Successful in 1m45s

This commit is contained in:
2024-06-11 11:49:11 +02:00
parent 81f286f504
commit 012352c562

View File

@ -1067,7 +1067,7 @@ namespace Elwig.Windows {
await RefreshDeliveryList();
var d = DeliveryList.SelectedItem as Delivery;
var y = d?.Year ?? Utils.CurrentLastSeason;
var y = d?.Year ?? SeasonInput.Value;
ControlUtils.RenewItemsSource(MemberInput, await ctx.Members
.Where(m => m.IsActive || !IsCreating)
.Include(m => m.PostalDest.AtPlz!.Ort)
@ -1084,7 +1084,11 @@ namespace Elwig.Windows {
cultList.Insert(0, new NullItem(""));
ControlUtils.RenewItemsSource(CultivationInput, cultList, null, ControlUtils.RenewSourceDefault.First);
ControlUtils.RenewItemsSource(WineQualityLevelInput, await ctx.WineQualityLevels.ToListAsync());
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers.Where(m => m.Year == y).OrderBy(m => m.Ordering).ToListAsync());
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
.Where(m => m.Year == y)
.OrderBy(m => m.Ordering)
.Include(m => m.Season.Currency)
.ToListAsync());
ControlUtils.RenewItemsSource(WineOriginInput, (await ctx.WineOrigins.ToListAsync()).OrderByDescending(o => o.SortKey).ThenBy(o => o.HkId));
var kgList = (await ctx.Katastralgemeinden
.Where(k => k.WbKg != null)
@ -1112,10 +1116,18 @@ namespace Elwig.Windows {
private async Task RefreshDeliveryParts() {
using var ctx = new AppDbContext();
if (DeliveryList.SelectedItem is Delivery d) {
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers.Where(m => m.Year == d.Year).OrderBy(m => m.Ordering).ToListAsync());
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
.Where(m => m.Year == d.Year)
.OrderBy(m => m.Ordering)
.Include(m => m.Season.Currency)
.ToListAsync());
ControlUtils.RenewItemsSource(DeliveryPartList, d.FilteredParts.OrderBy(p => p.DPNr).ToList(), DeliveryPartList_SelectionChanged, ControlUtils.RenewSourceDefault.First);
} else {
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers.Where(m => m.Year == Utils.CurrentLastSeason).OrderBy(m => m.Ordering).ToListAsync());
ControlUtils.RenewItemsSource(ModifiersInput, await ctx.Modifiers
.Where(m => m.Year == SeasonInput.Value)
.OrderBy(m => m.Ordering)
.Include(m => m.Season.Currency)
.ToListAsync());
DeliveryPartList.ItemsSource = null;
}
}