Exemple #1
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);
        }
Exemple #2
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 = "";
                }
            }
        }
Exemple #3
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;
            }
        }
Exemple #4
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;
                }
            }
        }
 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));
     }
 }