294 lines
10 KiB
VB.net
294 lines
10 KiB
VB.net
Imports System.Data
|
|
Imports System.Linq.Expressions
|
|
Imports Extensiones
|
|
|
|
Partial Class Prospectos_RedesCallCenter
|
|
Inherits ClsPaginas
|
|
|
|
|
|
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 CveProspecto As Integer
|
|
Get
|
|
Return ViewState("CveProspecto").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProspecto") = 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
|
|
|
|
Private Property CveEncuestaRespuesta As Integer
|
|
Get
|
|
Return ViewState("CveEncuestaRespuesta").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveEncuestaRespuesta") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
|
|
If Not Page.IsPostBack Then
|
|
|
|
LblUsuarioActual.Text = UsuarioActual.Nombre
|
|
|
|
CveEncuesta = 17 ' Encuestas ya levantadas: 9
|
|
|
|
CargaDatos()
|
|
|
|
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim ObjProsEncuestas As New ClsProspectos
|
|
|
|
'cargo los datos del prospecto
|
|
TxtObservaciones.Text = ""
|
|
CveEncuestaRespuesta = ObjProsEncuestas.GetSiguienteaEncuestar(CveEncuesta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
If CveEncuestaRespuesta > 0 Then
|
|
'si encontró un prospecto disponible
|
|
CveProspecto = ObjProsEncuestas.CveProspecto
|
|
|
|
Dim ObjProsp As New ClsProspectos
|
|
|
|
If ObjProsp.GetProspectos(CveProspecto, "-1", "-1", -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
LblNombre.Text = String.Format("{0} {1} {2}", ObjProsp.ApellidoPaterno, ObjProsp.ApellidoMaterno, ObjProsp.Nombres)
|
|
LblCelular.Text = ObjProsp.Celular
|
|
LblTelefono.Text = ObjProsp.Telefono
|
|
LblTelefonoOtro.Text = String.Format("Otro: {0}", ObjProsp.TelefonoOtro)
|
|
|
|
|
|
If ObjProsEncuestas.GetPreguntas(CveEncuesta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
|
Try
|
|
LtlNumEncuestas.Text = "Hoy: " & ObjProsEncuestas.DtResultados.Rows(0)("NumEncuestasHoy").ToString.FormatoNumero(0) & " - Total: " & ObjProsEncuestas.DtResultados.Rows(0)("NumEncuestas").ToString.FormatoNumero(0)
|
|
Catch ex As Exception
|
|
LtlNumEncuestas.Text = "Hoy: 0 - Total: 0"
|
|
End Try
|
|
|
|
GvPreguntas.DataSource = ObjProsEncuestas.DtResultados
|
|
DTProspectosPreguntas = ObjProsEncuestas.DtResultados
|
|
If ObjProsEncuestas.GetRespuestas(-1, CveEncuesta) Then
|
|
DTProspectosRespuestas = ObjProsEncuestas.DtResultados
|
|
End If
|
|
|
|
BtnEncuesta.Visible = True
|
|
BtnSaltarEncuesta.Visible = True
|
|
BtnSaltarNoContactado.Visible = True
|
|
Dim ObjEncuesta As New ClsProspectos
|
|
|
|
'JJMQ
|
|
'Pongo el SP que trae el encabezado de la encuesta, por si trae si le pusieron algo en Observaciones, que las ponga aquí, para si dice llamar a determinada hora que primero lean la Obs.
|
|
If ObjEncuesta.GetEncuestasProspecto(-1, CveProspecto, UsuarioActual.CveEmpresa) Then
|
|
If ObjEncuesta.DtResultados IsNot Nothing AndAlso ObjEncuesta.DtResultados.Rows.Count > 0 Then
|
|
TxtObservaciones.Text = ObjEncuesta.DtResultados.Rows(0)("Observaciones").ToString
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
ObjProsp.Dispose()
|
|
|
|
|
|
Else
|
|
Alert("No se encontraron encuestas disponibles", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
|
|
|
|
'If ObjProsEncuestas.GetRespuestasProspecto(CveEncuesta, CveProspecto, UsuarioActual.CveEmpresa) Then
|
|
' Gvv.DataSource = ObjProsEncuestas.DtResultados
|
|
' Gvv.DataBind()
|
|
|
|
'End If
|
|
|
|
|
|
ObjProsEncuestas.Dispose()
|
|
GvPreguntas.DataBind()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub GuardarRespuestas()
|
|
Dim Correcto As Boolean = True
|
|
Dim ObjEncuesta As New ClsProspectos
|
|
ObjEncuesta.IniciaTransacSQL()
|
|
|
|
If CveEncuestaRespuesta > 0 Then
|
|
|
|
|
|
For Each gvr As GridViewRow In GvPreguntas.Rows
|
|
|
|
Dim CveOpcion As Integer = -2
|
|
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
|
|
Case "5" 'multiple textbox
|
|
Valor = String.Format("{0}<br>{1}<br>{2}", gvr.FCTextBox("TxtValor1").Text.Trim, gvr.FCTextBox("TxtValor2").Text.Trim, gvr.FCTextBox("TxtValor3").Text.Trim)
|
|
Valor = Valor.Replace("<br><br>", "") ' sino respondieron algun cuadro quito el fin de linea
|
|
End Select
|
|
|
|
|
|
If gvr.DataKey("CvePregunta").ToEntero > 0 Then
|
|
|
|
If Not ObjEncuesta.AddEncuestaRespuestaDetalle(CveEncuestaRespuesta, gvr.DataKey("CvePregunta").ToEntero, If(CveOpcion = 0, -2, CveOpcion), If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario) Then
|
|
Correcto = False
|
|
Exit For
|
|
End If
|
|
'Else
|
|
' objProspectosValores.UpdateProspectosValores(CveProspecto, CveCaracteristica, CveOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario, CveValor)
|
|
|
|
End If
|
|
Next
|
|
Else
|
|
Correcto = False
|
|
End If
|
|
|
|
If Correcto Then
|
|
If ObjEncuesta.ActualizaEstatus(CveEncuestaRespuesta, 10, UsuarioActual.CveUsuario, TxtObservaciones.Text) Then
|
|
Correcto = True
|
|
ObjEncuesta.Commit()
|
|
Else
|
|
Correcto = False
|
|
End If
|
|
|
|
|
|
Alert("Encuenta Guardada", TipoMensaje.MsgInformacion)
|
|
Else
|
|
ObjEncuesta.RollBack()
|
|
End If
|
|
|
|
|
|
ObjEncuesta.Dispose()
|
|
|
|
If Correcto Then
|
|
CargaDatos()
|
|
End If
|
|
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
|
|
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
|
|
Case 5 ' multiples textbox
|
|
e.Row.FCTextBox("TxtValor1").Visible = True : e.Row.FCTextBox("TxtValor2").Visible = True : e.Row.FCTextBox("TxtValor3").Visible = True
|
|
End Select
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub BtnEncuesta_Click(sender As Object, e As EventArgs) Handles BtnEncuesta.Click
|
|
|
|
GuardarRespuestas()
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnSaltarEncuesta_Click(sender As Object, e As EventArgs) Handles BtnSaltarEncuesta.Click
|
|
|
|
Dim ObjEncuesta As New ClsProspectos
|
|
|
|
If ObjEncuesta.ActualizaEstatus(CveEncuestaRespuesta, 2, UsuarioActual.CveUsuario, TxtObservaciones.Text) Then
|
|
Alert("Encuesta Saltada", TipoMensaje.MsgInformacion)
|
|
ObjEncuesta.GetSiguienteaEncuestar(CveEncuesta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
CargaDatos()
|
|
End If
|
|
ObjEncuesta.Dispose()
|
|
|
|
End Sub
|
|
|
|
Protected Sub BtnSaltarNoContactado_Click(sender As Object, e As EventArgs) Handles BtnSaltarNoContactado.Click
|
|
|
|
Dim ObjEncuesta As New ClsProspectos
|
|
|
|
If ObjEncuesta.ActualizaEstatus(CveEncuestaRespuesta, 3, UsuarioActual.CveUsuario, TxtObservaciones.Text) Then
|
|
Alert("Encuesta Saltada", TipoMensaje.MsgInformacion)
|
|
ObjEncuesta.GetSiguienteaEncuestar(CveEncuesta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
CargaDatos()
|
|
End If
|
|
ObjEncuesta.Dispose()
|
|
|
|
End Sub
|
|
|
|
|
|
End Class
|