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(); } }
/// <summary> /// Realiza una busqueda en la base de datos al precionar la tecla enter. /// </summary> private void txtSearch_KeyDown(object pObjSender, KeyEventArgs pObjArgs) { if (pObjArgs.Key == Key.Enter) { if (!string.IsNullOrEmpty(txtSearch.Text)) { dgGoodsReceipt.ItemsSource = null; List <GoodsReceipt> lLstPartners = mObjInventoryServicesFactory.GetGoodsReceiptService().GetList().Where(x => x.Active == true && x.Removed == false && ((x.Folio.Contains(txtSearch.Text)) || (x.Customer.Name.Contains(txtSearch.Text)) || (x.Item.Name.Contains(txtSearch.Text)))).ToList(); mLcvListData = new ListCollectionView(lLstPartners); dgGoodsReceipt.ItemsSource = mLcvListData; } else { LoadDatagrid(); } } }