private void Search(string pStrText) { grdSearch.BlockUI(); try { List <ItemType> lLstObjItemTypesList = new List <ItemType>(); if (mEnmFilter == FilterEnum.AUCTION) { lLstObjItemTypesList = mObjInventoryServicesFactory.GetItemTypeService().SearchItemTypeByAuctionType(pStrText, mEnmAuctionType, mEnmFilter).Where(x => (mObjInventoryServicesFactory.GetItemDefinitionService().GetDefinitions(x.Id))).ToList(); } else { lLstObjItemTypesList = mObjInventoryServicesFactory.GetItemTypeService().SearchItemType(pStrText, mEnmFilter); } this.Dispatcher.Invoke(() => { dgDataGrid.ItemsSource = null; mLcvListData = new ListCollectionView(lLstObjItemTypesList); 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 sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (!mBolReadOnly) { if (!string.IsNullOrEmpty(txtSearch.Text)) { dgItemType.ItemsSource = null; List <ItemType> lLstPartners = mObjServiceFactory.GetItemTypeService().GetList().Where(x => x.Active == true && x.Removed == false && ((x.Name.Contains(txtSearch.Text)) || (x.Code.Contains(txtSearch.Text)))).ToList(); mLcvListData = new ListCollectionView(lLstPartners); dgItemType.ItemsSource = mLcvListData; } else { LoadDataGrid(); } } else { ReturnItem(); } } }
private void txtItemType_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; //mObjInventoryFactory.GetItemDefinitionService().GetHeadTypeRelation(x.ItemId,lObjGoodsIssue.Batch.ItemTypeId) List <ItemType> lLstObjItemTypes = mObjInventoryFactory.GetItemTypeService() .SearchItemTypeByAuctionType(lStrText, AuctionType, FilterEnum.AUCTION) .Where(x => !x.Removed && (mObjInventoryFactory.GetItemDefinitionService().GetDefinitions(x.Id))).Select(y => y).ToList(); if (lLstObjItemTypes.Count == 1) { SetItemTypeObject(lLstObjItemTypes[0]); } else { (pObjSender as TextBox).Focusable = false; UserControl lUCItemType = new UCSearchItemType(lStrText, AuctionType, lLstObjItemTypes, FilterEnum.AUCTION); SetItemTypeObject(FunctionsUI.ShowWindowDialog(lUCItemType, this.GetParent()) as ItemType); (pObjSender as TextBox).Focusable = true; } } } catch (Exception lObjException) { CustomMessageBox.Show("Error", lObjException.Message, this.GetParent()); } }
private ItemType ShowItemTypeDialog(object pObjSender, KeyEventArgs pObjArgs) { ItemType lObjItemType = null; if (pObjArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus()) { List <ItemType> lLstObjItemTypes = mObjInventoryFactory.GetItemTypeService().SearchItemType((pObjSender as TextBox).Text, FilterEnum.ACTIVE); if (lLstObjItemTypes.Count == 1) { lObjItemType = lLstObjItemTypes[0]; } else { (pObjSender as TextBox).Focusable = false; UserControl lUCItemType = new UCSearchItemType((pObjSender as TextBox).Text, lLstObjItemTypes, FilterEnum.ACTIVE); lObjItemType = FunctionsUI.ShowWindowDialog(lUCItemType, Window.GetWindow(this)) as ItemType; (pObjSender as TextBox).Focusable = true; } } return(lObjItemType); }
private string GetItemTypeCode(long?pLonItemTypeId) { return(mObjInventoryFactory.GetItemTypeService().GetList().Where(x => x.Id == pLonItemTypeId).Count() > 0 ? mObjInventoryFactory.GetItemTypeService().GetList().Where(x => x.Id == pLonItemTypeId).Select(y => y.Code).FirstOrDefault() : string.Empty); }
private void SetItemDefinitionObject(ItemDefinitionDTO pObjItemDefinitionDTO) { SetItemObject(mObjInventoryFactory.GetItemService().Get(pObjItemDefinitionDTO.ItemId)); SetItemTypeObject(mObjInventoryFactory.GetItemTypeService().GetCustomEntity(pObjItemDefinitionDTO.ItemTypeId)); txtOrder.Text = pObjItemDefinitionDTO.Order.ToString(); }