private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Vendedores>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:     //ProductoId
                    listado = VendedoresBLL.GetList(v => v.VendedorId == Utilidades.ToInt(CriterioTextBox.Text));
                    break;

                case 1:     //Nombres
                    listado = VendedoresBLL.GetList(v => v.Nombres.Contains(CriterioTextBox.Text, StringComparison.OrdinalIgnoreCase));
                    break;

                case 2:     //Apellidos
                    listado = VendedoresBLL.GetList(v => v.Apellidos.Contains(CriterioTextBox.Text, StringComparison.OrdinalIgnoreCase));
                    break;

                    /*case 3: //UsuarioId
                     *  listado = VendedoresBLL.GetList(v => v.UsuarioId.Contains(CriterioTextBox.Text, StringComparison.OrdinalIgnoreCase));
                     *  break;*/
                }
            }
            else
            {
                listado = VendedoresBLL.GetList(c => true);
            }

            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var listado = new List <Vendedores>();

            if (CriteriotextBox.Text.Trim().Length > 0)
            {
                switch (FiltrocomboBox.SelectedIndex)
                {
                case 0:
                    listado = VendedoresBLL.GetList(p => true);
                    break;

                case 1:
                    int id = Convert.ToInt32(CriteriotextBox.Text);
                    listado = VendedoresBLL.GetList(p => p.IDVendedor == id);
                    break;

                case 2:
                    listado = VendedoresBLL.GetList(p => p.Nombre.Contains(CriteriotextBox.Text));
                    break;

                case 3:
                    decimal sueldo = Convert.ToDecimal(CriteriotextBox.Text);
                    listado = VendedoresBLL.GetList(p => p.Sueldo == sueldo);
                    break;

                case 4:
                    decimal retencion = Convert.ToDecimal(CriteriotextBox.Text);
                    listado = VendedoresBLL.GetList(p => p.Retencion == retencion);
                    break;

                case 5:
                    decimal total = Convert.ToDecimal(CriteriotextBox.Text);
                    listado = VendedoresBLL.GetList(p => p.Total == total);
                    break;
                }
                listado = listado.Where(c => c.Fecha >= DesdedateTimePicker.Value.Date && c.Fecha <= HastadateTimePicker.Value.Date).ToList();
            }



            else
            {
                listado = VendedoresBLL.GetList(p => true);
            }
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = listado;
        }
        private void BuscarSelecCombo()
        {
            Listas = null;

            if (DropDownListFiltro.SelectedIndex == 0)
            {
                Listas = VendedoresBLL.ListarTodo();
            }
            else if (DropDownListFiltro.SelectedIndex == 1)
            {
                if (TextBoxFiltro.Text == "")
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar la descripcion');</script>");
                }
                else
                {
                    int Busqueda = Utilidades.TOINT(TextBoxFiltro.Text);
                    Listas = VendedoresBLL.GetList(a => a.VendedoresId == Busqueda);
                    GridViewConsultaVendedores.DataSource = Listas;
                    GridViewConsultaVendedores.DataBind();
                }
            }
            else if (DropDownListFiltro.SelectedIndex == 2)
            {
                if (TextBoxFiltro.Text == "")
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar la descripcion');</script>");
                }
                else
                {
                    int Busqueda = Utilidades.TOINT(TextBoxFiltro.Text);
                    Listas = VendedoresBLL.GetList(a => a.VendedoresId == Busqueda);
                    GridViewConsultaVendedores.DataSource = Listas;
                    GridViewConsultaVendedores.DataBind();
                }
            }

            GridViewConsultaVendedores.DataSource = Listas;
            GridViewConsultaVendedores.DataBind();
        }