-RegistraScript se unifica en una sola clase static/shared y se simplica el código -Alert se vuelve estático -Random() no se manda a crear cada vez que se registra un script (esto tenía un costo alto) -Se corrigieron unos errores en los nombres de funciones -Las clases que ya heredan de Clspaginas, se les quita el this a RegistraScript y a Alert puesto que era innecesario (y además al haberlos vuelto métodos estáticos, NO pueden llamarse de un this)
152 lines
7.5 KiB
VB.net
152 lines
7.5 KiB
VB.net
|
|
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Prospectos_RepRedesEstructuras
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
ViewState("Orden") = String.Empty
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
If ObjProspectos.GetRepEstructura(DdlMunicipio.SelectedValue, DdlSeccion.SelectedValue.ToEntero, DdlSexo.SelectedValue.ToEntero, DdlIFE.SelectedValue.ToEntero, DdlPregunta.SelectedValue.ToEntero, DdlAgrupador.SelectedValue.ToEntero) Then
|
|
ViewState("DTProspectos") = ObjProspectos.DtResultados
|
|
'LtlAgrupador.Text = DdlAgrupador.SelectedItem.Text
|
|
Else
|
|
Me.GvDatos.DataSource = Nothing
|
|
End If
|
|
ObjProspectos.Dispose()
|
|
|
|
If ViewState("Orden").ToString() <> String.Empty Then
|
|
CargaGrid(ViewState("Orden").ToString())
|
|
Else
|
|
CargaGrid("")
|
|
End If
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaGrid(Orden As String)
|
|
If Orden <> String.Empty Then
|
|
Dim DV As New DataView(CType(ViewState("DTProspectos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
|
GvDatos.DataSource = DV.ToTable()
|
|
DV.Dispose()
|
|
Else
|
|
GvDatos.DataSource = CType(ViewState("DTProspectos"), DataTable)
|
|
End If
|
|
GvDatos.DataBind()
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowCreated
|
|
If (e.Row.RowType = DataControlRowType.DataRow AndAlso (e.Row.RowState = DataControlRowState.Normal OrElse e.Row.RowState = DataControlRowState.Alternate)) Then
|
|
e.Row.TabIndex = -1
|
|
e.Row.Attributes("onclick") = String.Format("javascript:SelectRow(this, {0});", e.Row.RowIndex)
|
|
e.Row.Attributes("onkeydown") = "javascript:return SelectSibling(event);"
|
|
e.Row.Attributes("onselectstart") = "javascript:return false;"
|
|
' e.Row.Cells(10).Attributes.Add("onclick", "EC();")
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
e.Row.FCLiteral("LtlGpo").Text = "Total General"
|
|
e.Row.FCLiteral("LtlPor").Text = ""
|
|
'ElseIf e.Row.RowIndex = 1 Then
|
|
' e.Row.Cells(0).Width = Unit.Pixel(120)
|
|
' e.Row.Cells(1).Width = Unit.Pixel(60)
|
|
' e.Row.Cells(2).Width = Unit.Pixel(60)
|
|
|
|
' e.Row.Cells(3).Width = Unit.Pixel(60)
|
|
' e.Row.Cells(4).Width = Unit.Pixel(70)
|
|
' e.Row.Cells(5).Width = Unit.Pixel(60)
|
|
' e.Row.Cells(6).Width = Unit.Pixel(60)
|
|
|
|
' e.Row.Cells(7).Width = Unit.Pixel(70)
|
|
' e.Row.Cells(8).Width = Unit.Pixel(100)
|
|
' e.Row.Cells(9).Width = Unit.Pixel(80)
|
|
' e.Row.Cells(10).Width = Unit.Pixel(105)
|
|
' e.Row.Cells(11).Width = Unit.Pixel(100)
|
|
' e.Row.Cells(12).Width = Unit.Pixel(100)
|
|
' e.Row.Cells(13).Width = Unit.Pixel(110)
|
|
|
|
' e.Row.Cells(14).Width = Unit.Pixel(100)
|
|
' e.Row.Cells(15).Width = Unit.Pixel(80)
|
|
' e.Row.Cells(16).Width = Unit.Pixel(70)
|
|
' e.Row.Cells(17).Width = Unit.Pixel(70)
|
|
|
|
' e.Row.Cells(18).Width = Unit.Pixel(60)
|
|
' e.Row.Cells(19).Width = Unit.Pixel(60)
|
|
' e.Row.Cells(20).Width = Unit.Pixel(120)
|
|
|
|
' e.Row.Cells(21).Width = Unit.Pixel(60)
|
|
' e.Row.Cells(22).Width = Unit.Pixel(60)
|
|
End If
|
|
|
|
If e.Row.DBCampo("Respuesta") = "" AndAlso e.Row.DBCampo("Agrupador") <> "" Then
|
|
e.Row.CssClass = "SubTotales"
|
|
e.Row.FCLiteral("LtlRes").Text = "Total"
|
|
Dim Por As Double = e.Row.DBCampo("Total").ToDouble / DirectCast(GvDatos.DataSource, DataTable).SUM("Total", "Agrupador IS NULL ") * 100
|
|
e.Row.FCLiteral("LtlPor").Text = Por.FormatoNumero & "%"
|
|
End If
|
|
|
|
'Dim Liga As String = "<a class=""Texto"" href=""/Prospectos/RepPadronDetalle.aspx"">"
|
|
|
|
'e.Row.FCLiteral("LtlGpo").Text = Liga & e.Row.FCLiteral("LtlGpo").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlCantidad").Text = Liga & e.Row.FCLiteral("LtlCantidad").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlVoto").Text = Liga & e.Row.FCLiteral("LtlVoto").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlRedes").Text = Liga & e.Row.FCLiteral("LtlRedes").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlEstructuras").Text = Liga & e.Row.FCLiteral("LtlEstructuras").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlEventos").Text = Liga & e.Row.FCLiteral("LtlEventos").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlApoyos").Text = Liga & e.Row.FCLiteral("LtlApoyos").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlCrecer").Text = Liga & e.Row.FCLiteral("LtlCrecer").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlCrecerMadreFam").Text = Liga & e.Row.FCLiteral("LtlCrecerMadreFam").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlAhorrando").Text = Liga & e.Row.FCLiteral("LtlAhorrando").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlMejorVivienda").Text = Liga & e.Row.FCLiteral("LtlMejorVivienda").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlViviendaUrbana").Text = Liga & e.Row.FCLiteral("LtlViviendaUrbana").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
''e.Row.FCLiteral("").Text = Liga & e.Row.FCLiteral("").Text & "</a>"
|
|
|
|
''Alineo columnas
|
|
'e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
'For i As Integer = 1 To 22
|
|
' e.Row.Cells(i).HorizontalAlign = HorizontalAlign.Right
|
|
'Next
|
|
|
|
'e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#EEFFAA'")
|
|
'e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;")
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
UPDatos.Update()
|
|
RegistraScript("UpperBound = " & GvDatos.Rows.Count - 1 & ";")
|
|
End Sub
|
|
|
|
Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click
|
|
GvDatos.ExportToExcel("Estructuras")
|
|
End Sub
|
|
End Class
|