public void ShowMeResult_And_Fill_DataGrids(ItemsControl dg_lastnotes, ItemsControl dg_scannotes, string barcode) { var barcodeEntities = new BarcodeReaderEntities1(); var bcs = barcodeEntities.BarGoodsInfoes.Where(x => x.Barcode == barcode); foreach (var barGoodsInfo in bcs) { if (_str.Dismantling == _str.ResCallByName("Dismantle")) { var goods = new GoodsEntities(); _log.Log_For_Database(barGoodsInfo.Name, barGoodsInfo.Type, barGoodsInfo.Barcode); goods.SaveChanges(); UiInvoke((() => { dg_lastnotes.ItemsSource = _log.GetGoodsList(goods) .OrderByDescending((x => x.Date)) .Take(Settings.Default.HowMany_Strings_ToShow1); dg_scannotes.ItemsSource = _log.GetGoodsList(goods) .OrderByDescending((x => x.Date)) .Take(Settings.Default.HowMany_Strings_ToShow2) .Where(x => x.Barcode == barcode); })) ; if (_str.KeepSilence == _str.ResCallByName("ScanFinished")) { var quant = _log.GetGoodsList(goods).Count(); CheckTheDate(_log.GetGoodsList(goods), quant); } } } }
public ObservableCollection <Goods> GetGoodsList(GoodsEntities goods) { var list = from e in goods.Goods select e; return(new ObservableCollection <Goods>(list)); }