Commit inicial Ventas Productivo
This commit is contained in:
620
RH/Prospectos.aspx.vb
Normal file
620
RH/Prospectos.aspx.vb
Normal file
@@ -0,0 +1,620 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.IO
|
||||
Imports System.Data
|
||||
|
||||
Partial Class Prospectos_Prospectos
|
||||
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
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
'ViewState("OCveProspecto") = "CveProspecto DESC"
|
||||
'ViewState("OCveCliente") = "CveCliente DESC"
|
||||
'ViewState("OApellidoPaterno") = "ApellidoPaterno DESC"
|
||||
'ViewState("OApellidoMaterno") = "ApellidoMaterno DESC"
|
||||
'ViewState("ONombres") = "Nombres DESC"
|
||||
'ViewState("OFechaNacimiento") = "FechaNacimiento DESC"
|
||||
'ViewState("OLugarNacimiento") = "LugarNacimiento DESC"
|
||||
'ViewState("ORFC") = "RFC DESC"
|
||||
'ViewState("ONacionalidad") = "Nacionalidad DESC"
|
||||
'ViewState("OCalle") = "Calle DESC"
|
||||
'ViewState("ONumero") = "Numero DESC"
|
||||
'ViewState("OColonia") = "Colonia DESC"
|
||||
'ViewState("OCodigoPostal") = "CodigoPostal DESC"
|
||||
'ViewState("OPais") = "Pais DESC"
|
||||
'ViewState("OMunicipio") = "Municipio DESC"
|
||||
'ViewState("OEstado") = "Estado DESC"
|
||||
'ViewState("OTelefono") = "Telefono DESC"
|
||||
'ViewState("OFax") = "Fax DESC"
|
||||
'ViewState("OCorreo") = "Correo DESC"
|
||||
'ViewState("OEmpresaNombre") = "EmpresaNombre DESC"
|
||||
'ViewState("OEmpresaGiro") = "EmpresaGiro DESC"
|
||||
'ViewState("OEmpresaSector") = "EmpresaSector DESC"
|
||||
'ViewState("OEmpresaPagina") = "EmpresaPagina DESC"
|
||||
'ViewState("OEmpresaCalle") = "EmpresaCalle DESC"
|
||||
'ViewState("OEmpresaNumero") = "EmpresaNumero DESC"
|
||||
'ViewState("OEmpresaColonia") = "EmpresaColonia DESC"
|
||||
'ViewState("OEmpresaCodigoPostal") = "EmpresaCodigoPostal DESC"
|
||||
'ViewState("OEmpresaPais") = "EmpresaPais DESC"
|
||||
'ViewState("OEmpresaMunicipio") = "EmpresaMunicipio DESC"
|
||||
'ViewState("OEmpresaEstado") = "EmpresaEstado DESC"
|
||||
'ViewState("OEmpresaTelefono") = "EmpresaTelefono DESC"
|
||||
'ViewState("OEmpresaFax") = "EmpresaFax DESC"
|
||||
'ViewState("OEmpresaCorreo") = "EmpresaCorreo DESC"
|
||||
'ViewState("OEmpresaPuesto") = "EmpresaPuesto DESC"
|
||||
'ViewState("OEmpresaEspecialidad") = "EmpresaEspecialidad DESC"
|
||||
'ViewState("OEnvioCorrespondencia") = "EnvioCorrespondencia DESC"
|
||||
'ViewState("OFiscalRazonSocial") = "FiscalRazonSocial DESC"
|
||||
'ViewState("OFiscalDomicilio") = "FiscalDomicilio DESC"
|
||||
'ViewState("OFiscalColonia") = "FiscalColonia DESC"
|
||||
'ViewState("OFiscalCodigoPostal") = "FiscalCodigoPostal DESC"
|
||||
'ViewState("OFiscalMunicipio") = "FiscalMunicipio DESC"
|
||||
'ViewState("OFiscalEstado") = "FiscalEstado DESC"
|
||||
'ViewState("OFiscalRFC") = "FiscalRFC DESC"
|
||||
'ViewState("OCveEstatus") = "CveEstatus DESC"
|
||||
'ViewState("OFechaIng") = "FechaIng DESC"
|
||||
'ViewState("OCveUsuario") = "CveUsuario DESC"
|
||||
'ViewState("OCveEmpresa") = "CveEmpresa DESC"
|
||||
|
||||
DdlPaises.DataSource = GlobalDTGralPaises : DdlPaises.DataBind()
|
||||
DdlPaises.SelectedValue = "1"
|
||||
DdlEmpresaPaises.SelectedValue = "1"
|
||||
DdlEmpresaPaises.DataSource = GlobalDTGralPaises : DdlEmpresaPaises.DataBind()
|
||||
DdlFiscalEstados.DataSource = GlobalDTGralEstados(1) : DdlFiscalEstados.DataBind()
|
||||
|
||||
'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:"
|
||||
'ImgAddObs.Attributes.Add("onclick", "javascript:$('#DivEventoBitacora').show(1000); PosicionaObjeto(this.id,'DivEventoBitacora');")
|
||||
|
||||
'Else
|
||||
' CargaEstados(DdlEstados, DdlPaises.SelectedValue.ToEntero)
|
||||
' CargaMunicipios(DdlMunicipios, DdlEstados.SelectedValue.ToEntero)
|
||||
|
||||
' CargaEstados(DdlEmpresaEstados, DdlEmpresaPaises.SelectedValue.ToEntero)
|
||||
' CargaMunicipios(DdlEmpresaMunicipios, DdlEmpresaEstados.SelectedValue.ToEntero)
|
||||
|
||||
' CargaMunicipios(DdlFiscalMunicipios, DdlFiscalEstados.SelectedValue.ToEntero)
|
||||
|
||||
' ViewState("CveProspecto") = -1
|
||||
Else
|
||||
CargaEstados(DdlEstados, 1)
|
||||
DdlEstados.SelectedValue = "26"
|
||||
CargaMunicipios(DdlMunicipios, DdlEstados.SelectedValue.ToEntero)
|
||||
DdlMunicipios.SelectedValue = "1919"
|
||||
|
||||
CargaEstados(DdlEmpresaEstados, 1)
|
||||
DdlEmpresaEstados.SelectedValue = "26"
|
||||
CargaMunicipios(DdlEmpresaMunicipios, DdlEmpresaEstados.SelectedValue.ToEntero)
|
||||
DdlEmpresaMunicipios.SelectedValue = "1919"
|
||||
|
||||
DdlEmpresaEstados.SelectedValue = "26"
|
||||
CargaMunicipios(DdlMunicipios, DdlEmpresaEstados.SelectedValue.ToEntero)
|
||||
DdlMunicipios.SelectedValue = "1919"
|
||||
CargaEstados(DdlEmpresaEstados, 1)
|
||||
DdlFiscalEstados.SelectedValue = "26"
|
||||
CargaMunicipios(DdlFiscalMunicipios, DdlFiscalEstados.SelectedValue.ToEntero)
|
||||
DdlFiscalMunicipios.SelectedValue = "1919"
|
||||
|
||||
ViewState("CveProspecto") = -1
|
||||
|
||||
End If
|
||||
|
||||
CargaCaracteristicas()
|
||||
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
|
||||
TxtLugarNacimiento.Text = ObjProspectos.LugarNacimiento
|
||||
TxtRFC.Text = ObjProspectos.RFC
|
||||
TxtNacionalidad.Text = ObjProspectos.Nacionalidad
|
||||
TxtCalle.Text = ObjProspectos.Calle
|
||||
TxtNumero.Text = ObjProspectos.Numero
|
||||
TxtNumeroInterior.Text = ObjProspectos.NumeroInterior
|
||||
TxtColonia.Text = ObjProspectos.Colonia
|
||||
TxtCodigoPostal.Text = ObjProspectos.CodigoPostal.ToString
|
||||
DdlSexo.SelectedValue = ObjProspectos.Sexo.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
|
||||
|
||||
TxtTelefono.Text = ObjProspectos.Telefono
|
||||
TxtFax.Text = ObjProspectos.Fax
|
||||
TxtCorreo.Text = ObjProspectos.Correo
|
||||
TxtEmpresaNombre.Text = ObjProspectos.EmpresaNombre
|
||||
TxtEmpresaGiro.Text = ObjProspectos.EmpresaGiro
|
||||
TxtEmpresaSector.Text = ObjProspectos.EmpresaSector
|
||||
TxtEmpresaPagina.Text = ObjProspectos.EmpresaPagina
|
||||
TxtEmpresaCalle.Text = ObjProspectos.EmpresaCalle
|
||||
TxtEmpresaNumero.Text = ObjProspectos.EmpresaNumero
|
||||
TxtEmpresaColonia.Text = ObjProspectos.EmpresaColonia
|
||||
TxtEmpresaCodigoPostal.Text = ObjProspectos.EmpresaCodigoPostal
|
||||
|
||||
DdlEmpresaPaises.SelectedValue = ObjProspectos.CveEmpresaPais.ToString
|
||||
CargaEstados(DdlEmpresaEstados, DdlEmpresaPaises.SelectedValue.ToEntero)
|
||||
DdlEmpresaEstados.SelectedValue = ObjProspectos.CveEmpresaEstado.ToString
|
||||
CargaMunicipios(DdlEmpresaMunicipios, DdlEmpresaEstados.SelectedValue.ToEntero)
|
||||
DdlEmpresaMunicipios.SelectedValue = ObjProspectos.CveEmpresaMunicipio.ToString
|
||||
|
||||
'cveEmpresaPais.Text = ObjProspectos.EmpresaPais
|
||||
'TxtEmpresaMunicipio.Text = ObjProspectos.EmpresaMunicipio
|
||||
'TxtEmpresaEstado.Text = ObjProspectos.EmpresaEstado
|
||||
TxtEmpresaTelefono.Text = ObjProspectos.EmpresaTelefono
|
||||
TxtEmpresaFax.Text = ObjProspectos.EmpresaFax
|
||||
TxtEmpresaCorreo.Text = ObjProspectos.EmpresaCorreo
|
||||
TxtEmpresaPuesto.Text = ObjProspectos.EmpresaPuesto
|
||||
TxtEmpresaEspecialidad.Text = ObjProspectos.EmpresaEspecialidad
|
||||
ChkEnvioCorrespondencia.Checked = ObjProspectos.EnvioCorrespondencia
|
||||
TxtFiscalRazonSocial.Text = ObjProspectos.FiscalRazonSocial
|
||||
TxtFiscalDomicilio.Text = ObjProspectos.FiscalDomicilio
|
||||
TxtFiscalColonia.Text = ObjProspectos.FiscalColonia
|
||||
TxtFiscalCodigoPostal.Text = ObjProspectos.FiscalCodigoPostal
|
||||
|
||||
CargaEstados(DdlFiscalEstados, 1)
|
||||
DdlFiscalEstados.SelectedValue = ObjProspectos.CveFiscalEstado.ToString
|
||||
CargaMunicipios(DdlFiscalMunicipios, DdlFiscalEstados.SelectedValue.ToEntero)
|
||||
DdlFiscalMunicipios.SelectedValue = ObjProspectos.CveFiscalMunicipio.ToString
|
||||
|
||||
TxtFiscalRFC.Text = ObjProspectos.FiscalRFC
|
||||
'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
|
||||
|
||||
'Cargar Referencias de Beneficiarios
|
||||
If ObjProspectos.GetProspectosReferencias(CveProspecto) Then
|
||||
Dim Beneficiarios As DataTable = ObjProspectos.DtResultados.FiltraParametros("CveTipoReferencia = " + ClsProspectos.TipoReferencias.Beneficiario.ToEntero.ToString)
|
||||
Dim Sustitutos As DataTable = ObjProspectos.DtResultados.FiltraParametros("CveTipoReferencia = " + ClsProspectos.TipoReferencias.Sustituto.ToEntero.ToString)
|
||||
|
||||
If Beneficiarios.Rows.Count > 0 Then
|
||||
HdnCveReferencia1.Value = Beneficiarios.Rows(0)("CveReferencia").ToString
|
||||
TxtNombreReferencia1.Text = Beneficiarios.Rows(0)("NombreReferencia").ToString
|
||||
TxtParentesco1.Text = Beneficiarios.Rows(0)("Parentesco").ToString
|
||||
TxtPorcentaje1.Text = If(Beneficiarios.Rows(0)("Porcentaje").ToString.ToDouble <> 0, Beneficiarios.Rows(0)("Porcentaje").ToString, "")
|
||||
End If
|
||||
If Beneficiarios.Rows.Count > 1 Then
|
||||
HdnCveReferencia2.Value = Beneficiarios.Rows(1)("CveReferencia").ToString
|
||||
TxtNombreReferencia2.Text = Beneficiarios.Rows(1)("NombreReferencia").ToString
|
||||
TxtParentesco2.Text = Beneficiarios.Rows(1)("Parentesco").ToString
|
||||
TxtPorcentaje2.Text = If(Beneficiarios.Rows(1)("Porcentaje").ToString.ToDouble <> 0, Beneficiarios.Rows(1)("Porcentaje").ToString, "")
|
||||
End If
|
||||
If Beneficiarios.Rows.Count > 2 Then
|
||||
HdnCveReferencia3.Value = Beneficiarios.Rows(2)("CveReferencia").ToString
|
||||
TxtNombreReferencia3.Text = Beneficiarios.Rows(2)("NombreReferencia").ToString
|
||||
TxtParentesco3.Text = Beneficiarios.Rows(2)("Parentesco").ToString
|
||||
TxtPorcentaje3.Text = If(Beneficiarios.Rows(2)("Porcentaje").ToString.ToDouble <> 0, Beneficiarios.Rows(2)("Porcentaje").ToString, "")
|
||||
End If
|
||||
If Beneficiarios.Rows.Count > 3 Then
|
||||
HdnCveReferencia4.Value = Beneficiarios.Rows(3)("CveReferencia").ToString
|
||||
TxtNombreReferencia4.Text = Beneficiarios.Rows(3)("NombreReferencia").ToString
|
||||
TxtParentesco4.Text = Beneficiarios.Rows(3)("Parentesco").ToString
|
||||
TxtPorcentaje4.Text = If(Beneficiarios.Rows(3)("Porcentaje").ToString.ToDouble <> 0, Beneficiarios.Rows(3)("Porcentaje").ToString, "")
|
||||
End If
|
||||
|
||||
If Sustitutos.Rows.Count > 0 Then
|
||||
HdnCveReferenciaSustituto1.Value = Sustitutos.Rows(0)("CveReferencia").ToString
|
||||
TxtNombreReferenciaSustituto1.Text = Sustitutos.Rows(0)("NombreReferencia").ToString
|
||||
TxtParentescoSustituto1.Text = Sustitutos.Rows(0)("Parentesco").ToString
|
||||
End If
|
||||
If Sustitutos.Rows.Count > 1 Then
|
||||
HdnCveReferenciaSustituto2.Value = Sustitutos.Rows(1)("CveReferencia").ToString
|
||||
TxtNombreReferenciaSustituto2.Text = Sustitutos.Rows(1)("NombreReferencia").ToString
|
||||
TxtParentescoSustituto2.Text = Sustitutos.Rows(1)("Parentesco").ToString
|
||||
End If
|
||||
If Sustitutos.Rows.Count > 2 Then
|
||||
HdnCveReferenciaSustituto3.Value = Sustitutos.Rows(2)("CveReferencia").ToString
|
||||
TxtNombreReferenciaSustituto3.Text = Sustitutos.Rows(2)("NombreReferencia").ToString
|
||||
TxtParentescoSustituto3.Text = Sustitutos.Rows(2)("Parentesco").ToString
|
||||
End If
|
||||
End If
|
||||
|
||||
CargaCaracteristicas()
|
||||
|
||||
CargaEventoBitacora()
|
||||
End If
|
||||
End If
|
||||
ObjProspectos.Dispose()
|
||||
End Sub
|
||||
#Region "E V E N T O - B I T A C O R A"
|
||||
Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVEventoBitacora.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Cells(0).Width = Unit.Pixel(200)
|
||||
e.Row.Cells(1).Width = Unit.Pixel(200)
|
||||
e.Row.Cells(2).Width = Unit.Pixel(100)
|
||||
e.Row.Cells(3).Width = Unit.Pixel(500)
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("Archivo").ToString <> "" Then
|
||||
e.Row.FCLinkButton("LinkArchivo").Visible = True
|
||||
e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString)
|
||||
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione
|
||||
End If
|
||||
|
||||
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click
|
||||
Dim ObjEventoBitacora As New ClsOIEventos
|
||||
|
||||
Dim FileExtension As String = "-1"
|
||||
Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos
|
||||
Dim filemove As String = ""
|
||||
|
||||
For Each fileItem As Archivo In filesgral
|
||||
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
|
||||
filemove = fileItem.filename
|
||||
Next
|
||||
|
||||
If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), -1, -1, CveProspecto, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
If filemove <> "" Then
|
||||
filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa))
|
||||
End If
|
||||
|
||||
|
||||
GVEventoBitacora.DataSource = ObjEventoBitacora.DtResultados
|
||||
TxtEventoDescripcion.Text = ""
|
||||
Anexo.Text = "[]"
|
||||
Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion)
|
||||
RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal")
|
||||
End If
|
||||
|
||||
ObjEventoBitacora.Dispose()
|
||||
GVEventoBitacora.DataBind()
|
||||
|
||||
UPEventoBitacora.Update()
|
||||
CargaEventoBitacora()
|
||||
UPAddEventoBitacora.Update()
|
||||
End Sub
|
||||
Private Sub CargaEventoBitacora()
|
||||
|
||||
Dim ObjEventoBitacora As New ClsOIEventos()
|
||||
If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProspecto:=CveProspecto) Then
|
||||
GVEventoBitacora.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2")
|
||||
Else
|
||||
GVEventoBitacora.DataSource = Nothing
|
||||
End If
|
||||
GVEventoBitacora.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
|
||||
Dim Archivo As New System.IO.FileInfo(filePath)
|
||||
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = "application/octet-stream"
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(filePath)
|
||||
HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
|
||||
Archivo = Nothing
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
Private Sub CargaEstados(ddl As DropDownList, CvePais As Integer)
|
||||
ddl.DataSource = GlobalDTGralEstados(CvePais) : ddl.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaMunicipios(ddl As DropDownList, CveEstado As Integer)
|
||||
ddl.DataSource = GlobalDTGralMunicipios(CveEstado) : ddl.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaCaracteristicas()
|
||||
Dim objClasificaciones As New ClsProspectos
|
||||
|
||||
If objClasificaciones.GetCaracteristicasClasificaciones(UsuarioActual.CveEmpresa) Then
|
||||
GvClasificaciones.DataSource = objClasificaciones.DtResultados
|
||||
GvClasificaciones.DataBind()
|
||||
End If
|
||||
|
||||
objClasificaciones.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
|
||||
|
||||
Dim ObjProspectos As New ClsProspectos
|
||||
If CveProspecto = -1 Then
|
||||
|
||||
Dim RetVal As Integer = ObjProspectos.AddProspectos(-1, TxtApellidoPaterno.Text.Trim, TxtApellidoMaterno.Text.Trim,
|
||||
TxtNombres.Text.Trim, TxtFechaNacimiento.Text.Trim.ToDate, TxtLugarNacimiento.Text.Trim, TxtRFC.Text.Trim, TxtNacionalidad.Text.Trim, DdlSexo.SelectedValue.ToEntero, TxtCalle.Text.Trim,
|
||||
TxtNumero.Text.Trim, TxtNumeroInterior.Text.Trim, "", "", TxtColonia.Text.Trim, TxtCodigoPostal.Text.Trim.ToEntero, DdlMunicipios.SelectedValue.ToEntero,
|
||||
TxtTelefono.Text.Trim, "", TxtFax.Text.Trim, "", TxtCorreo.Text.Trim, "", "", "", -1, -1, -1, TxtEmpresaNombre.Text.Trim, TxtEmpresaGiro.Text.Trim, TxtEmpresaSector.Text.Trim,
|
||||
TxtEmpresaPagina.Text.Trim, TxtEmpresaCalle.Text.Trim, TxtEmpresaNumero.Text.Trim, TxtEmpresaColonia.Text.Trim, TxtEmpresaCodigoPostal.Text.Trim, DdlEmpresaMunicipios.SelectedValue.ToEntero,
|
||||
TxtEmpresaTelefono.Text.Trim, TxtEmpresaFax.Text.Trim, TxtEmpresaCorreo.Text.Trim, TxtEmpresaPuesto.Text.Trim,
|
||||
TxtEmpresaEspecialidad.Text.Trim, ChkEnvioCorrespondencia.Checked, TxtFiscalRazonSocial.Text.Trim, TxtFiscalDomicilio.Text.Trim, TxtFiscalColonia.Text.Trim,
|
||||
TxtFiscalCodigoPostal.Text.Trim, DdlFiscalMunicipios.SelectedValue.ToEntero, TxtFiscalRFC.Text.Trim, -1, -1, -1, "", -1, -1, -1, "", 0, "", -1, -1, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
|
||||
If RetVal > 0 Then
|
||||
ViewState("CveProspecto") = ObjProspectos.CveProspecto
|
||||
|
||||
GuardarCaracteristicas()
|
||||
GuardarReferencias()
|
||||
|
||||
Alert("El Prospecto se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Prospectos/Prospectos.aspx"";")
|
||||
End If
|
||||
Else
|
||||
If ObjProspectos.UpdateProspectos(-1, TxtApellidoPaterno.Text.Trim, TxtApellidoMaterno.Text.Trim,
|
||||
TxtNombres.Text.Trim, TxtFechaNacimiento.Text.Trim.ToDate, TxtLugarNacimiento.Text.Trim, TxtRFC.Text.Trim, TxtNacionalidad.Text.Trim, DdlSexo.SelectedValue.ToEntero, TxtCalle.Text.Trim,
|
||||
TxtNumero.Text.Trim, TxtNumeroInterior.Text.Trim, "", "", TxtColonia.Text.Trim, TxtCodigoPostal.Text.Trim.ToEntero, DdlMunicipios.SelectedValue.ToEntero,
|
||||
TxtTelefono.Text.Trim, "", TxtFax.Text.Trim, "", TxtCorreo.Text.Trim, "", "", "", -1, -1, -1, TxtEmpresaNombre.Text.Trim, TxtEmpresaGiro.Text.Trim, TxtEmpresaSector.Text.Trim,
|
||||
TxtEmpresaPagina.Text.Trim, TxtEmpresaCalle.Text.Trim, TxtEmpresaNumero.Text.Trim, TxtEmpresaColonia.Text.Trim, TxtEmpresaCodigoPostal.Text.Trim, DdlEmpresaMunicipios.SelectedValue.ToEntero,
|
||||
TxtEmpresaTelefono.Text.Trim, TxtEmpresaFax.Text.Trim, TxtEmpresaCorreo.Text.Trim, TxtEmpresaPuesto.Text.Trim,
|
||||
TxtEmpresaEspecialidad.Text.Trim, ChkEnvioCorrespondencia.Checked, TxtFiscalRazonSocial.Text.Trim, TxtFiscalDomicilio.Text.Trim, TxtFiscalColonia.Text.Trim,
|
||||
TxtFiscalCodigoPostal.Text.Trim, DdlFiscalMunicipios.SelectedValue.ToEntero, TxtFiscalRFC.Text.Trim, -1, -1, -1, "", -1, -1, -1, "", 0, "", -1, -1, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProspecto) Then
|
||||
|
||||
GuardarCaracteristicas()
|
||||
GuardarReferencias()
|
||||
|
||||
UpDatos.Update()
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjProspectos.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub GuardarCaracteristicas()
|
||||
Dim objProspectosValores As New ClsProspectos
|
||||
For Each DR As GridViewRow In GvClasificaciones.Rows
|
||||
For Each DR_CaracteristicaTipo As GridViewRow In DR.FCGridView("GvTiposCaracteristicas").Rows
|
||||
For Each DR_Caracteristica As GridViewRow In DR_CaracteristicaTipo.FCGridView("GvCaracteristicas").Rows
|
||||
Dim CveCaracteristicaOpcion As Integer = -1
|
||||
Dim CveValor As Integer = DR_Caracteristica.FCHiddenField("HdnCveValor").Value.ToEntero
|
||||
Dim Valor As String = DR_Caracteristica.FCTextBox("TxtValor").Text.Trim
|
||||
Dim CveCaracteristica As Integer = DR_Caracteristica.FCHiddenField("HdnCveCaracteristica").Value.ToEntero
|
||||
Select Case DR_Caracteristica.FCHiddenField("HdnEsOpcion").Value
|
||||
Case "1" 'Listado o DropDownList
|
||||
CveCaracteristicaOpcion = DR_Caracteristica.FCDropDownList("DdlCaracteristicaOpcion").SelectedValue.ToEntero
|
||||
Case "2" 'Radio o RadioButtonList
|
||||
CveCaracteristicaOpcion = DR_Caracteristica.FCRadioButtonList("RbCaracteristicaOpcion").SelectedValue.ToEntero
|
||||
End Select
|
||||
|
||||
|
||||
If CveValor = -1 Then
|
||||
objProspectosValores.AddProspectosValores(CveProspecto, CveCaracteristica, CveCaracteristicaOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosValores.UpdateProspectosValores(CveProspecto, CveCaracteristica, CveCaracteristicaOpcion, If(Valor = "", "-1", Valor), UsuarioActual.CveUsuario, CveValor)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
objProspectosValores.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub GuardarReferencias()
|
||||
Dim objProspectosReferencias As New ClsProspectos
|
||||
|
||||
If HdnCveReferencia1.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia1.Text, TxtParentesco1.Text, "", TxtPorcentaje1.Text.ToDouble, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia1.Text, TxtParentesco1.Text, "", TxtPorcentaje1.Text.ToDouble, HdnCveReferencia1.Value.ToEntero)
|
||||
End If
|
||||
If HdnCveReferencia2.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia2.Text, TxtParentesco2.Text, "", TxtPorcentaje2.Text.ToDouble, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia2.Text, TxtParentesco2.Text, "", TxtPorcentaje2.Text.ToDouble, HdnCveReferencia2.Value.ToEntero)
|
||||
End If
|
||||
If HdnCveReferencia3.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia3.Text, TxtParentesco3.Text, "", TxtPorcentaje3.Text.ToDouble, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia3.Text, TxtParentesco3.Text, "", TxtPorcentaje3.Text.ToDouble, HdnCveReferencia3.Value.ToEntero)
|
||||
End If
|
||||
If HdnCveReferencia4.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia4.Text, TxtParentesco4.Text, "", TxtPorcentaje4.Text.ToDouble, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Beneficiario, TxtNombreReferencia4.Text, TxtParentesco4.Text, "", TxtPorcentaje4.Text.ToDouble, HdnCveReferencia4.Value.ToEntero)
|
||||
End If
|
||||
|
||||
|
||||
If HdnCveReferenciaSustituto1.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Sustituto, TxtNombreReferenciaSustituto1.Text, TxtParentescoSustituto1.Text, "", 0, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Sustituto, TxtNombreReferenciaSustituto1.Text, TxtParentescoSustituto1.Text, "", 0, HdnCveReferenciaSustituto1.Value.ToEntero)
|
||||
End If
|
||||
If HdnCveReferenciaSustituto2.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Sustituto, TxtNombreReferenciaSustituto2.Text, TxtParentescoSustituto2.Text, "", 0, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Sustituto, TxtNombreReferenciaSustituto2.Text, TxtParentescoSustituto2.Text, "", 0, HdnCveReferenciaSustituto2.Value.ToEntero)
|
||||
End If
|
||||
If HdnCveReferenciaSustituto3.Value = "-1" Then
|
||||
objProspectosReferencias.AddProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Sustituto, TxtNombreReferenciaSustituto3.Text, TxtParentescoSustituto3.Text, "", 0, UsuarioActual.CveUsuario)
|
||||
Else
|
||||
objProspectosReferencias.UpdateProspectosReferencias(CveProspecto, ClsProspectos.TipoReferencias.Sustituto, TxtNombreReferenciaSustituto3.Text, TxtParentescoSustituto3.Text, "", 0, HdnCveReferenciaSustituto3.Value.ToEntero)
|
||||
End If
|
||||
objProspectosReferencias.Dispose()
|
||||
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 GvClasificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvClasificaciones.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveCaracteristicaClasificacion").ToEntero > 1 Then
|
||||
e.Row.FCLabel("LblCaracteristicaClasificacion").CssClass = "CaracteristicaPrincipal"
|
||||
End If
|
||||
|
||||
Dim objTiposCaracteristicas As New ClsProspectos
|
||||
|
||||
If objTiposCaracteristicas.GetTiposCaracteristicas(UsuarioActual.CveEmpresa) Then
|
||||
With e.Row.FCGridView("GvTiposCaracteristicas")
|
||||
.DataSource = objTiposCaracteristicas.DtResultados.FiltraParametros("CveCaracteristicaClasificacion = " + e.Row.DBCampo("CveCaracteristicaClasificacion"))
|
||||
.DataBind()
|
||||
End With
|
||||
End If
|
||||
|
||||
objTiposCaracteristicas.Dispose()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvTiposCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CaracteristicaClasificacion").Trim = "" Then
|
||||
e.Row.FCLabel("LblCaracteristicaTipo").CssClass = "CaracteristicaPrincipal"
|
||||
End If
|
||||
|
||||
Dim objCaracteristicas As New ClsProspectos
|
||||
|
||||
If objCaracteristicas.GetCaracteristicas(UsuarioActual.CveEmpresa) Then
|
||||
With e.Row.FCGridView("GvCaracteristicas")
|
||||
.DataSource = objCaracteristicas.DtResultados.FiltraParametros("Estatus = 'Activo' and CveCaracteristicaTipo = " + e.Row.DBCampo("CveCaracteristicaTipo"))
|
||||
.DataBind()
|
||||
End With
|
||||
End If
|
||||
|
||||
objCaracteristicas.Dispose()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim RowProspectoValor As DataRowCollection
|
||||
|
||||
Dim EsOpcion As Integer = e.Row.FCHiddenField("HdnEsOpcion").Value.ToEntero
|
||||
Dim CveCaracteristica As Integer = e.Row.DBCampo("CveCaracteristica").ToEntero
|
||||
|
||||
'Dim RowProspectoValor As DataRowCollection = CType(ViewState("DTPS"), DataTable).FiltraParametros("CveCaracteristica = " + CveCaracteristica.ToString).Rows
|
||||
If DTProspectosValores.Rows.Count > 0 Then
|
||||
RowProspectoValor = DTProspectosValores.FiltraParametros("CveCaracteristica = " + CveCaracteristica.ToString).Rows
|
||||
Else
|
||||
RowProspectoValor = Nothing
|
||||
End If
|
||||
|
||||
Dim CveValor As Integer = -1
|
||||
Dim Valor As String = ""
|
||||
Dim CveCaracteristicaOpcion As Integer = -1
|
||||
|
||||
If RowProspectoValor.Count > 0 Then
|
||||
e.Row.FCHiddenField("HdnCveValor").Value = RowProspectoValor(0)("CveValor").ToString
|
||||
Valor = RowProspectoValor(0)("Valor").ToString
|
||||
CveCaracteristicaOpcion = RowProspectoValor(0)("CveOpcion").ToString.ToEntero
|
||||
End If
|
||||
|
||||
Select Case EsOpcion
|
||||
Case 0, 4 'Texto, Multiline
|
||||
With e.Row.FCTextBox("TxtValor")
|
||||
.Text = Valor
|
||||
.Visible = True
|
||||
If EsOpcion = 4 Then
|
||||
.Rows = 3
|
||||
.TextMode = TextBoxMode.MultiLine
|
||||
End If
|
||||
End With
|
||||
Case 1, 2 'DropDownList, Radios
|
||||
Dim objOpciones As New ClsProspectos
|
||||
If objOpciones.GetCaracteristicasOpciones(CveCaracteristica, UsuarioActual.CveEmpresa) Then
|
||||
If EsOpcion = 1 Then
|
||||
With e.Row.FCDropDownList("DdlCaracteristicaOpcion")
|
||||
.Visible = True
|
||||
.DataSource = objOpciones.DtResultados.FiltraParametros("Estatus = 'Activo'")
|
||||
.DataBind()
|
||||
.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
||||
.SelectedValue = CveCaracteristicaOpcion.ToString
|
||||
End With
|
||||
ElseIf EsOpcion = 2 Then
|
||||
With e.Row.FCRadioButtonList("RbCaracteristicaOpcion")
|
||||
.Visible = True
|
||||
.DataSource = objOpciones.DtResultados.FiltraParametros("Estatus = 'Activo'")
|
||||
.DataBind()
|
||||
If CveCaracteristicaOpcion > 0 Then
|
||||
.SelectedValue = CveCaracteristicaOpcion.ToString
|
||||
End If
|
||||
End With
|
||||
End If
|
||||
End If
|
||||
|
||||
objOpciones.Dispose()
|
||||
Case 3 'Fecha
|
||||
With e.Row.FCTextBox("TxtValor")
|
||||
If Valor <> "" Then
|
||||
.Text = Valor
|
||||
End If
|
||||
.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
|
||||
|
||||
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 DdlEmpresaPaises_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEmpresaPaises.SelectedIndexChanged
|
||||
CargaEstados(DdlEmpresaEstados, DdlEmpresaPaises.SelectedValue.ToEntero)
|
||||
UPPEmpresaEstados.Update()
|
||||
CargaMunicipios(DdlEmpresaMunicipios, DdlEmpresaEstados.SelectedValue.ToEntero)
|
||||
UPPEmpresaMunicipios.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlEmpresaEstados_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEmpresaEstados.SelectedIndexChanged
|
||||
CargaMunicipios(DdlEmpresaMunicipios, DdlEmpresaEstados.SelectedValue.ToEntero)
|
||||
UPPEmpresaMunicipios.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlFiscalEstados_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFiscalEstados.SelectedIndexChanged
|
||||
CargaMunicipios(DdlFiscalMunicipios, DdlFiscalEstados.SelectedValue.ToEntero)
|
||||
UPPFiscalMunicipios.Update()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user