ControlUtils: Cleanup SelectItem() method and use accordingly

This commit is contained in:
2024-03-18 17:55:27 +01:00
parent 51e345f1fd
commit 2f3524db9d
20 changed files with 181 additions and 194 deletions

View File

@ -25,7 +25,7 @@ namespace Elwig.Windows {
.ToListAsync());
_branches = _branchList.ToDictionary(b => b.ZwstId, b => (string?)b.ZwstId);
_branchIds = _branchList.ToDictionary(b => b, b => b.ZwstId);
ControlUtils.RenewItemsSource(BranchList, _branchList, b => (b as Branch)?.ZwstId);
ControlUtils.RenewItemsSource(BranchList, _branchList);
BranchList_SelectionChanged(null, null);
}
@ -33,7 +33,7 @@ namespace Elwig.Windows {
ControlUtils.RenewItemsSource(BranchList, await ctx.Branches
.OrderBy(b => b.Name)
.Include(b => b.PostalDest!.AtPlz)
.ToListAsync(), b => (b as Branch)?.ZwstId);
.ToListAsync());
_branchList = null;
_branches = null;
_branchIds = null;
@ -85,7 +85,7 @@ namespace Elwig.Windows {
BranchIdInput.Text = branch.ZwstId;
BranchNameInput.Text = branch.Name;
BranchPlzInput.Text = branch.PostalDest?.AtPlz?.Plz.ToString() ?? "";
ControlUtils.SelectComboBoxItem(BranchOrtInput, o => (o as AT_PlzDest)?.Okz, branch.PostalDest?.AtPlz?.Okz);
ControlUtils.SelectItem(BranchOrtInput, branch.PostalDest?.AtPlz);
BranchAddressInput.Text = branch.Address;
BranchPhoneNrInput.Text = branch.PhoneNr;
BranchFaxNrInput.Text = branch.FaxNr;