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

226 lines
9.6 KiB
VB.net

Imports System.Data
Imports Extensiones
Partial Class Prospectos_ProspectosValidar
Inherits ClsPaginas
Public Property CveProspecto As Integer
Get
Return ViewState("CveProspecto").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveProspecto") = value
End Set
End Property
Public Property CveProspectoProspectoProceso As Integer
Get
Return ViewState("CveProspectoProspectoProceso").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveProspectoProspectoProceso") = value
End Set
End Property
Protected Sub BtnObtener_Click(sender As Object, e As EventArgs) Handles BtnObtener.Click
ObtenerSiguiente()
End Sub
Private Sub ObtenerSiguiente()
Dim Prosp As New ClsProspectos
Dim Seccion As Integer = TxtSeccionB.Text.Replace("_", "").ToEntero
If Seccion = 0 Then Seccion = -1
If Prosp.GetSiguienteProspecto(RBL.SelectedValue.ToEntero, Seccion, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If Prosp.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = Prosp.DtResultados.Rows(0)
Dim FechaNacimiento As String = "-1"
If dr IsNot Nothing Then
TxtPaternoB.Text = dr("ApellidoPaterno").ToString()
TxtMaternoB.Text = dr("ApellidoMaterno").ToString()
TxtNombresB.Text = dr("Nombres").ToString()
TxtSeccion.Text = dr("Seccion").ToString()
If dr("FechaNacimiento").ToString <> "" AndAlso dr("FechaNacimiento").ToString.ToDate.Year > 1900 Then
Dim tFechaNacimiento = dr("FechaNacimiento").ToString.ToDate
FechaNacimiento = tFechaNacimiento.ToShortDateString
TxtDia.Text = tFechaNacimiento.Day.ToString
TxtMes.Text = tFechaNacimiento.Month.ToString
TxtAnio.Text = tFechaNacimiento.Year.ToString
TxtFechaNacimiento.Text = FechaNacimiento
Else
TxtDia.Text = ""
TxtMes.Text = ""
TxtAnio.Text = ""
TxtFechaNacimiento.Text = ""
End If
'cargos datos a verificar
TxtAPaterno.Text = dr("ApellidoPaterno").ToString()
TxtAMaterno.Text = dr("ApellidoMaterno").ToString()
TxtNombre.Text = dr("Nombres").ToString()
TxtCalle.Text = dr("Calle").ToString()
TxtNumero.Text = dr("Numero").ToString()
TxtColonia.Text = dr("Colonia").ToString()
TxtSeccion.Text = dr("Seccion").ToString()
'limpia los datos del padron
TxtPadronPaterno.Text = ""
TxtPadronMaterno.Text = ""
TxtPadronNombre.Text = ""
TxtPadronCalle.Text = ""
TxtPadronNumero.Text = ""
TxtPadronColonia.Text = ""
TxtPadronSeccion.Text = ""
HdnIFE.Value = ""
CveProspecto = dr("CveProspecto").ToString.ToEntero()
CveProspectoProspectoProceso = dr("CveProspectoProspectoProceso").ToString.ToEntero()
End If
Busqueda()
Else
Alert("No se seleccionó ninguna persona.", TipoMensaje.MsgAdvertencia)
CveProspecto = -1
CveProspectoProspectoProceso = -1
End If
End If
Prosp.Dispose()
End Sub
Private Sub Busqueda()
Dim Prosp As New ClsProspectos
Dim Contador As Integer = 0
If Prosp.GetProspectosBusqueda(TxtPaternoB.Text.ToUpper.Trim & "%", TxtMaternoB.Text.ToUpper.Trim & "%", TxtNombresB.Text.ToUpper.Trim & "%", "-1", "-1",
If(TxtSeccion.Text.Replace("_", "") = "", "-1", TxtSeccion.Text.Replace("_", "")).ToEntero,
If(TxtDia.Text = "", "-1", TxtDia.Text).ToEntero,
If(TxtMes.Text = "", "-1", TxtMes.Text).ToEntero,
If(TxtAnio.Text = "", "-1", TxtAnio.Text).ToEntero) Then
GvBusq.DataSource = Prosp.DtResultados
Contador = Prosp.DtResultados.Rows.Count
Prosp.Dispose()
GvBusq.DataBind()
LblBusqueda.Text = String.Format("<table width='100%'><tr><td>Registros localizados con el criterio de búsqueda: <b>{0}</b></td><tr></table>", Contador)
LimpiaDatos()
End If
End Sub
Protected Sub BtnBusqueda_Click(sender As Object, e As EventArgs) Handles BtnBusqueda.Click
Busqueda()
End Sub
Private Sub LimpiaDatos()
TxtPadronPaterno.Text = ""
TxtPadronMaterno.Text = ""
TxtPadronNombre.Text = ""
TxtPadronCalle.Text = ""
TxtPadronNumero.Text = ""
TxtPadronColonia.Text = ""
TxtPadronSeccion.Text = ""
TxtPadronFecha.Text = ""
HdnIFE.Value = ""
TxtNombre.BackColor = Drawing.Color.White : TxtPadronNombre.BackColor = Drawing.Color.White
TxtAPaterno.BackColor = Drawing.Color.White : TxtPadronPaterno.BackColor = Drawing.Color.White
TxtAMaterno.BackColor = Drawing.Color.White : TxtPadronMaterno.BackColor = Drawing.Color.White
TxtFechaNacimiento.BackColor = Drawing.Color.White : TxtPadronFecha.BackColor = Drawing.Color.White
TxtCalle.BackColor = Drawing.Color.White : TxtPadronCalle.BackColor = Drawing.Color.White
TxtNumero.BackColor = Drawing.Color.White : TxtPadronNumero.BackColor = Drawing.Color.White
TxtColonia.BackColor = Drawing.Color.White : TxtPadronColonia.BackColor = Drawing.Color.White
End Sub
Protected Sub LnkClave_Click(sender As Object, e As EventArgs)
Dim Gvr As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
TxtPadronPaterno.Text = Gvr.DataKey("APaterno")
TxtPadronMaterno.Text = Gvr.DataKey("AMaterno")
TxtPadronNombre.Text = Gvr.DataKey("Nombres")
TxtPadronFecha.Text = Gvr.DataKey("FechaNacimiento").ToDate.ToShortDateString
TxtPadronCalle.Text = Gvr.DataKey("Calle")
TxtPadronNumero.Text = Gvr.DataKey("NumExterior")
TxtPadronColonia.Text = Gvr.DataKey("Colonia")
HdnIFE.Value = Gvr.DataKey("Clave")
TxtPadronSeccion.Text = Gvr.DataKey("Seccion")
If TxtNombre.Text.Trim = TxtPadronNombre.Text.Trim Then TxtNombre.BackColor = Drawing.Color.PaleGreen : TxtPadronNombre.BackColor = Drawing.Color.PaleGreen
If TxtAPaterno.Text.Trim = TxtPadronPaterno.Text.Trim Then TxtAPaterno.BackColor = Drawing.Color.PaleGreen : TxtPadronPaterno.BackColor = Drawing.Color.PaleGreen
If TxtAMaterno.Text.Trim = TxtPadronMaterno.Text.Trim Then TxtAMaterno.BackColor = Drawing.Color.PaleGreen : TxtPadronMaterno.BackColor = Drawing.Color.PaleGreen
If TxtFechaNacimiento.Text.Trim = TxtPadronFecha.Text.Trim Then TxtFechaNacimiento.BackColor = Drawing.Color.PaleGreen : TxtPadronFecha.BackColor = Drawing.Color.PaleGreen
If TxtCalle.Text.Trim = TxtPadronCalle.Text.Trim Then TxtCalle.BackColor = Drawing.Color.PaleGreen : TxtPadronCalle.BackColor = Drawing.Color.PaleGreen
If TxtNumero.Text.Trim = TxtPadronNumero.Text.Trim Then TxtNumero.BackColor = Drawing.Color.PaleGreen : TxtPadronNumero.BackColor = Drawing.Color.PaleGreen
If TxtColonia.Text.Trim = TxtPadronColonia.Text.Trim Then TxtColonia.BackColor = Drawing.Color.PaleGreen : TxtPadronColonia.BackColor = Drawing.Color.PaleGreen
BtnSolucion.Enabled = True
'Dim tCveProspecto As Integer = Gvr.DataKey("CveProspecto").ToEntero
'UpDatos.Update()
End Sub
Protected Sub BtnSolucion_Click(sender As Object, e As EventArgs) Handles BtnSolucion.Click
If RBLSolucion.SelectedValue.ToEntero > 0 Then
If CveProspectoProspectoProceso > 0 Then
Dim IFE As String = HdnIFE.Value
If RBLSolucion.SelectedValue.ToEntero = 1 AndAlso IFE = "" Then
Alert("No se encontró", TipoMensaje.MsgInformacion)
RBLSolucion.SelectedValue = "2"
Exit Sub
End If
If RBLSolucion.SelectedValue.ToEntero = 2 Then IFE = ""
Dim Prosp As New ClsProspectos
If Prosp.UpdateProspectoProceso(CveProspectoProspectoProceso, RBLSolucion.SelectedValue.ToEntero, Now, IFE) Then
Alert("Registro Guardado", TipoMensaje.MsgInformacion)
LimpiaDatos()
GvBusq.DataBind()
TxtNombre.Text = ""
TxtAPaterno.Text = ""
TxtAMaterno.Text = ""
TxtFechaNacimiento.Text = ""
TxtCalle.Text = ""
TxtNumero.Text = ""
TxtColonia.Text = ""
TxtPaternoB.Text = ""
TxtMaternoB.Text = ""
TxtNombresB.Text = ""
TxtSeccion.Text = ""
TxtDia.Text = ""
TxtMes.Text = ""
TxtAnio.Text = ""
End If
Prosp.Dispose()
ObtenerSiguiente()
End If
Else
Alert("Seleccione una solución", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Class