[#36] MemberAdminWindow: Add MemberList

This commit is contained in:
2024-03-26 12:53:31 +01:00
parent 5795c5e8ba
commit f4ef75ac40
10 changed files with 341 additions and 31 deletions

View File

@ -24,6 +24,8 @@ using System.Collections;
using Elwig.Documents;
using MimeKit;
using System.Windows.Input;
using LinqKit;
using System.Linq.Expressions;
namespace Elwig.Helpers {
public static partial class Utils {
@ -489,14 +491,16 @@ namespace Elwig.Helpers {
}
}
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments() => ActiveAreaCommitments(CurrentYear);
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments(int yearTo) =>
c => (c.YearFrom <= yearTo) && (c.YearTo == null || c.YearTo >= yearTo);
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query, int yearTo) {
return query.Where(c => (c.YearFrom <= CurrentYear) && (c.YearTo == null || c.YearTo >= yearTo));
}
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query, int yearTo) =>
query.Where(ActiveAreaCommitments(yearTo));
public static IEnumerable<AreaCom> ActiveAreaCommitments(IEnumerable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
public static IEnumerable<AreaCom> ActiveAreaCommitments(IEnumerable<AreaCom> query, int yearTo) {
return query.Where(c => (c.YearFrom <= CurrentYear) && (c.YearTo == null || c.YearTo >= yearTo));
}
public static IEnumerable<AreaCom> ActiveAreaCommitments(IEnumerable<AreaCom> query, int yearTo) =>
query.Where(c => ActiveAreaCommitments(yearTo).Invoke(c));
}
}