Files
SIG/ZDG/PopUpBuscarMilitante.aspx.vb
MLopez 5f5cfdd48d Limpiar DtColor redundante
-Se estaba creando un DataTable cuando solo se ocupa un String[]
-Se metió a ClsPaginas, esto limpia bastante el código
2023-02-04 15:22:55 -07:00

165 lines
5.1 KiB
VB.net

Option Explicit On
Option Strict On
Imports Extensiones
Imports System.Data
Partial Class ZDG_PopUpBuscarMilitante
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CType(Me.Master, BaseMasterPage).EsPopup = True
CargaCombos()
End If
End Sub
#Region " CARGA COMBOS "
Private Sub CargaCombos()
Dim ObjDG As New ClsDG
'CARGA MUNICIPIOS
If ObjDG.GetMunicipios() Then
DdlMunicipio.DataSource = ObjDG.DtResultados
Else
DdlMunicipio.DataSource = Nothing
End If
ObjDG.Dispose()
DdlMunicipio.DataBind()
End Sub
#End Region
#Region " CARGA DATOS "
Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click
'VALIDA QUE ESTE CON VALOR MINIMO UN FILTRO
If TxtRNM.Text.Trim = "" And TxtNombre.Text.Trim = "" And TxtPaterno.Text.Trim = "" And TxtMaterno.Text.Trim = "" And DdlMunicipio.SelectedValue.ToEntero < 0 And DdlCoordinadores.SelectedValue.ToEntero < 0 And DdlLideres.SelectedValue.ToEntero < 0 And DdlMovilizadores.SelectedValue.ToEntero < 0 Then
Alert("Debe especificar mínimo un filtro para la busqueda. Por favor rectifique y vuleva a intentar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
CargaDatos()
End Sub
Private Sub CargaDatos()
Dim ObjDG As New ClsDG
If ObjDG.GetMilitantes(TxtRNM.Text.Trim, TxtNombre.Text.Trim.Replace(" ", "%"), TxtPaterno.Text.Trim.Replace(" ", "%"), TxtMaterno.Text.Trim.Replace(" ", "%"), DdlMunicipio.SelectedValue.ToEntero, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, DdlMovilizadores.SelectedValue) Then
GvDatos.DataSource = ObjDG.DtResultados
Else
GvDatos.DataSource = Nothing
End If
LbNumeroRegistros.Text = String.Format("Numero de registros: <b>{0}</b>", ObjDG.DtResultados.Rows.Count)
ObjDG.Dispose()
GvDatos.DataBind()
If (GvDatos.Rows.Count > 0) Then
GvDatos.UseAccessibleHeader = True
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
End If
UpDatos.Update()
End Sub
#End Region
#Region " GV DATOS "
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.DBCampo("Voto") = "True" Then
e.Row.Cells(10).ForeColor = Drawing.Color.Green
Else
e.Row.Cells(10).ForeColor = Drawing.Color.Red
End If
End If
End Sub
#End Region
#Region " SELECTED INDEX CHANGED "
Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ObjDG As New ClsDG
DdlCoordinadores.Items.Clear()
'CARGA COORDINADORES
If ObjDG.GetCoordinadores("-1", DdlMunicipio.SelectedValue.ToEntero) Then
DdlCoordinadores.DataSource = ObjDG.DtResultados
Else
DdlCoordinadores.DataSource = Nothing
End If
DdlCoordinadores.DataBind()
ObjDG.Dispose()
DdlCoordinadores.Items.Insert(0, New ListItem("Todos", "-2"))
DdlCoordinadores.SelectedValueExist("-2")
DdlLideres.Items.Clear()
DdlLideres.Items.Insert(0, New ListItem("Todos", "-2"))
DdlLideres.SelectedValueExist("-2")
DdlMovilizadores.Items.Clear()
DdlMovilizadores.Items.Insert(0, New ListItem("Todos", "-2"))
DdlMovilizadores.SelectedValueExist("-2")
End Sub
Protected Sub DdlCoordinadores_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ObjDG As New ClsDG
DdlLideres.Items.Clear()
'CARGA LIDERES
If ObjDG.GetLideres("-1", DdlMunicipio.SelectedValue.ToEntero, DdlCoordinadores.SelectedValue) Then
DdlLideres.DataSource = ObjDG.DtResultados
Else
DdlLideres.DataSource = Nothing
End If
DdlLideres.DataBind()
ObjDG.Dispose()
DdlLideres.Items.Insert(0, New ListItem("Todos", "-2"))
DdlLideres.SelectedValueExist("-2")
DdlMovilizadores.Items.Clear()
DdlMovilizadores.Items.Insert(0, New ListItem("Todos", "-2"))
DdlMovilizadores.SelectedValueExist("-2")
End Sub
Protected Sub DdlLideres_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ObjDG As New ClsDG
DdlMovilizadores.Items.Clear()
'CARGA MOVILIZADORES
If ObjDG.GetMovilizadores("-1", DdlMunicipio.SelectedValue.ToEntero, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue) Then
DdlMovilizadores.DataSource = ObjDG.DtResultados
Else
DdlMovilizadores.DataSource = Nothing
End If
DdlMovilizadores.DataBind()
ObjDG.Dispose()
DdlMovilizadores.Items.Insert(0, New ListItem("Todos", "-2"))
DdlMovilizadores.SelectedValueExist("-2")
End Sub
#End Region
End Class