Refactor and Fix PLZ/Ort in MemberListWindow
This commit is contained in:
@ -23,7 +23,7 @@ namespace WGneu
|
||||
/// </summary>
|
||||
public partial class MemberListWindow : Window
|
||||
{
|
||||
private readonly WGContext _context = new WGContext();
|
||||
private readonly WgContext _context = new WgContext();
|
||||
|
||||
public MemberListWindow()
|
||||
{
|
||||
@ -48,16 +48,36 @@ namespace WGneu
|
||||
GivenName.Text = m.GivenName;
|
||||
FamilyName.Text = m.FamilyName;
|
||||
|
||||
AT_Plz p = m.PostalDest.Plz(_context);
|
||||
Plz.Text = p.Plz.ToString();
|
||||
AT_Plz? p = m.PostalDest.Plz(_context);
|
||||
if (p != null)
|
||||
{
|
||||
Plz.Text = p.Plz.ToString();
|
||||
|
||||
var o = p.Orte(_context);
|
||||
Ort.ItemsSource = o;
|
||||
Ort.
|
||||
var o = p.Orte(_context);
|
||||
Ort.ItemsSource = o;
|
||||
Ort.SelectedItem = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ort.ItemsSource = null;
|
||||
Ort.SelectedItem = null;
|
||||
}
|
||||
|
||||
|
||||
Edit_Member.IsEnabled = true;
|
||||
}
|
||||
|
||||
private void Plz_TextChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Plz.Text.Length == 4 && Plz.Text.All(char.IsDigit))
|
||||
{
|
||||
int plz = int.Parse(Plz.Text);
|
||||
var o = _context.Postleitzahlen.Where(p => p.Plz == plz).ToHashSet();
|
||||
Ort.ItemsSource = o;
|
||||
Ort.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Edit_Member_Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Member m = (Member)MemberList.SelectedItem;
|
||||
|
Reference in New Issue
Block a user