Hier ist meine Einheit StrukturWie Nested Sammlung innerhalb Wörterbuch mit LINQ C#
Transaction Entity
TransactionID, CompanyID TransactionItems
1 10 List<TransactionItems>
2 10 List<TransactionItems>
3 20 List<TransactionItems>
TransactionItems Entity
TransactionItemID TransactionID Value Postive Negative
1 2 10 yes
2 2 20 yes
3 2 30 yes
4 3 100 yes
5 3 200 yes
I need to sum the values of Value based on positive or negative flag and then compute total like this
CompanyID Postive Negative
10 30 30
20 200 100
Die Funktion in der Business-Schicht auf Filter Dictionary<int, List<Transaction>>
zurückkehrt, welche wie diese im Grunde ist
Key Value
CompanyID, List<Transaction>
Bisher habe ich nur erreicht dies
_Transaction.GetCompanyTransactions().
Select(_Company => new
{
Company = _Company.Key,
Positive =
Negative =
});
kann jemand bitte helfen
Sie müssen im Grunde den 'Wert' addieren, wo Ihre Flagge' Positiv/Negativ' ist. –
Als Randnotiz sollte es wahrscheinlich besser gewesen sein, nur ein 'Positiv'-Flag auf' True/False' gesetzt zu haben. –