Exemplo n.º 1
0
        private void txtAuctions_KeyDown(object pObjSender, KeyEventArgs pObjArgs)
        {
            Auction lObjAuction = null;

            if (pObjArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus())
            {
                string         lStrText        = (pObjSender as TextBox).Text;
                List <Auction> lLstObjAuctions = mObjAuctionsFactory.GetAuctionService().SearchAuctions(lStrText, FilterEnum.NONE, AuctionSearchModeEnum.AUCTION);

                if (lLstObjAuctions.Count == 1)
                {
                    lObjAuction = lLstObjAuctions[0];
                }
                else
                {
                    (pObjSender as TextBox).Focusable = false;
                    UserControl lUCAuction = new UCSearchAuction(lStrText, lLstObjAuctions, FilterEnum.NONE, AuctionSearchModeEnum.AUCTION);
                    lObjAuction = FunctionsUI.ShowWindowDialog(lUCAuction, this.GetParent()) as Auction;
                    (pObjSender as TextBox).Focusable = true;
                }

                (pObjSender as TextBox).Focus();

                if (lObjAuction != null)
                {
                    (pObjSender as TextBox).Text = lObjAuction.Folio;
                }
                else
                {
                    (pObjSender as TextBox).Text = "";
                }
            }
        }
Exemplo n.º 2
0
        private void txtBuyer_KeyDown(object pObjSender, KeyEventArgs pObjArgs)
        {
            Partner lObjPartner = null;

            if (pObjArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus())
            {
                string         lStrText        = (pObjSender as TextBox).Text;
                List <Partner> lLstObjPartners = mObjPartnerFactory.GetPartnerService().SearchPartner(lStrText, FilterEnum.NONE);

                if (lLstObjPartners.Count == 1)
                {
                    lObjPartner = lLstObjPartners[0];
                }
                else
                {
                    (pObjSender as TextBox).Focusable = false;
                    UserControl lUCPartner = new UCSearchBusinessPartner(lStrText, lLstObjPartners, FilterEnum.NONE);
                    lObjPartner = FunctionsUI.ShowWindowDialog(lUCPartner, Window.GetWindow(this)) as Partner;
                    (pObjSender as TextBox).Focusable = true;
                }
                (pObjSender as TextBox).Focus();
                if (lObjPartner != null)
                {
                    (pObjSender as TextBox).Text = lObjPartner.Code;
                }
            }
        }
Exemplo n.º 3
0
        private Partner ShowDialogPartner(object pObjSender, KeyEventArgs pObjArgs)
        {
            Partner        lObjPartner     = null;
            string         lStrText        = (pObjSender as TextBox).Text;
            List <Partner> lLstObjPartners = mObjBusinessServicesFactory.GetPartnerService().SearchPartner(lStrText, FilterEnum.ACTIVE);

            if (lLstObjPartners.Count == 1)
            {
                lObjPartner = lLstObjPartners[0];
            }
            else
            {
                (pObjSender as TextBox).Focusable = false;
                UserControl lUCPartner = new UCSearchBusinessPartner(lStrText, lLstObjPartners, FilterEnum.ACTIVE);
                lObjPartner = FunctionsUI.ShowWindowDialog(lUCPartner, Window.GetWindow(this)) as Partner;
                (pObjSender as TextBox).Focusable = true;
            }
            (pObjSender as TextBox).Focus();

            if (lObjPartner == null)
            {
                return(null);
            }

            MoveToNextUIElement(pObjArgs);
            return(lObjPartner);
        }
Exemplo n.º 4
0
        private bool ValidateControls(Grid pControl)
        {
            var lUnkValidate = FunctionsUI.ValidateControls(grIssues);

            grIssues = lUnkValidate.Item2;
            return(lUnkValidate.Item1);
        }
Exemplo n.º 5
0
        private void txtCustomerBuyerId_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;
                    List <Partner> lLstObjPartners = mObjBusinessServicesFactory.GetPartnerService().SearchPartner(lStrText, FilterEnum.ACTIVE).Where(x => x.Code != mStrCodeSeller).ToList();

                    if (lLstObjPartners.Count == 1)
                    {
                        (pObjSender as TextBox).Focus();
                        SetBuyerObject(lLstObjPartners[0]);
                    }
                    else
                    {
                        (pObjSender as TextBox).Focusable = false;
                        UserControl lUCPartner = new UCSearchBusinessPartner(lStrText, lLstObjPartners, FilterEnum.ACTIVE);
                        SetBuyerObject(FunctionsUI.ShowWindowDialog(lUCPartner, Window.GetWindow(this)) as Partner);
                        (pObjSender as TextBox).Focusable = true;
                    }
                }
            }
            catch (Exception lObjException)
            {
                CustomMessageBox.Show("Error", lObjException.Message, this.GetParent());
            }
        }
