private string Buscar(VentasClass Venta) { string filtro = ""; if (FechaCheckBox.Checked.Equals(false)) { if (string.IsNullOrWhiteSpace(BuscarTextBox.Text)) { filtro = "1=1"; } else { if (CamposDropDownList.SelectedIndex == 0) { filtro = "VentaId = " + BuscarTextBox.Text; } else { filtro = CamposDropDownList.SelectedValue + " like '%" + BuscarTextBox.Text + "%'"; } } } else { filtro = "Fecha between '" + DesdeTextBox.Text + "' and '" + HastaTextBox.Text + "'"; } ConsultaGridView.DataSource = Venta.Listado("*", filtro, ""); ConsultaGridView.DataBind(); return(filtro); }
protected void BuscarButton_Click(object sender, EventArgs e) { string Condicion = ""; VentasClass Venta = new VentasClass(); if (string.IsNullOrWhiteSpace(BuscarTextBox.Text)) { Condicion = "1=1"; } else { if (!string.IsNullOrWhiteSpace(BuscarTextBox.Text)) { Condicion = CamposDropDownList.SelectedValue + " like '%" + BuscarTextBox.Text + "%'"; } } ConsultaGridView.DataSource = Venta.Listado("Fecha, Monto", Condicion, ""); ConsultaGridView.DataBind(); }
private string Buscar(VentasClass Venta) { string filtro = ""; if (string.IsNullOrWhiteSpace(BuscarTextBox.Text)) { filtro = "1=1"; } else { if (CamposDropDownList.SelectedIndex == 0) { filtro = "VentaId = " + BuscarTextBox.Text; } else { filtro = CamposDropDownList.SelectedValue + " like '%" + BuscarTextBox.Text + "%'"; } } ConsultaGridView.DataSource = Venta.Listado("*", filtro, ""); ConsultaGridView.DataBind(); return(filtro); }