BaseDataWindow: Fix data renewal
This commit is contained in:
@ -31,7 +31,11 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task AreaCommitmentTypesFinishEditing(AppDbContext ctx) {
|
private async Task AreaCommitmentTypesFinishEditing(AppDbContext ctx) {
|
||||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, await ctx.AreaCommitmentTypes.OrderBy(v => v.SortId).ToListAsync());
|
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, await ctx.AreaCommitmentTypes
|
||||||
|
.OrderBy(v => v.VtrgId)
|
||||||
|
.Include(t => t.WineVar)
|
||||||
|
.Include(t => t.WineAttr)
|
||||||
|
.ToListAsync());
|
||||||
_actList = null;
|
_actList = null;
|
||||||
_acts = null;
|
_acts = null;
|
||||||
_actIds = null;
|
_actIds = null;
|
||||||
|
@ -22,7 +22,10 @@ namespace Elwig.Windows {
|
|||||||
private async Task ModifiersInitEditing(AppDbContext ctx) {
|
private async Task ModifiersInitEditing(AppDbContext ctx) {
|
||||||
SeasonList.IsEnabled = false;
|
SeasonList.IsEnabled = false;
|
||||||
var year = (SeasonList.SelectedItem as Season)?.Year;
|
var year = (SeasonList.SelectedItem as Season)?.Year;
|
||||||
_modList = new(await ctx.Modifiers.Where(m => m.Year == year).OrderBy(m => m.Ordering).ToListAsync());
|
_modList = new(await ctx.Modifiers
|
||||||
|
.Where(m => m.Year == year)
|
||||||
|
.OrderBy(m => m.Ordering)
|
||||||
|
.ToListAsync());
|
||||||
_mods = _modList.ToDictionary(m => m.ModId, m => (string?)m.ModId);
|
_mods = _modList.ToDictionary(m => m.ModId, m => (string?)m.ModId);
|
||||||
_modIds = _modList.ToDictionary(m => m, m => m.ModId);
|
_modIds = _modList.ToDictionary(m => m, m => m.ModId);
|
||||||
ControlUtils.RenewItemsSource(SeasonModifierList, _modList);
|
ControlUtils.RenewItemsSource(SeasonModifierList, _modList);
|
||||||
@ -31,7 +34,10 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private async Task ModifiersFinishEditing(AppDbContext ctx) {
|
private async Task ModifiersFinishEditing(AppDbContext ctx) {
|
||||||
var year = (SeasonList.SelectedItem as Season)?.Year;
|
var year = (SeasonList.SelectedItem as Season)?.Year;
|
||||||
ControlUtils.RenewItemsSource(SeasonModifierList, await ctx.Modifiers.Where(m => m.Year == year).OrderBy(m => m.Ordering).ToListAsync());
|
ControlUtils.RenewItemsSource(SeasonModifierList, await ctx.Modifiers
|
||||||
|
.Where(m => m.Year == year)
|
||||||
|
.OrderBy(m => m.Ordering)
|
||||||
|
.ToListAsync());
|
||||||
_modList = null;
|
_modList = null;
|
||||||
_mods = null;
|
_mods = null;
|
||||||
_modIds = null;
|
_modIds = null;
|
||||||
|
@ -13,12 +13,18 @@ namespace Elwig.Windows {
|
|||||||
private bool _seasonUpdate = false;
|
private bool _seasonUpdate = false;
|
||||||
|
|
||||||
private async Task SeasonsInitEditing(AppDbContext ctx) {
|
private async Task SeasonsInitEditing(AppDbContext ctx) {
|
||||||
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons.Include(s => s.Modifiers).OrderByDescending(s => s.Year).ToListAsync());
|
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
||||||
|
.OrderByDescending(s => s.Year)
|
||||||
|
.Include(s => s.Modifiers)
|
||||||
|
.ToListAsync());
|
||||||
SeasonList_SelectionChanged(null, null);
|
SeasonList_SelectionChanged(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SeasonsFinishEditing(AppDbContext ctx) {
|
private async Task SeasonsFinishEditing(AppDbContext ctx) {
|
||||||
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons.Include(s => s.Modifiers).OrderByDescending(s => s.Year).ToListAsync());
|
ControlUtils.RenewItemsSource(SeasonList, await ctx.Seasons
|
||||||
|
.OrderByDescending(s => s.Year)
|
||||||
|
.Include(s => s.Modifiers)
|
||||||
|
.ToListAsync());
|
||||||
_seasonChanged = false;
|
_seasonChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,9 @@ namespace Elwig.Windows {
|
|||||||
private bool _attrUpdate = false;
|
private bool _attrUpdate = false;
|
||||||
|
|
||||||
private async Task WineAttributesInitEditing(AppDbContext ctx) {
|
private async Task WineAttributesInitEditing(AppDbContext ctx) {
|
||||||
_attrList = new(await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync());
|
_attrList = new(await ctx.WineAttributes
|
||||||
|
.OrderBy(a => a.Name)
|
||||||
|
.ToListAsync());
|
||||||
_attrs = _attrList.ToDictionary(a => a.AttrId, a => (string?)a.AttrId);
|
_attrs = _attrList.ToDictionary(a => a.AttrId, a => (string?)a.AttrId);
|
||||||
_attrIds = _attrList.ToDictionary(a => a, a => a.AttrId);
|
_attrIds = _attrList.ToDictionary(a => a, a => a.AttrId);
|
||||||
ControlUtils.RenewItemsSource(WineAttributeList, _attrList);
|
ControlUtils.RenewItemsSource(WineAttributeList, _attrList);
|
||||||
@ -27,7 +29,9 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task WineAttributesFinishEditing(AppDbContext ctx) {
|
private async Task WineAttributesFinishEditing(AppDbContext ctx) {
|
||||||
ControlUtils.RenewItemsSource(WineAttributeList, await ctx.WineAttributes.OrderBy(a => a.Name).ToListAsync());
|
ControlUtils.RenewItemsSource(WineAttributeList, await ctx.WineAttributes
|
||||||
|
.OrderBy(a => a.Name)
|
||||||
|
.ToListAsync());
|
||||||
_attrList = null;
|
_attrList = null;
|
||||||
_attrs = null;
|
_attrs = null;
|
||||||
_attrIds = null;
|
_attrIds = null;
|
||||||
|
@ -19,7 +19,9 @@ namespace Elwig.Windows {
|
|||||||
private bool _cultUpdate = false;
|
private bool _cultUpdate = false;
|
||||||
|
|
||||||
private async Task WineCultivationsInitEditing(AppDbContext ctx) {
|
private async Task WineCultivationsInitEditing(AppDbContext ctx) {
|
||||||
_cultList = new(await ctx.WineCultivations.OrderBy(c => c.Name).ToListAsync());
|
_cultList = new(await ctx.WineCultivations
|
||||||
|
.OrderBy(c => c.Name)
|
||||||
|
.ToListAsync());
|
||||||
_cults = _cultList.ToDictionary(c => c.CultId, c => (string?)c.CultId);
|
_cults = _cultList.ToDictionary(c => c.CultId, c => (string?)c.CultId);
|
||||||
_cultIds = _cultList.ToDictionary(c => c, c => c.CultId);
|
_cultIds = _cultList.ToDictionary(c => c, c => c.CultId);
|
||||||
ControlUtils.RenewItemsSource(WineCultivationList, _cultList);
|
ControlUtils.RenewItemsSource(WineCultivationList, _cultList);
|
||||||
@ -27,7 +29,9 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task WineCultivationsFinishEditing(AppDbContext ctx) {
|
private async Task WineCultivationsFinishEditing(AppDbContext ctx) {
|
||||||
ControlUtils.RenewItemsSource(WineCultivationList, await ctx.WineCultivations.OrderBy(c => c.Name).ToListAsync());
|
ControlUtils.RenewItemsSource(WineCultivationList, await ctx.WineCultivations
|
||||||
|
.OrderBy(c => c.Name)
|
||||||
|
.ToListAsync());
|
||||||
_cultList = null;
|
_cultList = null;
|
||||||
_cults = null;
|
_cults = null;
|
||||||
_cultIds = null;
|
_cultIds = null;
|
||||||
|
Reference in New Issue
Block a user