private void CalculateItem(CalculationItem item) { foreach (var pr in calculatedProducts) { var calcValue = new CalculatedValue { Item = item, Value = CalculateValue(ParseExpression(pr.Product, item, pr.CalculatedValues), item.NeedRound == 1) }; pr.CalculatedValues.Add(calcValue); } }
public void Process() { foreach (var product in Products) { CalculatedProduct calcProduct = new CalculatedProduct { Product = product, CalculatedValues = new List <CalculatedValue>() }; foreach (var item in _calculationItems.OrderBy(x => x.OrderID)) { var calcValue = new CalculatedValue { Item = item, Value = CalculateValue(ParseExpression(calcProduct.Product, item, calcProduct.CalculatedValues)) }; calcProduct.CalculatedValues.Add(calcValue); } calculatedProducts.Add(calcProduct); } }