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