MailWindow: Order members by billing address if applicable
This commit is contained in:
		| @@ -374,6 +374,9 @@ namespace Elwig.Windows { | |||||||
|             DisposeDocs(); |             DisposeDocs(); | ||||||
|             await UpdateTextParameters(); |             await UpdateTextParameters(); | ||||||
|  |  | ||||||
|  |             var doublePaged = DoublePagedInput.IsChecked == true; | ||||||
|  |             var docs = SelectedDocs.OrderByDescending(d => d.Type).ToList(); | ||||||
|  |  | ||||||
|             IEnumerable<Member> recipients = Recipients; |             IEnumerable<Member> recipients = Recipients; | ||||||
|             if (OrderMgNrInput.IsChecked == true) { |             if (OrderMgNrInput.IsChecked == true) { | ||||||
|                 recipients = recipients |                 recipients = recipients | ||||||
| @@ -386,18 +389,25 @@ namespace Elwig.Windows { | |||||||
|                     .ThenBy(m => m.MgNr) |                     .ThenBy(m => m.MgNr) | ||||||
|                     .ToList(); |                     .ToList(); | ||||||
|             } else if (OrderPlzInput.IsChecked == true) { |             } else if (OrderPlzInput.IsChecked == true) { | ||||||
|                 recipients = recipients |                 if (docs.Any(d => d.Type == DocType.DeliveryConfirmation || d.Type == DocType.CreditNote)) { | ||||||
|                     .OrderBy(m => m.PostalDest.AtPlz.Plz) |                     recipients = recipients | ||||||
|                     .ThenBy(m => m.PostalDest.AtPlz.Ort.Name) |                         .OrderBy(m => m.BillingAddress?.PostalDest.AtPlz?.Plz ?? m.PostalDest.AtPlz?.Plz) | ||||||
|                     .ThenBy(m => m.FamilyName) |                         .ThenBy(m => m.BillingAddress?.PostalDest.AtPlz?.Ort.Name ?? m.PostalDest.AtPlz?.Ort.Name) | ||||||
|                     .ThenBy(m => m.GivenName) |                         .ThenBy(m => m.FamilyName) | ||||||
|                     .ThenBy(m => m.MgNr) |                         .ThenBy(m => m.GivenName) | ||||||
|                     .ToList(); |                         .ThenBy(m => m.MgNr) | ||||||
|  |                         .ToList(); | ||||||
|  |                 } else { | ||||||
|  |                     recipients = recipients | ||||||
|  |                         .OrderBy(m => m.PostalDest.AtPlz?.Plz) | ||||||
|  |                         .ThenBy(m => m.PostalDest.AtPlz?.Ort.Name) | ||||||
|  |                         .ThenBy(m => m.FamilyName) | ||||||
|  |                         .ThenBy(m => m.GivenName) | ||||||
|  |                         .ThenBy(m => m.MgNr) | ||||||
|  |                         .ToList(); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             var doublePaged = DoublePagedInput.IsChecked == true; |  | ||||||
|             var docs = SelectedDocs.OrderByDescending(d => d.Type).ToList(); |  | ||||||
|  |  | ||||||
|             Dictionary<int, IDictionary<int, DeliveryConfirmationDeliveryData>> dcData = []; |             Dictionary<int, IDictionary<int, DeliveryConfirmationDeliveryData>> dcData = []; | ||||||
|             Dictionary<(int, int), (IDictionary<int, CreditNoteDeliveryData>, IDictionary<int, PaymentMember>, BillingData)> cnData = []; |             Dictionary<(int, int), (IDictionary<int, CreditNoteDeliveryData>, IDictionary<int, PaymentMember>, BillingData)> cnData = []; | ||||||
|             foreach (var doc in docs) { |             foreach (var doc in docs) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user