Imports Extensiones Imports System.Data Partial Class Temporal_RepVotos Inherits ClsPaginas #Region "P R O P I E D A D E S " Public Property DtMasculino As DataTable Get Return CType(ViewState("DtMasculino"), DataTable) End Get Set(value As DataTable) ViewState("DtMasculino") = value End Set End Property Public Property DtFemenino As DataTable Get Return CType(ViewState("DtFemenino"), DataTable) End Get Set(value As DataTable) ViewState("DtFemenino") = value End Set End Property Public Property Tipo As String = "" #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Tipo = (Request("Tipo")).ToString CargaDatos() End If End Sub Private Sub CargaDatos() DtMasculino = New DataTable() DtFemenino = New DataTable() Dim NumVotosH, NumVotosM As DataTable Dim Objeto As New ClsTemporal If Objeto.GetRepVotos(Tipo) Then DtMasculino = Objeto.DtResultados.FiltraParametros($"Sexo = {"'H'"} AND NumConsejero IS NOT NULL") DtFemenino = Objeto.DtResultados.FiltraParametros($"Sexo = {"'M'"} AND NumConsejero IS NOT NULL ") NumVotosH = Objeto.DtResultados.FiltraParametros($"Sexo = {"'H'"} AND NumConsejero IS NULL") NumVotosM = Objeto.DtResultados.FiltraParametros($"Sexo = {"'M'"} AND NumConsejero IS NULL ") If NumVotosH.Rows.Count > 0 Then LblVotosHombre.Text = NumVotosH.Rows(0)("Votos").ToString Else LblVotosHombre.Text = "0" End If If NumVotosM.Rows.Count > 0 Then LblVotosMujeres.Text = NumVotosM.Rows(0)("Votos").ToString Else LblVotosMujeres.Text = "0" End If GvMasculino.DataSource = DtMasculino GvFemenino.DataSource = DtFemenino GvMasculino.DataBind() GvFemenino.DataBind() End If If Objeto.GetNumVotos(Tipo, "H") Then LblBoletasHombre.Text = Objeto.DtResultados.Rows(0)("NumBoletas").ToString End If If Objeto.GetNumVotos(Tipo, "M") Then LblBoletasMujer.Text = Objeto.DtResultados.Rows(0)("NumBoletas").ToString End If OrdenaDatos() UpDatos.Update() End Sub #Region " O R D E N A M I E N T O JAVASCRIPT" Private Sub OrdenaDatos() If (GvMasculino.Rows.Count > 0) Then GvMasculino.UseAccessibleHeader = True GvMasculino.HeaderRow.TableSection = TableRowSection.TableHeader RegistraScript("OrdenarGV();") End If If (GvFemenino.Rows.Count > 0) Then GvFemenino.UseAccessibleHeader = True GvFemenino.HeaderRow.TableSection = TableRowSection.TableHeader RegistraScript("OrdenarGV();") End If End Sub Private Sub ImgExcelHombres_Click(sender As Object, e As EventArgs) Handles ImgExcelHombres.Click GvMasculino.ExportToExcelx("Reporte de Hombres") End Sub Private Sub ImgExcelMujeres_Click(sender As Object, e As EventArgs) Handles ImgExcelMujeres.Click GvFemenino.ExportToExcelx("Reporte de Mujeres") End Sub #End Region End Class