578 lines
26 KiB
VB.net
578 lines
26 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Imports System.Runtime.InteropServices
|
|
Imports System.IO
|
|
Imports System.Data
|
|
Imports System.Web.Services
|
|
|
|
Partial Class Prospectos_RedesEncuestas
|
|
Inherits ClsPaginas
|
|
'Confinguración
|
|
|
|
Private Property DTProspectosValores As DataTable
|
|
Get
|
|
Return CType(ViewState("DTProspectosValores"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTProspectosValores") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private ReadOnly Property CveProspecto As Integer
|
|
Get
|
|
Return ViewState("CveProspecto").ToString.ToEntero
|
|
End Get
|
|
End Property
|
|
|
|
Private Property DTProspectosPreguntas As DataTable
|
|
Get
|
|
Return CType(ViewState("DTProspectosPreguntas"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTProspectosPreguntas") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property DTProspectosRespuestas As DataTable
|
|
Get
|
|
Return CType(ViewState("DTProspectosRespuestas"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTProspectosRespuestas") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveEncuesta As Integer
|
|
Get
|
|
Return ViewState("CveEncuesta").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveEncuesta") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
|
|
DdlPaises.DataSource = GlobalDTGralPaises : DdlPaises.DataBind()
|
|
DdlPromotor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) : DdlPromotor.DataBind() ' GlobalDTProspectosCoordinadores(-1, UsuarioActual.CveEmpresa)
|
|
|
|
'CEFechaNacimiento.EndDate = Today
|
|
|
|
CveEncuesta = 2
|
|
TxtApellidoPaterno.Focus()
|
|
|
|
'DdlMunicipios.DataSource = GlobalDTGralMunicipios : DdlMunicipios.DataBind()
|
|
|
|
If Request("CveProspecto") IsNot Nothing AndAlso IsNumeric(Request("CveProspecto")) AndAlso Request("CveProspecto").ToEntero > 0 Then
|
|
ViewState("CveProspecto") = Request("CveProspecto")
|
|
CargaDatos()
|
|
'Configuración de Modalidad Update
|
|
BtnGuardar.Text = "Guardar Cambios"
|
|
LtlTitulo.Text = "Consulta del Prospecto:"
|
|
Else
|
|
CargaEstados(DdlEstados, DdlPaises.SelectedValue.ToEntero)
|
|
DdlEstados.SelectedValue = "26"
|
|
CargaMunicipios(DdlMunicipios, DdlEstados.SelectedValue.ToEntero)
|
|
|
|
ViewState("CveProspecto") = -1
|
|
PnlBusquedaGral.Visible = True
|
|
Me.Form.DefaultButton = BtnBusqueda.UniqueID
|
|
|
|
TxtPaternoB.Attributes.Add("onKeyUp", "SetText(" & TxtPaternoB.ClientID & ", " & TxtApellidoPaterno.ClientID & ")")
|
|
TxtMaternoB.Attributes.Add("onKeyUp", "SetText(" & TxtMaternoB.ClientID & ", " & TxtApellidoMaterno.ClientID & ")")
|
|
TxtNombresB.Attributes.Add("onKeyUp", "SetText(" & TxtNombresB.ClientID & ", " & TxtNombres.ClientID & ")")
|
|
'TxtFechaNacB.Attributes.Add("onKeyUp", "SetText(" & TxtFechaNacB.ClientID & ", " & TxtFechaNacimiento.ClientID & ")")
|
|
TxtPaternoB.Focus()
|
|
End If
|
|
CargaEncuesta()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
If ObjProspectos.GetProspectos(CveProspecto, "-1", "-1", -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
If ObjProspectos.DtResultados.Rows.Count > 0 Then
|
|
TxtCveProspecto.Text = ObjProspectos.CveProspecto.ToString
|
|
TxtApellidoPaterno.Text = ObjProspectos.ApellidoPaterno
|
|
TxtApellidoMaterno.Text = ObjProspectos.ApellidoMaterno
|
|
TxtNombres.Text = ObjProspectos.Nombres
|
|
TxtFechaNacimiento.Text = ObjProspectos.FechaNacimiento.ToString
|
|
|
|
TxtCalle.Text = ObjProspectos.Calle
|
|
TxtNumero.Text = ObjProspectos.Numero
|
|
TxtNumeroInterior.Text = ObjProspectos.NumeroInterior
|
|
TxtEntreCalle1.Text = ObjProspectos.EntreCalle1
|
|
TxtEntreCalle2.Text = ObjProspectos.EntreCalle2
|
|
TxtIFE.Text = ObjProspectos.IFE
|
|
|
|
DdlSexo.SelectedValue = ObjProspectos.Sexo.ToString
|
|
|
|
TxtColonia.Text = ObjProspectos.Colonia
|
|
TxtCodigoPostal.Text = ObjProspectos.CodigoPostal.ToString
|
|
|
|
DdlPaises.SelectedValue = ObjProspectos.CvePais.ToString
|
|
CargaEstados(DdlEstados, DdlPaises.SelectedValue.ToEntero)
|
|
DdlEstados.SelectedValue = ObjProspectos.CveEstado.ToString
|
|
CargaMunicipios(DdlMunicipios, DdlEstados.SelectedValue.ToEntero)
|
|
DdlMunicipios.SelectedValue = ObjProspectos.CveMunicipio.ToString
|
|
TxtSeccion.Text = ObjProspectos.Seccion.ToString()
|
|
|
|
|
|
TxtTelefono.Text = ObjProspectos.Telefono
|
|
TxtCelular.Text = ObjProspectos.Celular
|
|
'TxtFax.Text = ObjProspectos.Fax
|
|
TxtCorreo.Text = ObjProspectos.Correo
|
|
|
|
|
|
|
|
'cveEmpresaPais.Text = ObjProspectos.EmpresaPais
|
|
'TxtEmpresaMunicipio.Text = ObjProspectos.EmpresaMunicipio
|
|
'TxtEmpresaEstado.Text = ObjProspectos.EmpresaEstado
|
|
|
|
|
|
'TxtCveEstatus.Text = ObjProspectos.CveEstatus
|
|
'TxtFechaIng.Text = ObjProspectos.FechaIng
|
|
'TxtCveUsuario.Text = ObjProspectos.CveUsuario
|
|
'TxtCveEmpresa.Text = ObjProspectos.CveEmpresa
|
|
|
|
'Cargar los Valores de las Caractertisticas
|
|
If ObjProspectos.GetProspectosValores(CveProspecto) Then
|
|
ViewState("DTProspectosValores") = ObjProspectos.DtResultados
|
|
End If
|
|
PnlBusquedaGral.Visible = False
|
|
|
|
'Permiso Eliminar
|
|
If UsuarioActual.TienePermisoProceso(78) Then BtnEliminar.Visible = True Else BtnEliminar.Visible = False
|
|
|
|
|
|
End If
|
|
End If
|
|
ObjProspectos.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargaEstados(ddl As DropDownList, CvePais As Integer)
|
|
ddl.DataSource = GlobalDTGralEstados(CvePais.ToString) : ddl.DataBind()
|
|
End Sub
|
|
|
|
Private Sub CargaMunicipios(ddl As DropDownList, CveEstado As Integer)
|
|
ddl.DataSource = GlobalDTGralMunicipios(CveEstado.ToString) : ddl.DataBind()
|
|
End Sub
|
|
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
|
|
|
|
|
|
If CveProspecto = -1 Then
|
|
If TxtEncuestaFecha.Text = "" Then
|
|
Alert("Seleccione la fecha de la encuesta", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim Seccion As Integer = TxtSeccion.Text.Replace("_", "").ToEntero
|
|
If Seccion <= 0 Then
|
|
Alert("Ingrese un sección correcta", TipoMensaje.MsgAdvertencia)
|
|
Exit Sub
|
|
End If
|
|
Dim CveMunicipio As Integer = 0
|
|
|
|
|
|
|
|
If HdnCveProspectoPadre.Value.ToEntero <= 0 Then HdnCveProspectoPadre.Value = "-1"
|
|
|
|
Dim Correcto As Boolean = True
|
|
Dim ObjProspectos As New ClsProspectos
|
|
Dim ObjEncuesta As New ClsProspectos(ObjProspectos.IniciaTransacSQL())
|
|
|
|
Dim Telefono, Celular As String
|
|
Telefono = TxtTelefono.Text.Trim.Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")
|
|
Celular = TxtCelular.Text.Trim.Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")
|
|
|
|
|
|
If Seccion > 0 Then
|
|
'obtengo la clave del municipio en base a su secion
|
|
|
|
CveMunicipio = ObjProspectos.GetMunicipioSeccion(Seccion)
|
|
End If
|
|
|
|
Dim RetValue As Integer = ObjProspectos.AddProspectos(-1, TxtApellidoPaterno.Text.Trim, TxtApellidoMaterno.Text.Trim,
|
|
TxtNombres.Text.Trim, TxtFechaNacimiento.Text.ToDate, "", "", "MEXICANA", DdlSexo.SelectedValue.ToEntero, TxtCalle.Text.Trim,
|
|
TxtNumero.Text.Trim, TxtNumeroInterior.Text.Trim, TxtEntreCalle1.Text.Trim, TxtEntreCalle2.Text.Trim, TxtColonia.Text.Trim, TxtCodigoPostal.Text.Trim.ToEntero, CveMunicipio,
|
|
Telefono, Celular, "", "", TxtCorreo.Text.Trim, "", "", "", -1, 0, 0, "", "", "",
|
|
"", "", "", "", "", 0, "", "", "", "", "", False, "", "", "", "", -1, "", HdnCveProspectoPadre.Value.ToEntero, -1, -1, TxtIFE.Text.Trim, Seccion, -1, -1, "", 0, "", -1, 2, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
If RetValue > 0 OrElse RetValue = -2 Then
|
|
Dim tCveProspecto As Integer = ObjProspectos.CveProspecto
|
|
Dim Actualizar As Boolean = False
|
|
'registro la encuesta
|
|
Dim Clave As Integer = 0
|
|
'verifico si ya existe una encuesta registrada
|
|
If ObjEncuesta.GetEncuestasProspecto(CveEncuesta, tCveProspecto, UsuarioActual.CveEmpresa) Then
|
|
If ObjEncuesta.DtResultados.Rows.Count > 0 Then
|
|
Clave = ObjEncuesta.DtResultados(0)("CveEncuestaRespuesta").ToString.ToEntero
|
|
|
|
Actualizar = True
|
|
|
|
End If
|
|
End If
|
|
If Clave = 0 Then
|
|
Clave = ObjEncuesta.AddEncuestaRespuesta(CveEncuesta, tCveProspecto, TxtEncuestaFecha.Text.ToDate, DdlPromotor.SelectedValue.ToEntero, UsuarioActual.CveUsuario)
|
|
End If
|
|
|
|
|
|
If Clave > 0 Then
|
|
|
|
|
|
For Each gvr As GridViewRow In GvPreguntas.Rows
|
|
|
|
Dim CveOpcion As Integer = -1
|
|
Dim Valor As String = gvr.FCTextBox("TxtValor").Text.Trim
|
|
|
|
Select Case gvr.DataKey("PreguntaTipo")
|
|
Case "1" 'Listado o DropDownList
|
|
CveOpcion = gvr.FCDropDownList("DdlRespuesta").SelectedValue.ToEntero
|
|
Case "2" 'Radio o RadioButtonList
|
|
CveOpcion = gvr.FCRadioButtonList("RbRespuesta").SelectedValue.ToEntero
|
|
End Select
|
|
|
|
|
|
If gvr.DataKey("CvePregunta").ToEntero > 0 Then
|
|
|
|
If Actualizar Then
|
|
If Not ObjEncuesta.UpdateEncuestaRespuestaDetalle(Clave, gvr.DataKey("CvePregunta").ToEntero, CveOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario) Then
|
|
Correcto = False
|
|
Exit For
|
|
End If
|
|
Else
|
|
If Not ObjEncuesta.AddEncuestaRespuestaDetalle(Clave, gvr.DataKey("CvePregunta").ToEntero, CveOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario) Then
|
|
Correcto = False
|
|
Exit For
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Next
|
|
Else
|
|
Correcto = False
|
|
Alert("El Prospecto ya tiene esta encuesta registrada", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
Else
|
|
Correcto = False
|
|
|
|
End If
|
|
|
|
If Correcto Then
|
|
ObjProspectos.Commit()
|
|
Alert("El Prospecto se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Prospectos/RedesEncuestas.aspx"";")
|
|
TxtPaternoB.Text = "" : TxtMaternoB.Text = "" : TxtNombresB.Text = "" : TxtFechaNacB.Text = "" : GvBusq.DataSource = Nothing : GvBusq.DataBind() : TxtFechaNacimiento.Text = ""
|
|
DdlEnDeteccion.SelectedIndex = 0 : TxtApellidoPaterno.Text = "" : TxtApellidoMaterno.Text = "" : TxtNombres.Text = "" : DdlSexo.SelectedIndex = 0
|
|
DdlSexo.SelectedIndex = 0 : TxtTelefono.Text = "" : TxtCelular.Text = "" : TxtCorreo.Text = ""
|
|
TxtCalle.Text = "" : TxtNumero.Text = "" : TxtNumeroInterior.Text = "" : TxtEntreCalle1.Text = "" : TxtEntreCalle2.Text = "" : TxtColonia.Text = "" : TxtCodigoPostal.Text = ""
|
|
DdlPromotor.SelectedIndex = 0 : TxtEncuestaFecha.Text = ""
|
|
Else
|
|
|
|
ObjProspectos.RollBack()
|
|
End If
|
|
|
|
ObjEncuesta.Dispose()
|
|
ObjProspectos.Dispose()
|
|
|
|
|
|
'Else
|
|
|
|
' Dim ObjProspectos As New ClsProspectos
|
|
|
|
' If ObjProspectos.UpdateProspectos(-1, TxtApellidoPaterno.Text.Trim, TxtApellidoMaterno.Text.Trim,
|
|
' TxtNombres.Text.Trim, TxtFechaNacimiento.Text.Trim.ToDate, TxtLugarNacimiento.Text.Trim, "", "MEXICANA", DdlSexo.SelectedValue.ToEntero, TxtCalle.Text.Trim,
|
|
' TxtNumero.Text.Trim, TxtNumeroInterior.Text.Trim, TxtEntreCalle1.Text.Trim, TxtEntreCalle2.Text.Trim, TxtColonia.Text.Trim, TxtCodigoPostal.Text.Trim.ToEntero, DdlMunicipios.SelectedValue.ToEntero,
|
|
' TxtTelefono.Text.Trim, TxtCelular.Text, "", "", TxtCorreo.Text.Trim, "", "", "", -1, 0, 0, "", "", "",
|
|
' "", "", "", "", "", 0, "", "", "", "", "", False, "", "", "", "", -1, "", -1, -1, -1, TxtIFE.Text.Trim, -1, -1, -1, False, "", -1, -1, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProspecto) Then
|
|
|
|
' UpDatos.Update()
|
|
' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
|
' End If
|
|
|
|
' ObjProspectos.Dispose()
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click
|
|
|
|
Dim ObjProspectos As New ClsProspectos()
|
|
If ObjProspectos.RemoveProspectos(CveProspecto) Then
|
|
Alert("El Prospecto se Eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Prospectos/CatProspectos.aspx""")
|
|
End If
|
|
ObjProspectos.Dispose()
|
|
End Sub
|
|
|
|
Protected Sub DdlPaises_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPaises.SelectedIndexChanged
|
|
CargaEstados(DdlEstados, DdlPaises.SelectedValue.ToEntero)
|
|
UPPEstados.Update()
|
|
CargaMunicipios(DdlMunicipios, DdlEstados.SelectedValue.ToEntero)
|
|
UPPMunicipios.Update()
|
|
End Sub
|
|
|
|
Protected Sub DdlEstados_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEstados.SelectedIndexChanged
|
|
CargaMunicipios(DdlMunicipios, DdlEstados.SelectedValue.ToEntero)
|
|
UPPMunicipios.Update()
|
|
End Sub
|
|
|
|
Protected Sub BtnBusqueda_Click(sender As Object, e As EventArgs) Handles BtnBusqueda.Click
|
|
Dim Prosp As New ClsProspectos
|
|
|
|
Dim BusqPaterno As String = TxtPaternoB.Text.Trim.ToUpper.Replace(" ", "%")
|
|
Dim BusqMaterno As String = If(TxtMaternoB.Text.Trim <> "", TxtMaternoB.Text.Trim.ToUpper.Replace(" ", "%") & "%", "-1")
|
|
Dim BusqNombres As String = If(TxtNombresB.Text.Trim <> "", "%" & TxtNombresB.Text.Trim.ToUpper.Replace(" ", "%") & "%", "-1")
|
|
'Busqueda = String.Format("%{0}%", Busqueda.Trim)
|
|
Dim FechaNacimiento As String = "-1"
|
|
If TxtFechaNacB.Text <> String.Empty AndAlso IsDate(TxtFechaNacB.Text) Then FechaNacimiento = TxtFechaNacB.Text.Trim
|
|
If Prosp.GetProspectosBusqueda(BusqPaterno.ToUpper(), BusqMaterno.ToUpper(), BusqNombres.ToUpper(), "-1", FechaNacimiento, -1, -1, -1, -1) Then
|
|
GvBusq.DataSource = Prosp.DtResultados
|
|
End If
|
|
|
|
Prosp.Dispose()
|
|
GvBusq.DataBind()
|
|
|
|
If GvBusq.HeaderRow IsNot Nothing Then GvBusq.HeaderRow.TableSection = TableRowSection.TableHeader : GeneraOrden(GvBusq.ID)
|
|
End Sub
|
|
|
|
Protected Sub LnkClave_Click(sender As Object, e As EventArgs)
|
|
Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
TxtApellidoPaterno.Text = Gvr.DataKey("APaterno")
|
|
TxtApellidoMaterno.Text = Gvr.DataKey("AMaterno")
|
|
TxtNombres.Text = Gvr.DataKey("Nombres")
|
|
'TxtFechaNacimiento.Text = Gvr.DataKey("FechaNacimiento")
|
|
TxtCalle.Text = Gvr.DataKey("Calle")
|
|
TxtNumero.Text = Gvr.DataKey("NumExterior")
|
|
TxtNumeroInterior.Text = Gvr.DataKey("NumInterior")
|
|
TxtColonia.Text = Gvr.DataKey("Colonia")
|
|
TxtCodigoPostal.Text = Gvr.DataKey("CP")
|
|
DdlSexo.SelectedValue = If(Gvr.DataKey("Sexo") = "H", "1", "0")
|
|
TxtIFE.Text = Gvr.DataKey("Clave")
|
|
TxtSeccion.Text = Gvr.DataKey("Seccion")
|
|
TxtFechaNacimiento.Text = Gvr.DataKey("FechaNacimiento").ToDate.ToShortDateString
|
|
DdlMunicipios.SelectedIndex = DdlMunicipios.Items.IndexOf(DdlMunicipios.Items.FindByText(Gvr.DataKey("PadronMunicipio")))
|
|
Alert("Informacion Cargada", TipoMensaje.MsgInformacion)
|
|
Me.cpeDesc.Collapsed = True
|
|
Me.cpeDesc.ClientState = "true"
|
|
Dim tCveProspecto As Integer = Gvr.DataKey("CveProspecto").ToEntero
|
|
|
|
'CargaEncuesta()
|
|
|
|
'Bloqueo controles si lo encontré
|
|
TxtApellidoPaterno.Enabled = False : TxtApellidoMaterno.Enabled = False : TxtNombres.Enabled = False : TxtFechaNacimiento.Enabled = False
|
|
'TxtFechaNacimiento.Enabled = False
|
|
RFVApellidoPaterno.Enabled = False : RFVApellidoMaterno.Enabled = False
|
|
DdlSexo.Enabled = False
|
|
|
|
'detectar si hay una encuesta ya realizada del prospecto
|
|
|
|
If tCveProspecto > 0 Then
|
|
Dim Prosp As New ClsProspectos
|
|
|
|
If Prosp.GetProspectos(tCveProspecto, "-1", "-1", -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
TxtCalle.Text = Prosp.Calle
|
|
TxtNumero.Text = Prosp.Numero
|
|
TxtNumeroInterior.Text = Prosp.NumeroInterior
|
|
TxtColonia.Text = Prosp.Colonia
|
|
TxtCodigoPostal.Text = Prosp.CodigoPostal.ToString()
|
|
DdlSexo.SelectedValue = If(Gvr.DataKey("Sexo") = "H", "1", "0")
|
|
TxtIFE.Text = Prosp.IFE
|
|
TxtCelular.Text = Prosp.Celular
|
|
TxtTelefono.Text = Prosp.Telefono
|
|
TxtCorreo.Text = Prosp.Correo
|
|
TxtEntreCalle1.Text = Prosp.EntreCalle1
|
|
TxtEntreCalle2.Text = Prosp.EntreCalle2
|
|
|
|
End If
|
|
|
|
Prosp.Dispose()
|
|
|
|
|
|
Dim ObjEncuesta As New ClsProspectos
|
|
|
|
If ObjEncuesta.GetEncuestasProspecto(-1, tCveProspecto, UsuarioActual.CveEmpresa) Then
|
|
If ObjEncuesta.DtResultados.Rows.Count > 0 Then
|
|
DdlEnDeteccion.SelectedValue = "1"
|
|
PnlReporta.Visible = False
|
|
Else
|
|
'se habilita la refencia de
|
|
DdlEnDeteccion.SelectedValue = "0"
|
|
PnlReporta.Visible = True
|
|
End If
|
|
End If
|
|
ObjEncuesta.Dispose()
|
|
Else
|
|
DdlEnDeteccion.SelectedValue = "0"
|
|
PnlReporta.Visible = True
|
|
End If
|
|
|
|
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
<WebMethod()> <Script.Services.ScriptMethodAttribute()> _
|
|
Public Shared Function wsGetReporta(ByVal prefixText As String, ByVal count As Integer) As String()
|
|
|
|
|
|
'Dim dt As DataTable = CType(Session("DtCuentas"), DataTable)
|
|
'Dim Conta As New ClsContPAQi(UsuarioActual.Empresa)
|
|
'dt = Conta.getCuentasCheque(Prefijo)
|
|
'Conta.Dispose()
|
|
Dim items As New List(Of String)(count)
|
|
|
|
|
|
Dim Prosp As New ClsProspectos
|
|
Dim dt As DataTable = Nothing
|
|
If Prosp.GetProspectos(-1, prefixText.Trim, "-1", -1, -1, -1, -1, -1, -1, 41) Then
|
|
dt = Prosp.DtResultados
|
|
End If
|
|
Prosp.Dispose()
|
|
|
|
|
|
For i As Integer = 0 To count - 1
|
|
|
|
If dt.Rows.Count > i Then
|
|
items.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(dt.Rows(i)("NombreCompleto").ToString, dt.Rows(i)("CveProspecto").ToString))
|
|
Else
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
|
|
Return items.ToArray()
|
|
End Function
|
|
|
|
Private Sub CargaEncuesta()
|
|
Dim ObjProsEncuestas As New ClsProspectos
|
|
If ObjProsEncuestas.GetPreguntas(CveEncuesta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
|
|
If ObjProsEncuestas.DtResultados.Rows.Count > 0 Then
|
|
LtlNumEncuestas.Text = "Hoy: " & ObjProsEncuestas.DtResultados.Rows(0)("NumEncuestasHoy").ToString.FormatoNumero(0) & " - Total: " & ObjProsEncuestas.DtResultados.Rows(0)("NumEncuestas").ToString.FormatoNumero(0)
|
|
Else
|
|
LtlNumEncuestas.Text = "Hoy: 0 - Total: 0"
|
|
End If
|
|
|
|
GvPreguntas.DataSource = ObjProsEncuestas.DtResultados
|
|
DTProspectosPreguntas = ObjProsEncuestas.DtResultados
|
|
|
|
If ObjProsEncuestas.GetRespuestas(-1, CveEncuesta) Then
|
|
DTProspectosRespuestas = ObjProsEncuestas.DtResultados
|
|
End If
|
|
|
|
End If
|
|
ObjProsEncuestas.Dispose()
|
|
GvPreguntas.DataBind()
|
|
End Sub
|
|
|
|
Protected Sub GvPreguntas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
Dim EsOpcion As Integer = e.Row.DBCampo("PreguntaTipo").ToEntero
|
|
Dim CvePregunta As Integer = e.Row.DBCampo("CvePregunta").ToEntero
|
|
|
|
|
|
Select Case EsOpcion
|
|
Case 0, 4 'Texto, Multiline
|
|
With e.Row.FCTextBox("TxtValor")
|
|
.Visible = True
|
|
If EsOpcion = 4 Then
|
|
.Rows = 3
|
|
.TextMode = TextBoxMode.MultiLine
|
|
End If
|
|
End With
|
|
Case 1, 2 'DropDownList, Radios
|
|
Dim dt As DataTable = DTProspectosRespuestas.FiltraParametros(String.Format("CvePregunta = {0} AND Estatus = 'Activo'", CvePregunta))
|
|
|
|
|
|
If EsOpcion = 1 Then
|
|
With e.Row.FCDropDownList("DdlRespuesta")
|
|
.Visible = True
|
|
.DataSource = dt
|
|
.DataBind()
|
|
.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
|
End With
|
|
ElseIf EsOpcion = 2 Then
|
|
With e.Row.FCRadioButtonList("RbRespuesta")
|
|
.Visible = True
|
|
.DataSource = dt
|
|
.DataBind()
|
|
|
|
End With
|
|
e.Row.FCRequiredFieldValidator("RFVRbRespuesta").ErrorMessage = String.Format("ERROR: Falta contestar la pregunta: <b>{0}</b>", e.Row.DBCampo("Pregunta"))
|
|
End If
|
|
|
|
|
|
Case 3 'Fecha
|
|
With e.Row.FCTextBox("TxtValor")
|
|
|
|
.Visible = True
|
|
.Width = New Unit(80)
|
|
End With
|
|
e.Row.FCImageButton("ImgTxtValor").Visible = True
|
|
e.Row.FCMaskedEditExtender("MEETxtValor").Enabled = True
|
|
e.Row.FCCalendarExtender("CETxtValor").Enabled = True
|
|
End Select
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GeneraOrden(ByVal Tabla As String)
|
|
Dim StrSQL As New StringBuilder
|
|
|
|
StrSQL.Append(" $(document).ready(function () { ")
|
|
StrSQL.Append(" var oTable = $('#" & Tabla & "').dataTable({ ")
|
|
StrSQL.Append(" ""bPaginate"": false, ")
|
|
StrSQL.Append(" ""bLengthChange"": false, ")
|
|
StrSQL.Append(" ""bFilter"": false, ")
|
|
StrSQL.Append(" ""bSort"": true, ")
|
|
StrSQL.Append(" ""bInfo"": false, ")
|
|
StrSQL.Append(" ""bAutoWidth"": false, ")
|
|
StrSQL.Append(" ""aoColumns"": [ ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null, ")
|
|
StrSQL.Append(" null ")
|
|
'StrSQL.Append(" { ""sType"": ""numeric-comma"" }, ")
|
|
'StrSQL.Append(" { ""sType"": ""uk_date"" }, ")
|
|
'StrSQL.Append(" { ""sType"": ""uk_date"" }, ")
|
|
'StrSQL.Append(" null, ")
|
|
'StrSQL.Append(" null, ")
|
|
'StrSQL.Append(" null, ")
|
|
'StrSQL.Append(" { ""sType"": ""numeric-comma"" }, ")
|
|
'StrSQL.Append(" null, ")
|
|
'StrSQL.Append(" null, ")
|
|
'StrSQL.Append(" null ")
|
|
StrSQL.Append(" ] ")
|
|
StrSQL.Append(" }); ")
|
|
StrSQL.Append(" }); ")
|
|
RegistraScript(StrSQL.ToString)
|
|
End Sub
|
|
|
|
Protected Sub GvBusq_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvBusq.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("CveProspecto").ToEntero > 0 Then e.Row.CssClass = "tabla_seleccionado"
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub DdlEnDeteccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEnDeteccion.SelectedIndexChanged
|
|
If DdlEnDeteccion.SelectedValue = "1" Then
|
|
PnlReporta.Visible = False
|
|
HdnCveProspectoPadre.Value = "-1"
|
|
Else
|
|
PnlReporta.Visible = True
|
|
HdnCveProspectoPadre.Value = "-1"
|
|
End If
|
|
End Sub
|
|
End Class
|