Beispiel #1
0
        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);
        }
Beispiel #2
0
        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());
            }
        }