ControlUtils: Cleanup SelectItem() method and use accordingly
This commit is contained in:
@ -26,12 +26,12 @@ namespace Elwig.Windows {
|
||||
.ToListAsync());
|
||||
_acts = _actList.ToDictionary(v => v.VtrgId, v => (string?)v.VtrgId);
|
||||
_actIds = _actList.ToDictionary(v => v, v => v.VtrgId);
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, _actList, a => (a as AreaComType)?.VtrgId);
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, _actList);
|
||||
AreaCommitmentTypeList_SelectionChanged(null, null);
|
||||
}
|
||||
|
||||
private async Task AreaCommitmentTypesFinishEditing(AppDbContext ctx) {
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, await ctx.AreaCommitmentTypes.OrderBy(v => v.SortId).ToListAsync(), v => (v as AreaComType)?.VtrgId);
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, await ctx.AreaCommitmentTypes.OrderBy(v => v.SortId).ToListAsync());
|
||||
_actList = null;
|
||||
_acts = null;
|
||||
_actIds = null;
|
||||
@ -73,8 +73,8 @@ namespace Elwig.Windows {
|
||||
_actUpdate = true;
|
||||
if (AreaCommitmentTypeList.SelectedItem is AreaComType type) {
|
||||
AreaCommitmentTypeIdInput.Text = $"{type.SortId}{type.AttrId}";
|
||||
ControlUtils.SelectComboBoxItem(AreaCommitmentTypeWineVariantInput, s => (s as WineVar)?.SortId, type.SortId);
|
||||
ControlUtils.SelectComboBoxItem(AreaCommitmentTypeWineAttributeInput, a => (a as WineAttr)?.AttrId, type.AttrId);
|
||||
ControlUtils.SelectItemWithPk(AreaCommitmentTypeWineVariantInput, type.SortId);
|
||||
ControlUtils.SelectItemWithPk(AreaCommitmentTypeWineAttributeInput, type.AttrId);
|
||||
AreaCommitmentTypeMinKgPerHaInput.Text = $"{type.MinKgPerHa}";
|
||||
AreaCommitmentTypePenaltyPerKgInput.Text = $"{type.PenaltyPerKg}";
|
||||
AreaCommitmentTypePenaltyInput.Text = $"{type.PenaltyAmount}";
|
||||
|
Reference in New Issue
Block a user