Option Explicit On Option Strict On Imports System.Data Imports Extensiones Partial Class ZDG_RepMunicipiosSeguimientoDetalle 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 #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 ObjDG.Dispose() DdlMunicipio.DataBind() DdlCoordinadores.DataBind() DdlLideres.DataBind() End Sub Private Sub SetValues() DdlMunicipio.SelectedValueExist(CveMunicipio) DdlCoordinadores.SelectedValueExist(CveCoordinador) End Sub #End Region #Region " CARGA PARAMETROS URL " Private Sub CargaParametrosUrl() CveMunicipio = IfNull(Request("CM"), "-1").ToString().ToEntero CveCoordinador = IfNull(Request("CC"), "-1").ToString() 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.GetRepMunicipiosLideres(DdlMunicipio.SelectedValue.ToEntero, DdlCoordinadores.SelectedValue, DdlLideres.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("Lider") = " TOTAL" Then e.Row.CssClass = "SubTotales2 sinlink" e.Row.Font.Italic = True e.Row.Attributes.Add("style", "background:#CCCCCC !important") Else e.Row.FCHyperLink("HLLider").NavigateUrl = String.Format("/ZDG/RepMunicipiosMovilizadores.aspx?CM={0}&CC={1}&CL={2}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, e.Row.DBCampo("CveLider")) e.Row.FCHyperLink("HLTelefono").NavigateUrl = String.Format("/ZDG/RepMunicipiosMovilizadores.aspx?CM={0}&CC={1}&CL={2}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, e.Row.DBCampo("CveLider")) e.Row.FCHyperLink("HLFaltanPorVotar").NavigateUrl = String.Format("/ZDG/RepMunicipiosMovilizadores.aspx?CM={0}&CC={1}&CL={2}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, e.Row.DBCampo("CveLider")) e.Row.FCHyperLink("HLYaVotaron").NavigateUrl = String.Format("/ZDG/RepMunicipiosMovilizadores.aspx?CM={0}&CC={1}&CL={2}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, e.Row.DBCampo("CveLider")) e.Row.FCHyperLink("HLAvance").NavigateUrl = String.Format("/ZDG/RepMunicipiosMovilizadores.aspx?CM={0}&CC={1}&CL={2}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, e.Row.DBCampo("CveLider")) e.Row.FCHyperLink("HLAsignados").NavigateUrl = String.Format("/ZDG/RepMunicipiosMovilizadores.aspx?CM={0}&CC={1}&CL={2}", DdlMunicipio.SelectedValue, DdlCoordinadores.SelectedValue, e.Row.DBCampo("CveLider")) 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") 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") CargaDatos() End Sub Protected Sub DdlLideres_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("ReporteMunicipiosLideres") GvDatos.Columns(4).Visible = False GvDatos.Columns(5).Visible = True End Sub End Class