-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)
153 lines
7.1 KiB
VB.net
153 lines
7.1 KiB
VB.net
|
|
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Prospectos_RepRedesEstructuras
|
|
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
|
|
|
|
DdlEncuesta.DataSource = GlobalDTProspectosEncuestas(UsuarioActual.CveEmpresa)
|
|
DdlEncuesta.DataBind()
|
|
|
|
DdlPreguntas.DataSource = GlobalDTProspectosEncuestasPreguntas(DdlEncuesta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
|
|
DdlPreguntas.DataBind()
|
|
|
|
DdlRespuestas.DataSource = GlobalDTProspectosEncuestasRespuestas(DdlPreguntas.SelectedValue.ToEntero, DdlEncuesta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
|
|
DdlRespuestas.DataBind()
|
|
DdlRespuestas.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
|
|
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
If ObjProspectos.GetRepEncuestas(DdlMunicipio.SelectedValue.ToEntero, DdlSeccion.SelectedValue.ToEntero, DdlSexo.SelectedValue.ToEntero, DdlIFE.SelectedValue.ToEntero, DdlEncuesta.SelectedValue.ToEntero, DdlPreguntas.SelectedValue.ToEntero, DdlRespuestas.SelectedValue.ToEntero, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
ViewState("DTProspectos") = ObjProspectos.DtResultados
|
|
'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 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
|
|
e.Row.CssClass = "SubTotales2"
|
|
e.Row.FCLiteral("LtlGpo").Text = "Total General"
|
|
e.Row.FCLiteral("LtlPor").Text = ""
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
|
|
'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
|
|
|
|
If e.Row.DBCampo("Respuesta") = "" AndAlso e.Row.DBCampo("Agrupador") <> "" Then
|
|
e.Row.CssClass = "SubTotales"
|
|
e.Row.FCLiteral("LtlRes").Text = "Total"
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
|
|
Dim Por As Double = e.Row.DBCampo("Total").ToDouble / DirectCast(GvDatos.DataSource, DataTable).SUM("Total", "Agrupador IS NULL ") * 100
|
|
e.Row.FCLiteral("LtlPor").Text = Por.FormatoNumero & "%"
|
|
End If
|
|
|
|
e.Row.FCHyperLink("LtlCantidad").NavigateUrl = String.Format("/Prospectos/RepEncuestasDetalle.aspx?CveMunicipio={0}&Seccion={1}&Sexo={2}&IFE={3}&CveEncuesta={4}&CvePregunta={5}&CveRespuesta={6}",
|
|
e.Row.DBCampo("CveMunicipio"), e.Row.DBCampo("Seccion"), e.Row.DBCampo("Sexo"), e.Row.DBCampo("IFE"), e.Row.DBCampo("CveEncuesta"), e.Row.DBCampo("CvePregunta"), e.Row.DBCampo("CveRespuesta"))
|
|
|
|
|
|
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("Estructuras")
|
|
End Sub
|
|
|
|
Protected Sub DdlEncuesta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEncuesta.SelectedIndexChanged
|
|
|
|
DdlPreguntas.DataSource = GlobalDTProspectosEncuestasPreguntas(DdlEncuesta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
|
|
DdlPreguntas.DataBind()
|
|
|
|
DdlRespuestas.DataSource = GlobalDTProspectosEncuestasRespuestas(DdlPreguntas.SelectedValue.ToEntero, DdlEncuesta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
|
|
DdlRespuestas.DataBind()
|
|
DdlRespuestas.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
|
|
End Sub
|
|
|
|
Protected Sub DdlPreguntas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPreguntas.SelectedIndexChanged
|
|
|
|
DdlRespuestas.DataSource = GlobalDTProspectosEncuestasRespuestas(DdlPreguntas.SelectedValue.ToEntero, DdlEncuesta.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
|
|
DdlRespuestas.DataBind()
|
|
DdlRespuestas.Items.Insert(0, New ListItem("Todas", "-1"))
|
|
|
|
End Sub
|
|
End Class
|