Exemplo n.º 6
0
        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());
            }
        }
Exemplo n.º 7
0
        private void txtBatchSearch_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;
                    List <Batch> lLstObjBatches = mObjAuctionsFactory.GetBatchService().SearchBatches(lStrText, AuctionId);

                    if (lLstObjBatches.Count == 1)
                    {
                        InternalEditBatch(lLstObjBatches[0]);
                    }
                    else
                    {
                        (pObjSender as TextBox).Focusable = false;
                        UserControl lUCSearchBatch = new UCSearchBatch(lStrText, lLstObjBatches, AuctionId);
                        InternalEditBatch(FunctionsUI.ShowWindowDialog(lUCSearchBatch, this.GetParent()) as Batch);
                        (pObjSender as TextBox).Focusable = true;
                    }
                }
            }
            catch (Exception lObjException)
            {
                CustomMessageBox.Show("Error", lObjException.Message, this.GetParent());
            }
        }
Exemplo n.º 8
0
        private Auction ShowDialogAuction(object pObjSender, KeyEventArgs pObjArgs)
        {
            Auction lObjAuction = null;

            try
            {
                string         lStrText        = (pObjSender as TextBox).Text;
                List <Auction> lLstObjAuctions = mObjAuctionsServicesFactory.GetAuctionService().SearchAuctions(lStrText, FilterEnum.OPENED);

                if (lLstObjAuctions.Count == 1)
                {
                    lObjAuction = lLstObjAuctions[0];
                }
                else
                {
                    (pObjSender as TextBox).Focusable = false;
                    UserControl lUCAuction = new UCSearchAuction(lStrText, lLstObjAuctions, FilterEnum.OPENED, AuctionSearchModeEnum.AUCTION);
                    lObjAuction = FunctionsUI.ShowWindowDialog(lUCAuction, Window.GetWindow(this)) as Auction;
                    (pObjSender as TextBox).Focusable = true;
                }
                (pObjSender as TextBox).Focus();

                if (lObjAuction == null)
                {
                    return(null);
                }

                MoveToNextUIElement(pObjArgs);
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show("Error", ex.Message, this.GetParent());
            }
            return(lObjAuction);
        }
Exemplo n.º 9
0
        private void txtBuyer_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;
                    List <PartnerClassification> lLstObjClassifications = mObjBusinessFactory.GetPartnerClassificationService()
                                                                          .SearchPartner(lStrText, FilterEnum.ACTIVE).Where(x => mObjBuyerClassification != null ? x.Id != mObjBuyerClassification.Id : true).ToList();

                    if (lLstObjClassifications.Count == 1)
                    {
                        SetBuyerClassificationObject(lLstObjClassifications[0], pObjSender as TextBox);
                    }
                    else
                    {
                        (pObjSender as TextBox).Focusable = false;
                        UserControl lUCPartner = new UCSearchBusinessPartnerClassification(lStrText, lLstObjClassifications, FilterEnum.ACTIVE);
                        SetBuyerClassificationObject
                        (
                            mObjBusinessFactory.GetPartnerClassificationService().GetClassification
                            (
                                FunctionsUI.ShowWindowDialog(lUCPartner, this.GetParent()) as PartnerClassificationDTO
                            ),
                            pObjSender as TextBox
                        );
                        (pObjSender as TextBox).Focusable = true;
                    }
                }
            }
            catch (Exception lObjException)
            {
                CustomMessageBox.Show("Error", lObjException.Message, this.GetParent());
            }
        }
Exemplo n.º 10
0
        private void InternalAuctionSearch(TextBox pObjTextBox)
        {
            List <Auction> lLstObjAuctions = mObjAuctionsFactory.GetAuctionService().SearchAuctions(pObjTextBox.Text, FilterEnum.OPENED, AuctionSearchModeEnum.AUCTION);

            if (lLstObjAuctions.Count == 1)
            {
                SetAuctionObject(lLstObjAuctions[0]);
            }
            else
            {
                pObjTextBox.Focusable = false;
                UserControl lUCAuction = new UCSearchAuction(pObjTextBox.Text, lLstObjAuctions, FilterEnum.OPENED, AuctionSearchModeEnum.AUCTION);
                SetAuctionObject(FunctionsUI.ShowWindowDialog(lUCAuction, this.GetParent()) as Auction);
                pObjTextBox.Focusable = true;
            }
        }
