private void BindGrid(int currentPage) { try { SisPackController.AdministrarGrillas.Configurar(this.dtgTransfarmacoCierreOperativoReporte, "GuiasTransfarmacoCierreOperativoID", 40); IGuiasTransfarmaco guiastransfarmaco = GuiasTransfarmacoFactory.GetGuiasTransfarmaco(); DataSet ds = new DataSet(); guiastransfarmaco.GuiasTransfarmacoCierreOperativoID = 0; guiastransfarmaco.NroGuia = 0; guiastransfarmaco.FechaDesde = DateTime.Parse("1900-01-01 00:00:00.000"); guiastransfarmaco.FechaHasta = DateTime.Parse("1900-01-01 00:00:00.000"); ds = guiastransfarmaco.GetRendicionesEmitidas(); this.Session["DsGridView"] = ds; this.dtgTransfarmacoCierreOperativoReporte.DataSource = ds.Tables[0]; this.dtgTransfarmacoCierreOperativoReporte.CurrentPageIndex = currentPage; this.dtgTransfarmacoCierreOperativoReporte.DataBind(); } catch (Exception ex) { throw ex; } }
protected void btnBuscarDesdeHasta_Click(object sender, EventArgs e) { try { if (txtBuscarRendicionGuia.Text != "") { txtFiltroDesde.Text = ""; txtFiltroHasta.Text = ""; lblError.Visible = false; lblError.Text = string.Empty; } if (txtFiltroDesde.Text != "" && txtFiltroHasta.Text == "") { lblError.Visible = true; lblError.Text = "*Debe Ingresar Una Fecha en 'Hasta:'<br/>"; return; } else if (txtFiltroDesde.Text == "" && txtFiltroHasta.Text != "") { lblError.Visible = true; lblError.Text = "*Debe Ingresar Una Fecha en 'Desde:'<br/>"; return; } else { lblError.Visible = false; lblError.Text = string.Empty; } SisPackController.AdministrarGrillas.Configurar(this.dtgTransfarmacoCierreOperativoReporte, "GuiasTransfarmacoCierreOperativoID", 400); IGuiasTransfarmaco guiastransfarmaco = GuiasTransfarmacoFactory.GetGuiasTransfarmaco(); DataSet ds = new DataSet(); string desde = this.txtFiltroDesde.Text == "" ? "01/01/1900" : this.txtFiltroDesde.Text; string hasta = this.txtFiltroHasta.Text == "" ? "01/01/1900" : this.txtFiltroHasta.Text; DateTime desdeDateTime = DateTime.ParseExact(desde, "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime hastaDateTime = DateTime.ParseExact(hasta, "dd/MM/yyyy", CultureInfo.InvariantCulture); guiastransfarmaco.FechaDesde = desdeDateTime; guiastransfarmaco.FechaHasta = hastaDateTime; if (this.ddlRendicionGuia.SelectedValue == "rendicion") { guiastransfarmaco.GuiasTransfarmacoCierreOperativoID = this.txtBuscarRendicionGuia.Text == "" ? 0 : Convert.ToInt32(this.txtBuscarRendicionGuia.Text); guiastransfarmaco.NroGuia = 0; } else if (this.ddlRendicionGuia.SelectedValue == "guia") { guiastransfarmaco.GuiasTransfarmacoCierreOperativoID = 0; guiastransfarmaco.NroGuia = this.txtBuscarRendicionGuia.Text == "" ? 0 : Convert.ToInt32(this.txtBuscarRendicionGuia.Text); } ds = guiastransfarmaco.GetRendicionesEmitidas(); this.Session["DsGridView"] = ds; this.dtgTransfarmacoCierreOperativoReporte.DataSource = ds.Tables[0]; this.dtgTransfarmacoCierreOperativoReporte.CurrentPageIndex = 0; this.dtgTransfarmacoCierreOperativoReporte.DataBind(); } catch (Exception ex) { throw ex; } }