Files
SIG/Prospectos/RepEncuestasDetalle.aspx.vb
2023-02-12 21:45:58 -07:00

141 lines
6.2 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports System.Activities.Expressions
Imports Extensiones
Partial Class Prospectos_RepEncuestasDetalle
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
Dim CveMunicipio, Seccion, Sexo, IFE, CveEncuesta, CvePregunta, CveRespuesta As Integer
CveMunicipio = IfNull(Request("CveMunicipio"), "0").ToString.ToEntero
Seccion = IfNull(Request("Seccion"), "0").ToString.ToEntero
Sexo = IfNull(Request("Sexo"), "0").ToString.ToEntero
IFE = IfNull(Request("IFE"), "0").ToString.ToEntero
CveEncuesta = IfNull(Request("CveEncuesta"), "0").ToString.ToEntero
CvePregunta = IfNull(Request("CvePregunta"), "0").ToString.ToEntero
CveRespuesta = IfNull(Request("CveRespuesta"), "0").ToString.ToEntero
If CveMunicipio > 0 Then
Dim dr As DataRow = GlobalDTGralMunicipios("-1", CveEstado:=-1).FiltroPrimero("CveMunicipio =" & CveMunicipio)
If dr IsNot Nothing Then LblMunicipio.Text = dr("Municipio").ToString()
End If
LblSeccion.Text = Seccion.ToString
If Sexo > 0 Then LblSexo.Text = If(Sexo = 1, "Hombre", "Mujer")
If CveEncuesta > 0 Then
Dim dr As DataRow = GlobalDTProspectosEncuestas(UsuarioActual.CveEmpresa).FiltroPrimero("CveEncuesta =" & CveEncuesta)
If dr IsNot Nothing Then LblEncuesta.Text = dr("Encuesta").ToString()
End If
If CvePregunta > 0 Then
Dim dr As DataRow = GlobalDTProspectosEncuestasPreguntas(CveEncuesta, UsuarioActual.CveEmpresa).FiltroPrimero("CvePregunta =" & CvePregunta)
If dr IsNot Nothing Then LblPregunta.Text = dr("Pregunta").ToString()
End If
If CveRespuesta > 0 Then
Dim dr As DataRow = GlobalDTProspectosEncuestasRespuestas(CvePregunta, CveEncuesta, UsuarioActual.CveEmpresa).FiltroPrimero("CveRespuesta =" & CveRespuesta)
If dr IsNot Nothing Then LblRespuesta.Text = dr("Respuesta").ToString()
End If
CargaDatos(CveMunicipio, Seccion, Sexo, IFE, CveEncuesta, CvePregunta, CveRespuesta)
End If
End Sub
Public Sub CargaDatos(CveMunicipio As Integer, Seccion As Integer, Sexo As Integer, IFE As Integer, CveEncuesta As Integer, CvePregunta As Integer, CveRespuesta As Integer)
Dim ObjProspectos As New ClsProspectos
If ObjProspectos.GetRepEncuestasDetalle(CveMunicipio, Seccion, Sexo, IFE, CveEncuesta, CvePregunta, CveRespuesta, UsuarioActual.CveEmpresa) Then
ViewState("DTProspectos") = ObjProspectos.DtResultados
'LtlAgrupador.Text = DdlAgrupador.SelectedItem.Text
Else
Me.GvDatos.DataSource = Nothing
End If
ObjProspectos.Dispose()
LblTotal.Text = String.Format("Registros: {0}", ObjProspectos.DtResultados.Rows.Count)
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("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.DataRow Then
If e.Row.RowIndex = 0 Then
'ElseIf e.Row.RowIndex = 1 Then
' e.Row.Cells(0).Width = Unit.Pixel(120)
' e.Row.Cells(1).Width = Unit.Pixel(60)
' e.Row.Cells(2).Width = Unit.Pixel(60)
' e.Row.Cells(3).Width = Unit.Pixel(60)
' e.Row.Cells(4).Width = Unit.Pixel(70)
' e.Row.Cells(5).Width = Unit.Pixel(60)
' e.Row.Cells(6).Width = Unit.Pixel(60)
' e.Row.Cells(7).Width = Unit.Pixel(70)
' e.Row.Cells(8).Width = Unit.Pixel(100)
' e.Row.Cells(9).Width = Unit.Pixel(80)
' e.Row.Cells(10).Width = Unit.Pixel(105)
' e.Row.Cells(11).Width = Unit.Pixel(100)
' e.Row.Cells(12).Width = Unit.Pixel(100)
' e.Row.Cells(13).Width = Unit.Pixel(110)
' e.Row.Cells(14).Width = Unit.Pixel(100)
' e.Row.Cells(15).Width = Unit.Pixel(80)
' e.Row.Cells(16).Width = Unit.Pixel(70)
' e.Row.Cells(17).Width = Unit.Pixel(70)
' e.Row.Cells(18).Width = Unit.Pixel(60)
' e.Row.Cells(19).Width = Unit.Pixel(60)
' e.Row.Cells(20).Width = Unit.Pixel(120)
' e.Row.Cells(21).Width = Unit.Pixel(60)
' e.Row.Cells(22).Width = Unit.Pixel(60)
End If
End If
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("Estructuras")
End Sub
End Class