public void BuildLineViews(List <BatchLine> batchLines) { var orderLines = Addresses.SelectMany(a => a.ActiveOrders()).SelectMany(o => o.Lines); var lookup = orderLines.ToLookup(l => l.ExportBatchLineId); var items = batchLines.Select(l => new BatchLineView(l, lookup[l.ExportId].FirstOrDefault())).ToArray(); Lines.Value = orderLines.Except(items.Where(x => x.OrderLine != null).Select(x => x.OrderLine)) .Select(x => new BatchLineView(x)).Concat(items).ToObservableCollection(); BatchLine.CalculateStyle(Address, Addresses, Lines.Value); Lines.Value.Where(l => l.OrderLine != null).Each(l => l.OrderLine.Configure(User)); ReportLines.Recalculate(); }
public void Mark_line() { var order = MakeOrderLine().Order; Activate(batch, order.Address); order.Frozen = true; batch.Lines.Value = new ObservableCollection <BatchLineView> { new BatchLineView(new BatchLine { ProductId = 105, Address = batch.Address }, null), }; BatchLine.CalculateStyle(batch.Address, batch.Addresses, batch.Lines.Value); Assert.IsTrue(batch.Lines.Value[0].ExistsInFreezed); Assert.IsTrue(batch.Lines.Value[0].IsCurrentAddress); }