private void ExecuteLogicDuringTransaction(Payment payment) { //doczytujemy wszystkie platnosci ktore mamy powiazac wraz z ich pozostalymi rozliczeniami var paymentsToSettle = (from s in payment.Settlements.Children where s.Status == BusinessObjectStatus.New || s.Status == BusinessObjectStatus.Modified select s.RelatedPayment.Id.Value).Distinct(); var settlementsToReplace = from s in payment.Settlements.Children where s.Status == BusinessObjectStatus.New || s.Status == BusinessObjectStatus.Modified select s; List <Payment> allPayments = new List <Payment>(1); allPayments.Add(payment); FinancialDocumentLogic.ReplaceAndValidatePayments(allPayments, paymentsToSettle, settlementsToReplace); }
private void ExecuteLogicDuringTransaction(FinancialDocument document) { //doczytujemy wszystkie platnosci ktore mamy powiazac wraz z ich pozostalymi rozliczeniami var paymentsToSettle = (from pt in document.Payments.Children from s in pt.Settlements.Children where s.Status == BusinessObjectStatus.New || s.Status == BusinessObjectStatus.Modified select s.RelatedPayment.Id.Value).Distinct(); //kopiujemy to do listy bo jak linq w locie iteruje to man sie potem w locie zmieni wartosc List <Guid> paymentsToSettleList = paymentsToSettle.ToList(); var settlementsToReplace = from pt in document.Payments.Children from s in pt.Settlements.Children where s.Status == BusinessObjectStatus.New || s.Status == BusinessObjectStatus.Modified select s; //j.w. List <PaymentSettlement> settlementsToReplaceList = settlementsToReplace.ToList(); FinancialDocumentLogic.ReplaceAndValidatePayments(document.Payments.Children, paymentsToSettleList, settlementsToReplaceList); }