private void UpdateLotsList(bool isNew = true) { var lots = DataBaseClient.ReadLots(auctionId); if (lots != null && lots.Count > 0) { if (LotsList == null) { LotsList = new List <LotsList>(); } LotsList.Clear(); foreach (var item in lots) { LotsList.Add(new LotsList() { id = item.id, number = item.number, description = item.description }); } if (!isNew) { if (SupplierOrder.lots != null && SupplierOrder.lots.Count > 0) { foreach (var item in SupplierOrder.lots) { var lotInfo = LotsList.FirstOrDefault(ll => ll.id == item.id); if (lotInfo != null) { lotInfo.inplay = true; } } } } else { if (LotsList.Count == 1) { LotsList[0].inplay = true; } } LotsList = LotsList; } }
private void CheckLots() { if (SupplierOrder.lots == null) { SupplierOrder.lots = new List <LotEF>(); } SupplierOrder.lots.Clear(); foreach (var item in LotsList.Where(ll => ll.inplay == true)) { var lot = DataBaseClient.ReadLot(item.id); if (lot != null) { SupplierOrder.lots.Add(lot); } } }