MemberListData: Include contact information like phone numbers and email addresses
All checks were successful
Test / Run tests (push) Successful in 2m25s
All checks were successful
Test / Run tests (push) Successful in 2m25s
This commit is contained in:
@ -34,7 +34,11 @@ namespace Elwig.Models.Dtos {
|
||||
("UstIdNr", "UID", null, 25),
|
||||
("Iban", "IBAN", null, 45),
|
||||
("Bic", "BIC", null, 30),
|
||||
("Comment", "Anmerkung", null, 60),
|
||||
("TelNrLandline", "Festnetz", null, 35),
|
||||
("TelNrMobile", "Mobil", null, 35),
|
||||
("EmailAddress", "E-Mail", null, 70),
|
||||
("AdditionalContact", "Weitere", null, 70),
|
||||
("Comment", "Anmerkung", null, 80),
|
||||
];
|
||||
|
||||
public MemberListData(IEnumerable<MemberListRow> rows, List<string> filterNames) :
|
||||
@ -48,6 +52,9 @@ namespace Elwig.Models.Dtos {
|
||||
.Include(m => m.Branch)
|
||||
.Include(m => m.PostalDest.AtPlz!.Ort)
|
||||
.Include(m => m.BillingAddress!.PostalDest.AtPlz!.Ort)
|
||||
.Include(m => m.TelephoneNumbers)
|
||||
.Include(m => m.EmailAddresses)
|
||||
.AsSplitQuery()
|
||||
.ToListAsync()).Select(m => new MemberListRow(m, areaCom[m.MgNr])), filterNames);
|
||||
}
|
||||
}
|
||||
@ -76,6 +83,10 @@ namespace Elwig.Models.Dtos {
|
||||
public bool IsActive;
|
||||
public DateOnly? EntryDate;
|
||||
public DateOnly? ExitDate;
|
||||
public string? TelNrLandline;
|
||||
public string? TelNrMobile;
|
||||
public string? EmailAddress;
|
||||
public string? AdditionalContact;
|
||||
public string? Comment;
|
||||
|
||||
public MemberListRow(Member m, int? areaCom = null) {
|
||||
@ -103,6 +114,15 @@ namespace Elwig.Models.Dtos {
|
||||
IsActive = m.IsActive;
|
||||
EntryDate = m.EntryDate;
|
||||
ExitDate = m.ExitDate;
|
||||
TelNrLandline = m.TelephoneNumbers.OrderBy(n => n.Nr).FirstOrDefault(n => n.Type == "landline")?.Number;
|
||||
TelNrMobile = m.TelephoneNumbers.OrderBy(n => n.Nr).FirstOrDefault(n => n.Type == "mobile")?.Number;
|
||||
EmailAddress = m.EmailAddresses.OrderBy(a => a.Nr).FirstOrDefault()?.Address;
|
||||
AdditionalContact = string.Join(", ", m.TelephoneNumbers
|
||||
.OrderBy(n => n.Nr)
|
||||
.Select(n => n.Number)
|
||||
.Except([TelNrLandline, TelNrMobile])
|
||||
.Distinct()
|
||||
.Concat(m.EmailAddresses.OrderBy(a => a.Nr).Select(a => a.Address).Except([EmailAddress])));
|
||||
Comment = m.Comment;
|
||||
AreaCommitment = areaCom == 0 ? null : areaCom;
|
||||
}
|
||||
|
Reference in New Issue
Block a user