private void btnLedgerSearch_Click(object sender, EventArgs e)
        {
            SearchSupplier search = new SearchSupplier(4);

            search.ShowDialog();
            if (search.xSupplierNo.ToString() != "0")
            {
                txtCustomerNo.Text       = search.xSupplierNo.ToString();
                txtCustomerName.Text     = search.xSupplierName.ToString();
                txtCustomerMobileNo.Text = search.xSupplierMobileNo.ToString();
                rchCustomerAddress.Text  = search.xSupplierAddress.ToString();
            }
        }
        public void SearchSupplierTest()
        {
            mockRepository.Setup(x => x.SearchSupplier(1))
            .Returns(listaSuppliers.Where(y => y.SupplierId == 1).First);

            var handler = new SearchSupplierHandler(mockRepository.Object);

            SearchSupplier su = new SearchSupplier(1);

            var res = handler.Handle(su, ct);

            Assert.IsNotNull(res.Result);
        }
        void nextsupplier(object param)
        {
            //var current = SearchSupplier.FirstOrDefault(x => x.ID == SelectedSearchSupplier);

            //int index = SearchSupplier.IndexOf(current);

            //if (index < SearchSupplier.Count - 1)
            //{
            //    var next = SearchSupplier.ElementAt(index + 1);
            //    this.SelectedSearchSupplier = next.ID;

            //}
            Mouse.OverrideCursor = Cursors.Wait;
            var current = SearchSupplier.FirstOrDefault(x => x.ID == SelectedSearchSupplier);

            int index = SearchSupplier.IndexOf(current);

            if (index < SearchSupplier.Count - 1)
            {
                var next = SearchSupplier.ElementAt(index + 1);
                this.SelectedSearchSupplier = next.ID;
            }
            if (index >= SearchSupplier.Count - 2)
            {
                this.ForwardEnabled = false;
                if (index - 1 <= 0)
                {
                    this.BackwardEnabled = false;
                }
                else
                {
                    this.BackwardEnabled = true;
                }
            }

            else
            {
                this.ForwardEnabled = true;
                if (index - 1 <= 0)
                {
                    this.BackwardEnabled = true;
                }
                else
                {
                    this.BackwardEnabled = true;
                }
            }
            Mouse.OverrideCursor = null;
        }
        private void btnSelect_Click(object sender, RoutedEventArgs e)
        {
            SearchSupplier window = new SearchSupplier(this);

            window.Show();
        }
 public IActionResult Get(int id, [FromQuery] SearchSupplier queryparams)
 {
     return(Ok(_supplierService.FindSuppliersBy(id, queryparams.Rate)));
 }
        public void GetData(int supplierId)
        {
            ISupplierRepository repo = new SupplierRepository();

            var supplier = repo.GetAllSupplier().Where(x => x.ID == supplierId).FirstOrDefault();

            if (supplier != null)
            {
                if (supplier.TaxId == null && supplier.ChangeSupplierGST == false)
                {
                    this.SelectedTaxId = 0;
                }
                else
                {
                    this.SelectedTaxId = supplier.TaxId;
                }
                this.SelectedSearchSupplier = supplier.ID;
                this.SupplierName           = supplier.SupplierName;
                this.Email = supplier.Email;
                this.Fax   = supplier.Fax;
                //this.SelectedSalesman = supplier.Cus_Salesman;
                //this.SelectedCustomerType = supplier.Cus_Type;
                //this.SelectedCreditLimitDays = supplier.Cus_Credit_Limit_Days;
                //this.SelectedCreditLimitAmount = supplier.Cus_Credit_Limit_Amount;
                this.Telephone = supplier.Telephone;
                //this.SelectedDiscount = supplier.Discount;
                this.CreditLimitDays = supplier.CreditLimitDays;
                //this.CreditLimitAmount = Math.Round(Convert.ToDecimal(supplier.CreditLimitAmount), Convert.ToInt32(this.DecimalPlaces));
                this.CreditLimitAmount     = supplier.CreditLimitAmount;
                this.Supp_Reg_No           = supplier.Supp_Reg_No;
                this.Sup_Bill_to_city      = supplier.Sup_Bill_to_city;
                this.Sup_Bill_to_country   = supplier.Sup_Bill_to_country;
                this.Sup_Bill_to_line1     = supplier.Sup_Bill_to_line1;
                this.Sup_Bill_to_line2     = supplier.Sup_Bill_to_line2;
                this.Sup_Bill_to_post_code = supplier.Sup_Bill_to_post_code;
                this.Sup_Bill_to_state     = supplier.Sup_Bill_to_state;
                this.ShipAddressLine1      = supplier.ShipAddressLine1;
                this.ShipAddressLine2      = supplier.ShipAddressLine2;
                this.ShipCity          = supplier.ShipCity;
                this.ShipCountry       = supplier.ShipCountry;
                this.ShipState         = supplier.ShipState;
                this.ShipPostalCode    = supplier.ShipPostalCode;
                this.ContactPerson     = supplier.ContactPerson;
                this.GstRegistrationNo = supplier.GstRegistrationNo;
                this.Remarks           = supplier.Remarks;
                this.IsInActive        = supplier.IsInActive;
                this.ChangeSupplierGST = supplier.ChangeSupplierGST;
                this.Balance           = supplier.Balance;
                this.ID = supplier.ID;

                //this.IsInActive = supplier.IsInActive;
                if (supplier.ChangeSupplierGST == true)
                {
                    this.ChangeSupplierGSTTrue  = supplier.ChangeSupplierGST;
                    this.ChangeSupplierGSTFalse = false;
                }
                else
                {
                    this.ChangeSupplierGSTTrue  = false;
                    this.ChangeSupplierGSTFalse = true;
                }

                ///Disable Privous button
                var current = SearchSupplier.FirstOrDefault(x => x.ID == SelectedSearchSupplier);

                int index = SearchSupplier.IndexOf(current);
                if (index - 1 <= 0)
                {
                    this.BackwardEnabled = false;
                    if (index >= SearchSupplier.Count - 1)
                    {
                        this.ForwardEnabled = false;
                    }
                    else
                    {
                        this.ForwardEnabled = true;
                    }
                }
                else
                {
                    this.BackwardEnabled = true;
                    if (index >= SearchSupplier.Count - 1)
                    {
                        this.ForwardEnabled = true;
                    }
                    else
                    {
                        this.ForwardEnabled = true;
                    }
                }
                ///disable next button
                var current1 = SearchSupplier.FirstOrDefault(x => x.ID == SelectedSearchSupplier);

                int index1 = SearchSupplier.IndexOf(current);


                if (index1 >= SearchSupplier.Count - 1)
                {
                    this.ForwardEnabled = false;
                    if (index1 <= 0)
                    {
                        this.BackwardEnabled = false;
                    }
                    else
                    {
                        this.BackwardEnabled = true;
                    }
                }

                else
                {
                    this.ForwardEnabled = true;
                    if (index1 <= 0)
                    {
                        this.BackwardEnabled = false;
                    }
                    else
                    {
                        this.BackwardEnabled = true;
                    }
                }
            }
            else
            {
                this.ID            = 0;
                this.SupplierName  = string.Empty;
                this.Balance       = string.Empty;
                this.ContactPerson = string.Empty;
                //this.CreditLimitAmount = null as decimal?;
                this.CreditLimitAmount = string.Empty;
                this.ContactPerson     = string.Empty;

                this.CreditLimitDays        = string.Empty;
                this.Email                  = string.Empty;
                this.Fax                    = string.Empty;
                this.GstRegistrationNo      = string.Empty;
                this.IsInActive             = string.Empty;
                this.ShipAddressLine1       = string.Empty;
                this.ShipAddressLine2       = string.Empty;
                this.ShipCity               = string.Empty;
                this.ShipCountry            = string.Empty;
                this.ShipPostalCode         = string.Empty;
                this.ShipState              = string.Empty;
                this.Supp_Reg_No            = string.Empty;
                this.Sup_Bill_to_city       = string.Empty;
                this.Sup_Bill_to_country    = string.Empty;
                this.Sup_Bill_to_line1      = string.Empty;
                this.Sup_Bill_to_line2      = string.Empty;
                this.Sup_Bill_to_post_code  = string.Empty;
                this.Sup_Bill_to_state      = string.Empty;
                this.Telephone              = string.Empty;
                this.IsInActive             = "N";
                this.SelectedSearchSupplier = 0;
                this.SelectedTaxId          = 0;
            }
        }