-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)
336 lines
15 KiB
VB.net
336 lines
15 KiB
VB.net
|
|
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Prospectos_RepPadron
|
|
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
|
|
CargaFiltros()
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaFiltros()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
|
|
'Municipio
|
|
If ObjProspectos.GetFiltros("Mun") Then
|
|
DdlMunicipio.DataSource = ObjProspectos.DtResultados
|
|
Else
|
|
DdlMunicipio.DataSource = Nothing
|
|
End If
|
|
DdlMunicipio.DataBind()
|
|
DdlMunicipio.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
'Distritos
|
|
Dim DT As DataTable = Nothing
|
|
If ObjProspectos.GetFiltros("Dist") Then
|
|
DT = ObjProspectos.DtResultados
|
|
Else
|
|
DT = Nothing
|
|
End If
|
|
|
|
If DT IsNot Nothing AndAlso DT.Rows.Count > 0 Then
|
|
'Cargo DistLoc
|
|
DdlDistLoc.DataSource = DT.FiltraParametros("", "", {"Dist_Loc"})
|
|
DdlDistLoc.DataBind()
|
|
DdlDistLoc.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
'Cargo Secciones
|
|
DdlSeccion.DataSource = DT.FiltraParametros("", "", {"seccion"})
|
|
DdlSeccion.DataBind()
|
|
DdlSeccion.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
'Cargo DistFed
|
|
DdlDistFed.DataSource = DT.FiltraParametros("", "", {"Dist_Fed"})
|
|
DdlDistFed.DataBind()
|
|
DdlDistFed.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
End If
|
|
If DT IsNot Nothing Then DT.Dispose()
|
|
|
|
'Ocupacion
|
|
If ObjProspectos.GetFiltros("Ocupacion") Then
|
|
DdlOcupacion.DataSource = ObjProspectos.DtResultados
|
|
Else
|
|
DdlOcupacion.DataSource = Nothing
|
|
End If
|
|
DdlOcupacion.DataBind()
|
|
DdlOcupacion.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
ObjProspectos.Dispose()
|
|
|
|
'
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
If ObjProspectos.GetRepPadron(DdlMunicipio.SelectedValue.ToEntero, DdlDistFed.SelectedValue.ToEntero, DdlDistLoc.SelectedValue.ToEntero, DdlSeccion.SelectedValue.ToEntero, DdlOcupacion.SelectedValue, DdlAgrupador.SelectedValue.ToEntero) Then
|
|
If DdlAgrupador.SelectedValue = "2" OrElse DdlAgrupador.SelectedValue = "3" OrElse DdlAgrupador.SelectedValue = "4" Then
|
|
Dim DT As DataTable = ObjProspectos.DtResultados
|
|
|
|
DT.Columns.Add("int_agrupador", GetType(Integer))
|
|
|
|
For Each Row As DataRow In DT.Rows
|
|
Row("int_agrupador") = GetNumber(Row("agrupador").ToString)
|
|
Next
|
|
DT = DT.FiltraParametros("", "int_agrupador")
|
|
ViewState("DTProspectos") = DT
|
|
|
|
If DT IsNot Nothing Then DT.Dispose()
|
|
Else
|
|
ViewState("DTProspectos") = ObjProspectos.DtResultados
|
|
End If
|
|
|
|
|
|
|
|
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 Function GetNumber(Str As String) As Integer
|
|
Dim Result As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match(Str, "\d+")
|
|
Return Result.Value.ToEntero
|
|
End Function
|
|
|
|
|
|
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.Header Then
|
|
Dim FC1 As New SortedList
|
|
FC1.Add(0, "Sexo,1,1")
|
|
FC1.Add(1, "Redes,1,1,Titulos")
|
|
FC1.Add(2, "Estructura,1,1,Titulos")
|
|
FC1.Add(3, "Eventos,1,1,Titulos")
|
|
FC1.Add(4, "Apoyos,1,1,Titulos")
|
|
FC1.Add(5, "Total,1,1,BorderR")
|
|
FC1.Add(6, "CRECER,1,1,Titulos")
|
|
FC1.Add(7, "CRECER Madre Fam.,1,1,Titulos")
|
|
FC1.Add(8, "Ahorrando,1,1,Titulos")
|
|
FC1.Add(9, "Mejor vivienda,1,1,Titulos")
|
|
FC1.Add(10, "Vivienda Urbana,1,1,Titulos")
|
|
FC1.Add(11, "Seguro Popular,1,1,Titulos")
|
|
FC1.Add(12, "FOVISSSTESON,1,1,BorderR")
|
|
FC1.Add(13, "Honorarios GES,1,1,Titulos")
|
|
FC1.Add(14, "ISSSTESON,1,1,Titulos")
|
|
FC1.Add(15, "Nómina GES,1,1,Titulos")
|
|
FC1.Add(16, "Nómina SEC,1,1,BorderR")
|
|
FC1.Add(17, "Licencia,1,1,Titulos")
|
|
FC1.Add(18, "Placas,1,1,Titulos")
|
|
FC1.Add(19, "Org. Descentralizados,1,1,BorderR")
|
|
FC1.Add(20, "TELMEX,1,1,Titulos")
|
|
FC1.Add(21, "Mail,1,1,BorderR")
|
|
FC1.Add(22, "P1 Plus,1,1,Titulos")
|
|
FC1.Add(23, "P1,1,1,BorderR")
|
|
FC1.Add(24, "A,1,1,Titulos")
|
|
FC1.Add(25, "AA,1,1,Titulos")
|
|
FC1.Add(26, "AAA,1,1,Titulos")
|
|
FC1.Add(27, "OP/252,1,1,Titulos")
|
|
FC1.Add(28, "PRD,1,1,Titulos")
|
|
FC1.Add(29, "R,1,1,Titulos")
|
|
FC1.Add(30, "RESECC,1,1,Titulos")
|
|
FC1.Add(31, "SR,1,1,Titulos")
|
|
|
|
GetMultiRowHeader(e, FC1, "Titulos")
|
|
|
|
Dim FC As New SortedList
|
|
FC.Add(0, " Agrupador,1,1,Titulos")
|
|
FC.Add(1, "Cantidad,1,2,Titulos")
|
|
FC.Add(2, "Votaron,1,2,BorderR")
|
|
FC.Add(3, "Equipo J.G.M.,5,1,BorderR")
|
|
FC.Add(4, "Programas del Gobierno,7,1,BorderR")
|
|
FC.Add(5, "Nóminas del Gobierno,4,1,BorderR")
|
|
FC.Add(6, "Otros,3,1,BorderR")
|
|
FC.Add(7, "Contacto,2,1,BorderR")
|
|
FC.Add(8, "Gob,2,1,BorderR")
|
|
FC.Add(9, "252,8,1,BorderR")
|
|
|
|
GetMultiRowHeader(e, FC, "Titulos")
|
|
|
|
End If
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.CssClass = "SubTotales"
|
|
e.Row.FCLiteral("LtlGpo").Text = "Total"
|
|
'Ligas
|
|
e.Row.FCLiteral("LtlRedes").Text = "<a class=""Texto"" href=""/Prospectos/RepProspectosRedes.aspx"">" & e.Row.FCLiteral("LtlRedes").Text & "</a>"
|
|
e.Row.FCLiteral("LtlEstructuras").Text = "<a class=""Texto"" href=""/Prospectos/RepRedesEstructuras.aspx"">" & e.Row.FCLiteral("LtlEstructuras").Text & "</a>"
|
|
e.Row.FCLiteral("LtlEventos").Text = "<a class=""Texto"" href=""/Prospectos/RepEventos.aspx"">" & e.Row.FCLiteral("LtlEventos").Text & "</a>"
|
|
ElseIf e.Row.RowIndex = 1 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(120) 'Gpo
|
|
e.Row.Cells(1).Width = Unit.Pixel(60) 'Cantidad
|
|
e.Row.Cells(2).Width = Unit.Pixel(60) 'Votaron
|
|
|
|
'JGM
|
|
e.Row.Cells(3).Width = Unit.Pixel(60) 'Redes
|
|
e.Row.Cells(4).Width = Unit.Pixel(70) 'Estructuras
|
|
e.Row.Cells(5).Width = Unit.Pixel(60) 'Eventos
|
|
e.Row.Cells(6).Width = Unit.Pixel(60) 'Apoyos
|
|
e.Row.Cells(7).Width = Unit.Pixel(60) 'Total
|
|
|
|
'Programas del Gobierno
|
|
e.Row.Cells(8).Width = Unit.Pixel(70) 'CRECER
|
|
e.Row.Cells(9).Width = Unit.Pixel(100) 'CRECER Madre Fam
|
|
e.Row.Cells(10).Width = Unit.Pixel(80) 'Ahorrando
|
|
e.Row.Cells(11).Width = Unit.Pixel(105) 'Mejor Vivienda
|
|
e.Row.Cells(12).Width = Unit.Pixel(100) 'Vivienda Urbana
|
|
e.Row.Cells(13).Width = Unit.Pixel(100) 'Seguro Popular
|
|
e.Row.Cells(14).Width = Unit.Pixel(110) 'FOVI
|
|
|
|
'Nóminas del Gobierno
|
|
e.Row.Cells(15).Width = Unit.Pixel(100) 'Honorarios GES
|
|
e.Row.Cells(16).Width = Unit.Pixel(80) 'ISSSTESON
|
|
e.Row.Cells(17).Width = Unit.Pixel(70) 'Nómina GES
|
|
e.Row.Cells(18).Width = Unit.Pixel(70) 'Nómina SEC
|
|
|
|
'Otros
|
|
e.Row.Cells(19).Width = Unit.Pixel(60) ' Licencias
|
|
e.Row.Cells(20).Width = Unit.Pixel(60) 'Placas
|
|
e.Row.Cells(21).Width = Unit.Pixel(120) 'Org. Des
|
|
|
|
'Contactos
|
|
e.Row.Cells(22).Width = Unit.Pixel(60) 'Telmex
|
|
e.Row.Cells(23).Width = Unit.Pixel(60) 'Mail
|
|
|
|
''Clasificaciones
|
|
'e.Row.Cells(24).Width = Unit.Pixel(60) 'P1 Plus
|
|
'e.Row.Cells(25).Width = Unit.Pixel(60) 'P1
|
|
'e.Row.Cells(26).Width = Unit.Pixel(60) 'A
|
|
'e.Row.Cells(27).Width = Unit.Pixel(60) 'AA
|
|
'e.Row.Cells(28).Width = Unit.Pixel(60) 'AAA
|
|
'e.Row.Cells(29).Width = Unit.Pixel(60) '252
|
|
'e.Row.Cells(30).Width = Unit.Pixel(60) 'PRD
|
|
'e.Row.Cells(31).Width = Unit.Pixel(60) 'R
|
|
'e.Row.Cells(32).Width = Unit.Pixel(60) 'RESECC
|
|
'e.Row.Cells(33).Width = Unit.Pixel(60) 'SR
|
|
|
|
End If
|
|
|
|
If e.Row.FCLiteral("LtlGpo").Text = "0" Then
|
|
e.Row.BackColor = Drawing.Color.LightGray
|
|
e.Row.FCLiteral("LtlGpo").Text = "SIN PADRÓN"
|
|
End If
|
|
|
|
If e.Row.RowIndex > 0 Then
|
|
e.Row.FCLiteral("LtlRedes").Text = "" : e.Row.FCLiteral("LtlEventos").Text = "" : e.Row.FCLiteral("LtlEstructuras").Text = ""
|
|
e.Row.FCLiteral("LtlTotalJGM").Text = ""
|
|
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("Padron", TbEncabezado)
|
|
End Sub
|
|
|
|
'Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMunicipio.SelectedIndexChanged
|
|
' Dim DT As DataTable = CType(ViewState("Distritos"), DataTable)
|
|
' DT = DT.FiltraParametros("Municipio = " & DdlMunicipio.SelectedValue, "", {"Dist_Fed"})
|
|
' DdlDistFed.DataSource = DT
|
|
' DdlDistFed.DataBind()
|
|
' DdlDistFed.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
' If DT IsNot Nothing Then DT.Dispose()
|
|
'End Sub
|
|
|
|
'Protected Sub DdlDistFed_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDistFed.SelectedIndexChanged
|
|
' Dim DT As DataTable = CType(ViewState("Distritos"), DataTable)
|
|
' DT = DT.FiltraParametros("Dist_Fed = " & DdlDistFed.SelectedValue, "", {"Dist_Loc"})
|
|
' DdlDistLoc.DataSource = DT
|
|
' DdlDistLoc.DataBind()
|
|
' DdlDistLoc.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
' If DT IsNot Nothing Then DT.Dispose()
|
|
'End Sub
|
|
|
|
'Protected Sub DdlDistLoc_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDistLoc.SelectedIndexChanged
|
|
' Dim DT As DataTable = CType(ViewState("Distritos"), DataTable)
|
|
' DT = DT.FiltraParametros("Dist_Loc = " & DdlDistLoc.SelectedValue, "", {"seccion"})
|
|
' DdlSeccion.DataSource = DT
|
|
' DdlSeccion.DataBind()
|
|
' DdlSeccion.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
' If DT IsNot Nothing Then DT.Dispose()
|
|
'End Sub
|
|
|
|
End Class
|