-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)
96 lines
4.4 KiB
VB.net
96 lines
4.4 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Prospectos_RepEventos
|
|
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.GetRepEventos Then
|
|
ViewState("DTEventos") = ObjProspectos.DtResultados
|
|
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("DTEventos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
|
GvDatos.DataSource = DV.ToTable()
|
|
DV.Dispose()
|
|
Else
|
|
GvDatos.DataSource = CType(ViewState("DTEventos"), 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 = "Totales"
|
|
e.Row.FCLiteral("LtlEvento").Text = "Total General"
|
|
End If
|
|
|
|
If e.Row.DBCampo("EventoTipo") <> String.Empty AndAlso e.Row.DBCampo("Municipio") = String.Empty Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
e.Row.FCLiteral("LtlEvento").Text = " Evento: " & e.Row.DBCampo("EventoTipo")
|
|
' e.Row.Cells(1).Visible = False : e.Row.Cells(0).ColumnSpan = 2
|
|
ElseIf e.Row.DBCampo("EventoTipo") <> String.Empty AndAlso e.Row.DBCampo("Municipio") <> String.Empty AndAlso e.Row.DBCampo("Evento") = String.Empty Then
|
|
e.Row.CssClass = "SubTotales"
|
|
e.Row.FCLiteral("LtlEvento").Text = " Municipio: " & e.Row.DBCampo("Municipio")
|
|
' e.Row.Cells(1).Visible = False : e.Row.Cells(0).ColumnSpan = 2
|
|
ElseIf e.Row.DBCampo("EventoTipo") <> String.Empty AndAlso e.Row.DBCampo("Municipio") <> String.Empty AndAlso e.Row.DBCampo("Evento") <> String.Empty Then
|
|
'e.Row.CssClass = "Texto"
|
|
e.Row.FCLiteral("LtlEvento").Text = " " & e.Row.DBCampo("Evento")
|
|
Dim Liga As String = String.Format("<a class=""Texto"" href=""/Prospectos/RepEventosDetalle.aspx?CveEvento={0}"">", e.Row.DBCampo("CveEvento"))
|
|
'e.Row.FCLiteral("LtlEvento").Text = Liga & e.Row.FCLiteral("LtlEvento").Text & "</a>"
|
|
e.Row.FCLiteral("LtlNumAsistentes").Text = Liga & e.Row.FCLiteral("LtlNumAsistentes").Text & "</a>"
|
|
e.Row.FCLiteral("LtlFechaEvento").Text = Liga & e.Row.FCLiteral("LtlFechaEvento").Text & "</a>"
|
|
End If
|
|
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
|
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("RepEventos")
|
|
End Sub
|
|
|
|
End Class
|
|
|