Add age to member admin window

This commit is contained in:
2023-04-28 16:03:05 +02:00
parent 4b52af6fe9
commit 735f16731e
3 changed files with 18 additions and 0 deletions

View File

@ -347,6 +347,13 @@ namespace Elwig.Windows {
FamilyNameInput.Text = m.FamilyName;
SuffixInput.Text = m.Suffix;
BirthdayInput.Text = (m.Birthday != null) ? string.Join(".", m.Birthday.Split("-").Reverse()) : null;
if (m.Birthday?.Length == 10) {
Age.Text = Utils.GetAge(DateOnly.ParseExact(m.Birthday, "yyyy-MM-dd")).ToString();
} else if (m.Birthday != null) {
Age.Text = "ca. " + (DateTime.Now.Year - int.Parse(m.Birthday[^4..])).ToString();
} else {
Age.Text = "-";
}
AddressInput.Text = m.Address;
AT_PlzDest? p = m.PostalDest.AtPlz;
if (p != null) {
@ -412,6 +419,7 @@ namespace Elwig.Windows {
new protected void ClearInputs() {
Menu_Member_SendEmail.IsEnabled = false;
AreaCommitment.Text = "- m²";
Age.Text = "-";
base.ClearInputs();
}