private void txtSellerCode_KeyDown(object pObjSender, KeyEventArgs pObjArgs) { try { if (pObjArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus()) { string lStrText = (pObjSender as TextBox).Text; DateTime lDtAuctionDate = mObjAuctionsFactory.GetAuctionService().GetActiveAuction().Date; List <long> lLstLonSellersWithStock = mObjInventoryFactory.GetStockService().GetListByWhs().Where(x => (DbFunctions.TruncateTime(x.ExpirationDate) == DbFunctions.TruncateTime(lDtAuctionDate)) && x.Quantity > 0).Select(x => x.CustomerId).Distinct().ToList(); lLstLonSellersWithStock.AddRange((mObjInventoryFactory.GetGoodsReceiptService().GetList().Where(x => (DbFunctions.TruncateTime(x.ExpirationDate) == DbFunctions.TruncateTime(lDtAuctionDate)) && !x.Processed).Select(x => x.CustomerId).Distinct().ToList())); List <Partner> lLstObjSellers = mObjBusinessFactory.GetPartnerService().SearchPartnerWithStock(lStrText, FilterEnum.ACTIVE, lLstLonSellersWithStock); if (lLstObjSellers.Count == 1) { SetSellerObject(lLstObjSellers[0]); } else { (pObjSender as TextBox).Focusable = false; UserControl lUCPartner = new UCSearchBusinessPartner(lStrText, lLstObjSellers, FilterEnum.ACTIVE); SetSellerObject(FunctionsUI.ShowWindowDialog(lUCPartner, this.GetParent()) as Partner); (pObjSender as TextBox).Focusable = true; } } } catch (Exception lObjException) { CustomMessageBox.Show("Error", lObjException.Message, this.GetParent()); } }
private void Search(string pStrText) { grdSearch.BlockUI(); try { DateTime lDtAuctionDate = mObjAuctionFactory.GetAuctionService().GetActiveAuction().Date; List <long> lLstLonSellersWithStock = mObjInventoryServiceFactory.GetStockService().GetListByWhs().Where(x => (DbFunctions.TruncateTime(x.ExpirationDate) == DbFunctions.TruncateTime(lDtAuctionDate)) && x.Quantity > 0).Select(x => x.CustomerId).Distinct().ToList(); lLstLonSellersWithStock.AddRange((mObjInventoryServiceFactory.GetGoodsReceiptService().GetList().Where(x => (DbFunctions.TruncateTime(x.ExpirationDate) == DbFunctions.TruncateTime(lDtAuctionDate)) && !x.Processed).Select(x => x.CustomerId).Distinct().ToList())); //List<Partner> lLstObjBatchesList = mObjBusinessServicesFactory.GetPartnerService().SearchPartner(pStrText, mEnmFilter); List <Partner> lLstObjBatchesList = mObjBusinessServicesFactory.GetPartnerService().SearchPartnerWithStock(pStrText, FilterEnum.ACTIVE, lLstLonSellersWithStock); this.Dispatcher.Invoke(() => { dgDataGrid.ItemsSource = null; mLcvListData = new ListCollectionView(lLstObjBatchesList); dgDataGrid.ItemsSource = mLcvListData; }); } catch (Exception lObjException) { ShowMessage("Error", lObjException.Message); } finally { grdSearch.UnblockUI(); } }