Exemplo n.º 11
0
        private void InternalSellerSearch(TextBox pObjTextBox)
        {
            List <Partner> lLstObjSellers = mObjBusinessServices.GetPartnerService().SearchPartner(pObjTextBox.Text, FilterEnum.ACTIVE);

            if (lLstObjSellers.Count == 1)
            {
                SetSeller(lLstObjSellers[0]);
            }
            else
            {
                pObjTextBox.Focusable = false;
                UserControl lUCBusinessPartner = new UCSearchBusinessPartner(pObjTextBox.Text, lLstObjSellers, FilterEnum.ACTIVE);
                SetSeller(FunctionsUI.ShowWindowDialog(lUCBusinessPartner, this.GetParent()) as Partner);
                pObjTextBox.Focusable = true;
            }
        }
Exemplo n.º 12
0
        private void LoadPartnerSAP()
        {
            PartnerMappingDTO lObjParnerMap  = dgPartner.SelectedItem as PartnerMappingDTO;
            List <Partner>    lLstObjSellers = mObjPartnerFactory.GetPartnerService().SearchPartner("", FilterEnum.ACTIVE).Where(x => x.Code != lObjParnerMap.Partner.Code).ToList();
            UserControl       lUCPartner     = new UCSearchBusinessPartner("", lLstObjSellers, FilterEnum.ACTIVE);

            lObjParnerMap.PartnerSAP = FunctionsUI.ShowWindowDialog(lUCPartner, Window.GetWindow(this)) as Partner;
            if (lObjParnerMap.PartnerSAP != null && lObjParnerMap.PartnerSAP.Code != (dgPartner.SelectedItem as PartnerMappingDTO).Partner.Code)
            {
                lObjParnerMap.PartnerSAP.Temporary = true;
                dgPartner.SelectedItem             = lObjParnerMap;
                dgPartner.Items.Refresh();
            }
            else
            {
                lObjParnerMap.PartnerSAP = new Partner();
            }
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        private ItemTypeDTO ShowItemTypeDialog(object pObjSender, KeyEventArgs pObjEventsArgs)
        {
            ItemTypeDTO lObjItemType = null;

            if (pObjEventsArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus())
            {
                List <ItemTypeDTO> lLstItemType = SearchItemType((pObjSender as TextBox).Text);
                if (lLstItemType.Count == 1)
                {
                    lObjItemType = lLstItemType[0];
                }
                else
                {
                    (pObjSender as TextBox).Focusable = false;
                    UserControl lUCItemType = new UCItemTypes(true, lLstItemType, (pObjSender as TextBox).Text);
                    lObjItemType = FunctionsUI.ShowWindowDialog(lUCItemType, Window.GetWindow(this)) as ItemTypeDTO;
                    (pObjSender as TextBox).Focusable = true;
                }
            }

            return(lObjItemType);
        }
Exemplo n.º 15
0
 private void txtPartner_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         Partner lObjPartner = new Partner();
         if ((e.Key == Key.Enter & ((sender as TextBox).AcceptsReturn == false) && (sender as TextBox).Focus()) || e.Key == Key.Tab)
         {
             List <Partner> lLstPartner = SearchPartner((sender as TextBox).Text);
             if (lLstPartner.Count == 1)
             {
                 lObjPartner = lLstPartner[0];
             }
             else
             {
                 (sender as TextBox).Focusable = false;
                 UserControl lUCPartner = new UCSearchBusinessPartner((sender as TextBox).Text, lLstPartner, FilterEnum.ACTIVE);
                 lObjPartner = FunctionsUI.ShowWindowDialog(lUCPartner, Window.GetWindow(this)) as Partner;
                 (sender as TextBox).Focusable = true;
             }
             (sender as TextBox).Focus();
             if (lObjPartner != null)
             {
                 SetControls(lObjPartner, (sender as TextBox).Name);
                 loadDatagrid();
             }
             else
             {
                 (sender as TextBox).Focus();
             }
         }
     }
     catch (Exception ex)
     {
         CustomMessageBox.Show("Error", ex.Message, Window.GetWindow(this));
     }
 }
Exemplo n.º 16
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());
            }
        }
Exemplo n.º 17
0
        private Item ShowItemDialog(object pObjSender, KeyEventArgs pObjEventsArgs)
        {
            Item lObjItem = null;

            if (pObjEventsArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus())
            {
                List <Item> lLstItem = SearchItem((pObjSender as TextBox).Text);
                if (lLstItem.Count == 1)
                {
                    lObjItem = lLstItem[0];
                }
                else
                {
                    (pObjSender as TextBox).Focusable = false;
                    UserControl lUCItem = new UCItems(true, lLstItem, (pObjSender as TextBox).Text);
                    lObjItem = FunctionsUI.ShowWindowDialog(lUCItem, Window.GetWindow(this)) as Item;
                    (pObjSender as TextBox).Focusable = true;
                }
                (pObjSender as TextBox).Focus();
                (pObjSender as TextBox).FocusNext();
            }

            return(lObjItem);
        }
