protected void BuscarButton_Click(object sender, EventArgs e) { Expression <Func <Pesadas, bool> > filtro = x => true; RepositorioPesadas repositorio = new RepositorioPesadas(); switch (BuscarPorDropDownList.SelectedIndex) { case 0: filtro = x => true; break; } DateTime fechaDesde = FechaDesdeTextBox.Text.ToDatetime(); DateTime FechaHasta = FechaHastaTextBox.Text.ToDatetime(); if (Request.Form["FiltraFecha"] != null) { lista = repositorio.GetList(filtro).Where(x => x.Fecha >= fechaDesde && x.Fecha <= FechaHasta).ToList(); } else { lista = repositorio.GetList(filtro); } repositorio.Dispose(); this.BindGrid(lista.Where(x => x.EmpresaId == Empresa.EmpresaID).ToList()); }
protected void VerDetalleButton_Click(object sender, EventArgs e) { Utils.MostrarModal(this.Page, "ModalDetalle", "Detalle"); GridViewRow row = (sender as Button).NamingContainer as GridViewRow; var Pesada = lista.ElementAt(row.RowIndex); RepositorioPesadas Repositorio = new RepositorioPesadas(); List <PesadasDetalle> Details = Repositorio.Buscar(Pesada.PesadaId).Detalles; DetalleDatosGridView.DataSource = null; DetalleDatosGridView.DataSource = Details; DetalleDatosGridView.DataBind(); Repositorio.Dispose(); }