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

179 lines
7.7 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class Prospectos_CatProspectosG15
Inherits ClsPaginas
Private Property DtDatos As DataTable
Get
Return DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property CveProspectoSeleccionado As Integer
Get
Return ViewState("CveProspectoSeleccionado").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveProspectoSeleccionado") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ViewState("Orden") = ""
CveProspectoSeleccionado = -1 'UsuarioActual.CveProspecto
DdlTipoEvento.DataSource = GlobalDTProspectosEventosTipo(UsuarioActual.CveEmpresa) : DdlTipoEvento.DataBind()
DdlEvento.DataSource = GlobalDTProspectosEvento(DdlTipoEvento.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlEvento.DataBind()
DdlResponsable.DataSource = GlobalDTProspectosSupervisores(UsuarioActual.CveEmpresa) : DdlResponsable.DataBind()
DdlPromotor.DataSource = GlobalDTProspectosCoordinadores(DdlResponsable.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlPromotor.DataBind()
CargaDatos()
ImgPersonalizar.Attributes.Add("onclick", "$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
End If
End Sub
Public Sub CargaDatos()
Dim ObjProspectos As New ClsProspectos
If ObjProspectos.GetProspectos(-1, "-1", "-1", DdlTipoEvento.SelectedValue.ToEntero, DdlEvento.SelectedValue.ToEntero, -1, DdlResponsable.SelectedValue.ToEntero, DdlPromotor.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then
ViewState("DTProspectos") = ObjProspectos.DtResultados
Else
Me.GvDatos.DataSource = Nothing
End If
Dim InicioPadre As Integer = 0
If CveProspectoSeleccionado > 0 Then
InicioPadre = CveProspectoSeleccionado
'Dim node As New TreeNode
'node.Text = String.Format("<span>{0} ({1})</span>", dr("NombreCompleto"), dr("Hijos"))
'node.Value = dr("CveProspecto").ToString
'AddNodes(node)
'TV.Nodes.Add(node)
End If
ObjProspectos.Dispose()
UPDatos.Update()
If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid(ViewState("Orden").ToString())
Else
CargaGrid("")
End If
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_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.Cells(0).Width = Unit.Pixel(250)
'e.Row.Cells(1).Width = Unit.Pixel(100)
'e.Row.Cells(2).Width = Unit.Pixel(180)
'e.Row.Cells(3).Width = Unit.Pixel(100)
'e.Row.Cells(4).Width = Unit.Pixel(60)
'e.Row.Cells(5).Width = Unit.Pixel(220)
'e.Row.Cells(6).Width = Unit.Pixel(100)
'e.Row.Cells(7).Width = Unit.Pixel(50)
'e.Row.Cells(8).Width = Unit.Pixel(100)
e.Row.Cells(9).Width = Unit.Pixel(150)
'e.Row.Cells(10).Width = Unit.Pixel(100)
End If
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
If e.Row.DBCampo("FueAuditado") = "0" Then
e.Row.FCLiteral("LtlVerificador").Text = "Sin verificar"
ElseIf e.Row.DBCampo("FueAuditado") = "1" Then
e.Row.FCLiteral("LtlVerificador").Text = "Verificado Negativo"
ElseIf e.Row.DBCampo("FueAuditado") = "2" Then
e.Row.FCLiteral("LtlVerificador").Text = "Verificado Positivo"
End If
'e.Row.FCLiteral("LtlTelefono").Text = "<a class=""Texto"" href=""/Ventas/Clientes.aspx?CveCliente=" & e.Row.DBCampo("CveCliente") & """>" & e.Row.FCLiteral("LtlTelefono").Text & "</a>"
End If
End Sub
'Protected Sub LnkDatos_Click(sender As Object, e As EventArgs) Handles LnkDatos.Click
' PnlDatos.Visible = True
' PnlArbol.Visible = False
'End Sub
'Protected Sub LnkArbol_Click(sender As Object, e As EventArgs) Handles LnkArbol.Click
' PnlDatos.Visible = False
' PnlArbol.Visible = True
'End Sub
Protected Sub BtnPersonalizar_Click(sender As Object, e As System.EventArgs) Handles BtnPersonalizar.Click
GvDatos.Columns(0).Visible = ChkNombreCompleto.Checked
GvDatos.Columns(1).Visible = ChkApellidoPaterno.Checked
GvDatos.Columns(2).Visible = ChkApellidoMaterno.Checked
GvDatos.Columns(3).Visible = ChkNombres.Checked
GvDatos.Columns(4).Visible = ChkEdad.Checked
GvDatos.Columns(5).Visible = ChkFechaNacimiento.Checked
GvDatos.Columns(6).Visible = ChkLugarNacimiento.Checked
GvDatos.Columns(7).Visible = ChkEscolaridad.Checked
GvDatos.Columns(8).Visible = ChkEstadoCivil.Checked
GvDatos.Columns(9).Visible = ChkEvento.Checked
GvDatos.Columns(10).Visible = ChkIFE.Checked
GvDatos.Columns(11).Visible = ChkSeccion.Checked
GvDatos.Columns(12).Visible = ChkResponsable.Checked
GvDatos.Columns(13).Visible = ChkPromotor.Checked
GvDatos.Columns(14).Visible = ChkDependientes.Checked
GvDatos.Columns(15).Visible = ChkCalle.Checked
GvDatos.Columns(16).Visible = ChkNumero.Checked
GvDatos.Columns(17).Visible = ChkEntre.Checked
GvDatos.Columns(18).Visible = ChkColonia.Checked
GvDatos.Columns(19).Visible = ChkMunicipio.Checked
GvDatos.Columns(20).Visible = ChkFueAuditado.Checked
GvDatos.Columns(21).Visible = ChkEstado.Checked
GvDatos.Columns(22).Visible = ChkTelefono.Checked
GvDatos.Columns(23).Visible = ChkCelular.Checked
GvDatos.Columns(24).Visible = ChkCorreo.Checked
GvDatos.Columns(25).Visible = ChkFechaIng.Checked
UPDatos.Update()
CargaDatos()
End Sub
Protected Sub DdlTipoEvento_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoEvento.SelectedIndexChanged
DdlEvento.Items.Clear()
DdlEvento.Items.Add(New ListItem("Todos", "-1"))
DdlEvento.DataSource = GlobalDTProspectosEvento(DdlTipoEvento.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlEvento.DataBind()
End Sub
Protected Sub DdlResponsable_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlResponsable.SelectedIndexChanged
DdlPromotor.Items.Clear()
DdlPromotor.Items.Add(New ListItem("Todos", "-1"))
DdlPromotor.DataSource = GlobalDTProspectosCoordinadores(DdlResponsable.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlPromotor.DataBind()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Protected Sub ImgExcel_Click(sender As Object, e As ImageClickEventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("Listado")
End Sub
End Class