Exemplo n.º 18
0
        private void InternalAuctionSearch(TextBox pObjTextBox)
        {
            mObjAuction = new Auction();
            List <Auction> lLstObjAuctions = mObjAuctionsServicesFactory.GetAuctionService().SearchAuctions(pObjTextBox.Text, FilterEnum.OPENED).Where(x => x.Category == AuctionCategoryEnum.DIRECT_TRADE).ToList();

            if (lLstObjAuctions.Count == 1)
            {
                // SetAuctionObject(lLstObjAuctions[0]);
                mObjAuction     = lLstObjAuctions[0];
                txtAuction.Text = lLstObjAuctions[0].Folio;
            }
            else
            {
                pObjTextBox.Focusable = false;
                UserControl lUCAuction = new UCSearchAuction(pObjTextBox.Text, lLstObjAuctions, FilterEnum.OPENED, AuctionSearchModeEnum.AUCTION);
                mObjAuction           = (FunctionsUI.ShowWindowDialog(lUCAuction, this.GetParent()) as Auction);
                txtAuction.Text       = mObjAuction == null ? "" : mObjAuction.Folio;
                pObjTextBox.Focusable = true;
            }
            if (mObjAuction != null)
            {
                LoadDatagrid();
                if (mObjAuction.Category == AuctionCategoryEnum.DIRECT_TRADE)
                {
                    txtWeight.Visibility = Visibility.Visible;
                    lblWeight.Visibility = Visibility.Visible;
                    dgTrades.Columns.Where(x => x.Header.Equals("Peso")).FirstOrDefault().Visibility = Visibility.Collapsed;
                }
                else
                {
                    txtWeight.Visibility = Visibility.Collapsed;
                    lblWeight.Visibility = Visibility.Collapsed;
                    dgTrades.Columns.Where(x => x.Header.Equals("Peso")).FirstOrDefault().Visibility = Visibility.Visible;
                }
            }
        }
Exemplo n.º 19
0
 private void txtAuctions_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     try
     {
         Auction lObjAuction = null;
         if ((e.Key == Key.Enter & ((sender as TextBox).AcceptsReturn == false) && (sender as TextBox).Focus()) || e.Key == Key.Tab)
         {
             IList <Auction> lLstAuction = SearchAuctions((sender as TextBox).Text);
             if (lLstAuction.Count == 1)
             {
                 lObjAuction = lLstAuction[0];
             }
             else
             {
                 (sender as TextBox).Focusable = false;
                 UserControl lUCAuction = new UCSearchAuction(txtSearchAuction.Text, lLstAuction.ToList(), FilterEnum.ACTIVE, AuctionSearchModeEnum.AUCTION); // new UCAuction(true, lLstAuction.ToList(), (sender as TextBox).Text);
                 lObjAuction = FunctionsUI.ShowWindowDialog(lUCAuction, Window.GetWindow(this)) as Auction;
                 (sender as TextBox).Focusable = true;
             }
             (sender as TextBox).Focus();
             if (lObjAuction != null)
             {
                 SetControls(lObjAuction);
                 LoadDatagrid();
             }
             else
             {
                 (sender as TextBox).Focus();
             }
         }
     }
     catch (Exception lObjException)
     {
         CustomMessageBox.Show("Subasta", lObjException.Message, Window.GetWindow(this));
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// Realiza la busqueda o carga la ventana de dialogo
        /// </summary>
        private void txtItemId_KeyDown(object pObjSender, KeyEventArgs pObjArgs)
        {
            Item lObjItem = new Item();

            if (pObjArgs.Key == Key.Enter & ((pObjSender as TextBox).AcceptsReturn == false) && (pObjSender as TextBox).Focus())
            {
                string      lStrText     = (pObjSender as TextBox).Text;
                List <Item> lLstObjItems = mObjInventoryServicesFactory.GetItemService().SearchItem(lStrText, FilterEnum.ACTIVE);

                if (lLstObjItems.Count == 1)
                {
                    lObjItem = lLstObjItems[0];
                }
                else
                {
                    (pObjSender as TextBox).Focusable = false;
                    UserControl lUCItems = new UCSearchItem(lStrText, lLstObjItems, FilterEnum.ACTIVE);
                    lObjItem = FunctionsUI.ShowWindowDialog(lUCItems, Window.GetWindow(this)) as Item;
                    (pObjSender as TextBox).Focusable = true;
                }
                (pObjSender as TextBox).Focus();
                LoadItemObject(lObjItem);
            }
        }