Files
SIG/ZDG/RepMunicipiosMovilizadores.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

257 lines
8.9 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class ZDG_RepMunicipiosMovilizadores
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Private Property CveMunicipio As Integer
Get
Return ViewState("CveMunicipio").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveMunicipio") = value
End Set
End Property
Private Property CveCoordinador As String
Get
Return ViewState("CveCoordinador").ToString
End Get
Set(value As String)
ViewState("CveCoordinador") = value
End Set
End Property
Private Property CveLider As String
Get
Return ViewState("CveLider").ToString
End Get
Set(value As String)
ViewState("CveLider") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaParametrosUrl()
CargaCombos()
SetValues()
CargaDatos()
End If
End Sub
#Region " SET VALUES "
Private Sub CargaCombos()
Dim ObjDG As New ClsDG
'CARGA MUNICIPIOS
If ObjDG.GetMunicipios() Then
DdlMunicipio.DataSource = ObjDG.DtResultados
Else
DdlMunicipio.DataSource = Nothing
End If
'CARGA COORDINADORES
If ObjDG.GetCoordinadores("-1", CveMunicipio) Then
DdlCoordinadores.DataSource = ObjDG.DtResultados
Else
DdlCoordinadores.DataSource = Nothing
End If
'CARGA LIDERES
If ObjDG.GetLideres("-1", CveMunicipio, CveCoordinador) Then
DdlLideres.DataSource = ObjDG.DtResultados
Else
DdlLideres.DataSource = Nothing
End If
'CARGA MOVILIZADORES
If ObjDG.GetMovilizadores("-1", CveMunicipio, CveCoordinador, CveLider) Then
DdlMovilizadores.DataSource = ObjDG.DtResultados
Else
DdlMovilizadores.DataSource = Nothing
End If
ObjDG.Dispose()
DdlMunicipio.DataBind()
DdlCoordinadores.DataBind()
DdlLideres.DataBind()
DdlMovilizadores.DataBind()
End Sub
Private Sub SetValues()
DdlMunicipio.SelectedValueExist(CveMunicipio)
DdlCoordinadores.SelectedValueExist(CveCoordinador)
DdlLideres.SelectedValueExist(CveLider)
End Sub
#End Region
#Region " CARGA PARAMETROS URL "
Private Sub CargaParametrosUrl()
CveMunicipio = IfNull(Request("CM"), "-1").ToString().ToEntero
CveCoordinador = IfNull(Request("CC"), "-1").ToString()
CveLider = IfNull(Request("CL"), "-1").ToString()
DdlMunicipio.SelectedValueExist(CveMunicipio)
DdlCoordinadores.SelectedValueExist(CveCoordinador)
DdlLideres.SelectedValueExist(CveLider)
End Sub
#End Region
#Region " CARGA DATOS "
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Private Sub CargaDatos()
Dim ObjDG As New ClsDG
If ObjDG.GetRepMunicipiosMovilizadores(DdlMunicipio.SelectedValue.ToEntero, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, DdlMovilizadores.SelectedValue) Then
GvDatos.DataSource = ObjDG.DtResultados
Else
GvDatos.DataSource = Nothing
End If
ObjDG.Dispose()
GvDatos.DataBind()
If (GvDatos.Rows.Count > 0) Then
GvDatos.UseAccessibleHeader = True
GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
End If
GvDatos.Columns(4).Visible = False
GvDatos.Columns(5).Visible = True
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("Movilizador") = " TOTAL" Then
e.Row.CssClass = "SubTotales2 sinlink"
e.Row.Font.Italic = True
e.Row.Attributes.Add("style", "background:#CCCCCC !important")
Else
e.Row.FCHyperLink("HLMovilizador").NavigateUrl = String.Format("/ZDG/RepMunicipiosMilitantes.aspx?CM={0}&CC={1}&CL={2}&CMO={3}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, e.Row.DBCampo("CveMovilizador"))
e.Row.FCHyperLink("HLTelefono").NavigateUrl = String.Format("/ZDG/RepMunicipiosMilitantes.aspx?CM={0}&CC={1}&CL={2}&CMO={3}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, e.Row.DBCampo("CveMovilizador"))
e.Row.FCHyperLink("HLFaltanPorVotar").NavigateUrl = String.Format("/ZDG/RepMunicipiosMilitantes.aspx?CM={0}&CC={1}&CL={2}&CMO={3}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, e.Row.DBCampo("CveMovilizador"))
e.Row.FCHyperLink("HLYaVotaron").NavigateUrl = String.Format("/ZDG/RepMunicipiosMilitantes.aspx?CM={0}&CC={1}&CL={2}&CMO={3}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, e.Row.DBCampo("CveMovilizador"))
e.Row.FCHyperLink("HLAvance").NavigateUrl = String.Format("/ZDG/RepMunicipiosMilitantes.aspx?CM={0}&CC={1}&CL={2}&CMO={3}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, e.Row.DBCampo("CveMovilizador"))
e.Row.FCHyperLink("HLAsignados").NavigateUrl = String.Format("/ZDG/RepMunicipiosMilitantes.aspx?CM={0}&CC={1}&CL={2}&CMO={3}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, DdlLideres.SelectedValue, e.Row.DBCampo("CveMovilizador"))
End If
CType(e.Row.FindControl("DivAvancePorcentaje"), HtmlContainerControl).Attributes.Add("style", String.Format("height:25px;background-color:cornflowerblue;float:left;width:{0}%;", e.Row.DBCampo("Avance")))
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")
CargaDatos()
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")
CargaDatos()
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")
CargaDatos()
End Sub
Protected Sub DdlMovilizadores_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaDatos()
End Sub
#End Region
Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click
GvDatos.Columns(4).Visible = True
GvDatos.Columns(5).Visible = False
GvDatos.ExportToExcel("ReporteMunicipiosMovilizadores")
GvDatos.Columns(4).Visible = False
GvDatos.Columns(5).Visible = True
End Sub
End Class