Пример #1
0
        private void txtPesquisarVendedor_TextChanged(object sender, EventArgs e)
        {
            var radioButtons = gbRadioButton.Controls.OfType <RadioButton>();

            string opcaoPesquisa = "";

            foreach (RadioButton rb in radioButtons)
            {
                bool   estado = rb.Checked;
                string nome   = rb.Name;

                if (estado == true)
                {
                    opcaoPesquisa = nome;
                }
            }

            if (txtPesquisarVendedor.Text.Trim() != string.Empty)
            {
                VendedorDAO dao = new VendedorDAO();

                List <VendedorVO> PesquisaVendedor = dao.PesquisarVendedor(Util.CodigoLogado, txtPesquisarVendedor.Text, opcaoPesquisa);

                grdVendedor.DataSource = PesquisaVendedor;

                for (int i = 0; i < PesquisaVendedor.Count; i++)
                {
                    if (Convert.ToString(grdVendedor.Rows[i].Cells[5].Value) == "Inativo")
                    {
                        grdVendedor.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
                grdVendedor.Update();
            }
            else
            {
                CarregarGrid();
            }
        }