MemberAdminWIndow: add status bar

This commit is contained in:
2023-10-05 01:43:44 +02:00
parent 1625f15f92
commit 9e9195b9c0
2 changed files with 52 additions and 8 deletions

View File

@@ -140,6 +140,8 @@ namespace Elwig.Windows {
ControlUtils.RenewItemsSource(BranchInput, await Context.Branches.OrderBy(b => b.Name).ToListAsync(), i => (i as Branch)?.ZwstId);
ControlUtils.RenewItemsSource(DefaultKgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
await RefreshMemberList();
StatusMembers.Text = $"Mitglieder: {await Context.Members.CountAsync(m => m.IsActive):N0} ({await Context.Members.CountAsync():N0})";
StatusBusinessShares.Text = $"Geschäftsanteile: {await Context.Members.SumAsync(m => m.BusinessShares):N0}";
}
private void SetPhoneNrInput(int nr, string? type, string? number, string? comment) {
@@ -592,7 +594,11 @@ namespace Elwig.Windows {
ContactPostalInput.IsChecked = m.ContactViaPost;
ContactEmailInput.IsChecked = m.ContactViaEmail;
AreaCommitment.Text = $"{m.ActiveAreaCommitments.Select(c => c.Area).Sum():N0} m²";
var d1 = Context.Deliveries.Where(d => d.Year == Utils.CurrentLastSeason && d.MgNr == m.MgNr);
var d2 = Context.Deliveries.Where(d => d.Year == Utils.CurrentLastSeason - 1 && d.MgNr == m.MgNr);
StatusDeliveriesLastSeason.Text = $"Lieferungen ({Utils.CurrentLastSeason - 1}): {d2.Count():N0} ({d2.Sum(d => d.Parts.Count):N0}), {d2.SelectMany(d => d.Parts).Sum(p => p.Weight):N0} kg";
StatusDeliveriesThisSeason.Text = $"Lieferungen ({Utils.CurrentLastSeason}): {d1.Count():N0} ({d1.Sum(d => d.Parts.Count):N0}), {d1.SelectMany(d => d.Parts).Sum(p => p.Weight):N0} kg";
StatusAreaCommitment.Text = $"Gebundene Fläche: {m.ActiveAreaCommitments.Select(c => c.Area).Sum():N0} m²";
Menu_Member_SendEmail.IsEnabled = m.EmailAddresses.Count > 0;
@@ -601,7 +607,9 @@ namespace Elwig.Windows {
new protected void ClearInputs(bool validate = false) {
Menu_Member_SendEmail.IsEnabled = false;
AreaCommitment.Text = "- m²";
StatusDeliveriesLastSeason.Text = $"Lieferungen ({Utils.CurrentLastSeason - 1}): -";
StatusDeliveriesThisSeason.Text = $"Lieferungen ({Utils.CurrentLastSeason}): -";
StatusAreaCommitment.Text = "Gebundene Fläche: -";
Age.Text = "-";
base.ClearInputs(validate);
}