Imports ULA.Davivienda.WCFServiciosCobisGenerales.DAL Imports ULA.Davivienda.WCFServiciosCobisGenerales.Entidades Imports Ultimus.Utilitarios Imports System.Xml Public Class ConsultaClienteBL ' Constante para indicar que se está trabajando en ambiente COBIS #Const COBIS = 1 ' Codigos de Errores Const ERR_COBIS_1 = 1 Const ERR_COBIS_2 = 2 Const ERR_COBIS_3 = 3 Const ERR_COBIS_4 = 4 Const SQLTEXT& = &H23 Const SQLARRAY& = &H24 Const SQLVARBINARY& = &H25 Const SQLINTN& = &H26 Const SQLVARCHAR& = &H27 Const SQLBINARY& = &H2D Const SQLIMAGE& = &H22 Const SQLCHAR& = &H2F Const SQLINT1& = &H30 Const SQLBIT& = &H32 Const SQLINT2& = &H34 Const SQLINT4& = &H38 Const SQLMONEY& = &H3C Const SQLDATETIME& = &H3D Const SQLFLT8& = &H3E Const SQLFLTN& = &H6D Const SQLFLT4& = &H3E Const SQLMONEYN& = &H6E Const SQLDATETIMN& = &H6F Const SQLAOPCNT& = &H4B Const SQLAOPSUM& = &H4D Const SQLAOPAVG& = &H4F Const SQLAOPMIN& = &H51 Const SQLAOPMAX& = &H52 Const SQLAOPANY& = &H53 Const SQLAOPNOOP& = &H56 Const SQLMONEY4& = &H7A Const SQLDATETIM4& = &H3A Dim g_Login As String Dim g_Clave As String Dim g_Sucursal As String Dim g_Rol As String Dim g_Oficina As String Dim g_Filial As String Dim xmlDocEnv As Xml.XmlDocument Dim rootElement As Xml.XmlElement Dim gstrConnDatos As String Dim gstrConnUltimus As String Dim gstrConnSybase As String Dim gstrServidorCOBIS As String Dim gResponse Dim gSession Dim gProceso As String Dim gEstatusConexionCOBIS As Integer 'Dim gobjAudit As ServiciosApoyo.Auditoria Dim VTNum As Integer Dim VTRow As Integer Dim VTI As Object Dim VTClave As String Dim VTErr_Tipo As String Dim VTErr_NumErr As Long Dim VTErr_Sev As Integer Dim VTErr_Msg As String Dim VLErrorAut As String Dim VTnumRets As Integer Dim VTRetparam As String Dim VTRetStatus As String Dim VTresul As String Dim Map As MAPASPLib.mapcon Dim SqlConn As Integer Dim crypt As Crypt = New Crypt() Dim log As LogFile = New LogFile() Public Sub New() MyBase.New() Dim bIsDummie As Boolean = False Try gstrServidorCOBIS = Configuration.ConfigurationManager.AppSettings("ServerCobisFisico") bIsDummie = Configuration.ConfigurationManager.AppSettings("isDummie") If (Not bIsDummie) Then #If COBIS = 1 Then Map = New MAPASPLib.mapcon #End If End If gEstatusConexionCOBIS = 0 Catch ex As Exception Throw New Exception("No fue posible inicializar el servicio. " + ex.Message) End Try End Sub Public Function ConsultarSolicitante(req As ConsultarSolicitanteRequest) As ConsultarSolicitanteResponse Dim bIsDummie As Boolean = False Dim co_ente As String = String.Empty Dim nElement As Xml.XmlElement = Nothing Dim aElement As Xml.XmlElement = Nothing Dim objPI As Xml.XmlProcessingInstruction Dim resp As ConsultarSolicitanteResponse = Nothing Try resp = New ConsultarSolicitanteResponse() bIsDummie = Configuration.ConfigurationManager.AppSettings("isDummie") If (bIsDummie) Then resp.resultado = "NO466863C05-0330-04101Persona Fisica NacionalCOREABADILLAJUAN CLIMACO 06/10/198200000000M41COSTARICENSES146ANALISTAA1209/03/2020141COSTA RICA420141COSTA RICA1SAN JOSE118CURRIDABAT3Sanchez2Lomas De AyarcoDMN0.00VILLAS DE AYARCO CASA 2-F DE HS1122726511----1DOMICILIO241COSTA RICA1SAN JOSE101CENTRAL1Carmen9Cuesta MorasDCN0.00DE LA CATEDRAL METROPOLITANA 2S1183982474----2TRABAJO 1222871000----2TRABAJO 12BANCO DAVIVIENDA COS170ANALISTA1,037,400.00NS09/04/20146201MARITZABADILLARODRIGUEZLIBERIAMADRE8307610329/05/200729/05/2007SN3 2GERARDOBADILLAGARITALIBERIAPRIMO ( A )8811909729/05/200729/05/2007SN7 1juan.c.corea@davivienda.crAhorro01405279131161,667.98289,872.85COLONESAHONM1,042,026.3829/05/20071,165,470.02Ahorro01405279149806.26288.53DOLARESAHONM319.5029/05/2007185.33Ahorro2842603471156,894.48157,593.68COLONESAHONN137,733.9114/12/2010133,656.69447466.53333333333333333333334288.52500HIPOTECARIO1040014071440401426,545,882.5601/11/204128,140,000.00DOLARES0192,800.61HIPOTECARIO1040014072512111819,847,907.3701/08/203520,000,000.000.00DOLARES0168,204.77046393789.9300046393789.930000SI4117573451363012COLONES0.000.000.00 - A025/10/20120.0051647441175734513630124117573451363012DOLARES300.000.000.00 - A025/10/20120.00516474411757345136301206000005/23/200707/30/20155026260014IGUAL O MENOR A 30 DIAS08214543.00AUT1001010HVI260026030PCREFA7000000" resp.errCode = "00" resp.errMessage = "OK" log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", resp.resultado) Return resp End If xmlDocEnv = New Xml.XmlDocument objPI = xmlDocEnv.CreateProcessingInstruction("xml", "version='1.0'") xmlDocEnv.AppendChild(objPI) rootElement = xmlDocEnv.CreateElement("Resultado") xmlDocEnv.AppendChild(rootElement) gProceso = req.Proceso.ToString() If ConsultarLoginCOBIS(req.UserName, req.Password) Then IniciarConexionCOBIS() If SqlConn > 0 Then If req.TipoIdentificacion = "Ente" Then co_ente = req.Identificacion Else co_ente = ConsultarEnteSolicitante(req.Proceso.ToString(), req.Identificacion, req.TipoIdentificacion) End If 'co_ente = "292" If co_ente = "0" Then nElement = xmlDocEnv.CreateElement("Detalle") rootElement.AppendChild(nElement) aElement = xmlDocEnv.CreateElement("co_ente") aElement.InnerText = "NoEncontrado" nElement.AppendChild(aElement) Else ConsultarListaNegra(req.Proceso.ToString(), co_ente) ConsultarDatosGenerales(req.Proceso.ToString(), co_ente) ConsultarDireccionesSolicitante(req.Proceso.ToString(), co_ente) ConsultarFuentesIngreso(req.Proceso.ToString(), co_ente) ConsultarReferenciasPersonales(req.Proceso.ToString(), co_ente) ConsultarEmail(req.Proceso.ToString(), co_ente) ConsultarPasivos(req.Proceso.ToString(), co_ente) ConsultarActivos(req.Proceso.ToString(), co_ente) ConsultarTarjetas(req.Proceso.ToString(), co_ente) ConsultarScoring(req.Proceso.ToString(), co_ente) End If End If resp.resultado = xmlDocEnv.InnerXml resp.errCode = "00" resp.errMessage = "OK" log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", xmlDocEnv.InnerXml) End If Catch ex As Exception resp.errCode = "99" resp.errMessage = ex.Message resp.resultado = "Error: " & ex.Message & "" log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Finally Try If SqlConn > 0 And gEstatusConexionCOBIS = 1 Then TerminarConexionCOBIS() End If Catch ex As Exception resp.errCode = "99" resp.errMessage = "Ha ocurrido un error al terminar la conexión con cobis" End Try End Try Return resp End Function Public Function CrearCuenta(req As CrearCuentaRequest) As CrearCuentaResponse Dim bIsDummie As Boolean = False Dim resp As CrearCuentaResponse = Nothing Dim intResultado As Integer = 0 Dim intNumeroError As Integer = 0 Dim strDescError As String = String.Empty Dim strOrigenError As String = "CrearCuenta" Dim aMatriz1(50, 100) Try resp = New CrearCuentaResponse() gProceso = req.strProceso bIsDummie = Configuration.ConfigurationManager.AppSettings("isDummie") log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 0 =>" & req.ToString()) If (bIsDummie) Then resp.resultado = "" + _ "" + _ "1234567890AHO" + _ "9876543211AHO" + _ "" resp.errCode = "00" resp.errMessage = "OK" Return resp End If log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 1 =>" & req.strUsername) If ConsultarLoginCOBIS(req.strUsername, req.strPassword) Then IniciarConexionCOBIS() log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 2 =>" & req.strUsername) If SqlConn > 0 Then log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 3 =>" & req.strUsername) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_cartera.sp_firma_docs_ultimus", 7402, gResponse, gSession) Then Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "7402") Map.PMPasoValores(SqlConn, "@i_opcion", 0, SQLCHAR&, "C") Map.PMPasoValores(SqlConn, "@i_oficina", 0, SQLINT4&, req.CodigoOficina) Map.PMPasoValores(SqlConn, "@i_moneda", 0, SQLINT1&, req.Moneda) Map.PMPasoValores(SqlConn, "@i_ccah_monto", 0, SQLMONEY&, req.MontoApertura) Map.PMPasoValores(SqlConn, "@i_ccah_ente", 0, SQLINT4&, req.Ente) Map.PMPasoValores(SqlConn, "@i_ccah_producto", 0, SQLVARCHAR&, req.TipoProducto) Map.PMPasoValores(SqlConn, "@i_oficial", 0, SQLVARCHAR&, req.CodigoOficial) Map.PMPasoValores(SqlConn, "@i_empresa", 0, SQLINT1&, "4") Map.PMPasoValores(SqlConn, "@i_banco", 0, SQLVARCHAR&, req.NumeroOperacion) Map.PMPasoValores(SqlConn, "@i_prod_banc", 0, SQLINT1&, req.TipoCuentaNueva) Map.PMPasoValores(SqlConn, "@i_ing_neto_col", 0, SQLMONEY&, req.IngresoNetoCol) Map.PMPasoValores(SqlConn, "@i_ing_bruto_col", 0, SQLMONEY&, req.IngresoBrutoCol) Map.PMPasoValores(SqlConn, "@i_ing_neto_dol", 0, SQLMONEY&, req.IngresoNetoDol) Map.PMPasoValores(SqlConn, "@i_ing_bruto_dol", 0, SQLMONEY&, req.IngresoBrutoDol) Map.PMPasoValores(SqlConn, "@i_envio_ec", 0, SQLCHAR&, req.CoEnvioEstadoCuenta) Map.PMPasoValores(SqlConn, "@i_incidente", 0, SQLINT4&, req.Incidente) If req.SecEnvioEstadoCuenta <> "" Then Map.PMPasoValores(SqlConn, "@i_sec_envio_ec", 0, SQLINT1&, req.SecEnvioEstadoCuenta) End If Map.PMPasoValores(SqlConn, "@i_ffecha", 0, SQLINT1&, "103") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_cartera", "sp_firma_docs_ultimus", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz1) Map.PMChequea(SqlConn) If Map.FMRetStatus(SqlConn) <> 0 Then Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, strOrigenError, strDescError) End If Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_firma_docs_ultimus", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 4 =>" & intResultado.ToString()) If (intResultado > 0) Then resp.resultado = "" For i As Integer = 0 To intResultado resp.resultado += "" + aMatriz1(0, i + 1) + "" + IIf(aMatriz1(1, i + 1) = "20", "0", "1") + "AHO" Next resp.resultado += "" resp.errCode = "00" resp.errMessage = "OK" log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 5 =>" & resp.resultado) Else resp.errCode = "99" resp.errMessage = "No se pudo obtener el resultado de la matriz de retorno." End If Else resp.errCode = "99" resp.errMessage = "RpcInit failed" End If Else resp.errCode = "99" resp.errMessage = "Connection failed" End If Else resp.errCode = "99" resp.errMessage = "Login failed" End If log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", "Flag 6 =>" & resp.errCode & " - " & resp.errMessage) Catch ex As Exception resp.errCode = "99" resp.errMessage = ex.Message log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Finally Try If SqlConn > 0 And gEstatusConexionCOBIS = 1 Then TerminarConexionCOBIS() End If Catch ex As Exception resp.errCode = "99" resp.errMessage = "Ha ocurrido un error al terminar la conexión con cobis" log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", resp.errMessage) End Try End Try Return resp End Function #Region "DesarrolloConsultarSecuenciales" #Region "ConsultarSecuencialesSolicitante" ' ######################################################################################### ' ConsultarSecuencialesSolicitante: ' ######################################################################################### Public Function ConsultarSecuencialesSolicitante(req As ConsultarSecuencialesSolicitanteRequest) As ConsultarSecuencialesSolicitanteResponse Dim co_ente As String Dim objPI As Xml.XmlProcessingInstruction Dim nElement, aElement As Xml.XmlElement Dim intNumeroError As Object Dim strDescError As Object Dim strOrigenError As Object Dim strRespXML As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String Dim resp As ConsultarSecuencialesSolicitanteResponse = Nothing intNumeroError = 0 gProceso = req.Proceso.ToString() strRespXML = "" Try resp = New ConsultarSecuencialesSolicitanteResponse() xmlDocEnv = New Xml.XmlDocument() objPI = xmlDocEnv.CreateProcessingInstruction("xml", "version='1.0'") xmlDocEnv.AppendChild(objPI) rootElement = xmlDocEnv.CreateElement("Resultado") xmlDocEnv.AppendChild(rootElement) If ConsultarLoginCOBIS(req.strUsername, req.strPassword) Then IniciarConexionCOBIS() If SqlConn > 0 Then If req.strTipoIdentificacion = "Ente" Then co_ente = req.strIdentificacion Else co_ente = ConsultarEnteSolicitante(req.Proceso.ToString(), req.strIdentificacion, req.strTipoIdentificacion) End If 'co_ente = "292" If co_ente = "0" Then nElement = xmlDocEnv.CreateElement("Detalle") rootElement.AppendChild(nElement) aElement = xmlDocEnv.CreateElement("co_ente") aElement.InnerText = "NoEncontrado" nElement.AppendChild(aElement) Else ConsultarSecuencialesDireccionesSolicitante(req.Proceso.ToString(), co_ente) ConsultarSecuencialesFuentesIngreso(req.Proceso.ToString(), co_ente) ConsultarSecuencialesReferenciasPersonales(req.Proceso.ToString(), co_ente) ConsultarSecuencialesEmail(req.Proceso.ToString(), co_ente) End If End If resp.resultado = xmlDocEnv.InnerXml resp.errCode = "00" resp.errMessage = "OK" End If Catch ex As Exception Try strError = excError.Message log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception resp.errCode = "99" resp.errMessage = ex.Message resp.resultado = "Error: " & ex2.Message & "" End Try Finally If SqlConn > 0 And gEstatusConexionCOBIS = 1 Then TerminarConexionCOBIS() End If resp.errCode = "99" resp.errMessage = "Ha ocurrido un error al terminar la conexión con cobis" End Try Return resp End Function #End Region #Region "ConsultarSecuencialesDireccionesSolicitante" ' ######################################################################################### ' ConsultarSecuencialesDireccionesSolicitante: ' ######################################################################################### Private Function ConsultarSecuencialesDireccionesSolicitante(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(50, 50) Dim aMatriz2(50, 50) Dim aCampos(19) As String Dim I, J, K, L, M As Integer Dim nElement, aElement, nElement2, aElement2, aElement3 As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado As Integer Dim intResultado2 As Integer Dim DistritoAreaMetro As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarDireccionesSolicitante" aCampos(0) = "co_direccion" aCampos(1) = "co_pais" aCampos(2) = "de_pais" aCampos(3) = "co_provincia" aCampos(4) = "de_provincia" aCampos(5) = "co_canton" aCampos(6) = "de_canton" aCampos(7) = "co_distrito" aCampos(8) = "de_distrito" aCampos(9) = "co_barrio" aCampos(10) = "de_barrio" aCampos(11) = "co_tipo_direccion" aCampos(12) = "de_tipo" aCampos(13) = "de_calle" aCampos(14) = "de_edificio" aCampos(15) = "nu_casa" aCampos(16) = "co_alquilado" aCampos(17) = "mo_mensualidad" aCampos(18) = "de_observacion" aCampos(19) = "co_vigente" Try nElement = xmlDocEnv.CreateElement("Direcciones") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_direccion_cons", 1227, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "F") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1227") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_direccion_cons", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_direccion_cons", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("Direccion") nElement.AppendChild(nElement2) For J = 0 To 19 aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) Next DistritoAreaMetro = ObtenerAreaMetro(aMatriz(5, K), aMatriz(7, K)) aElement = xmlDocEnv.CreateElement("co_distrito_area_metro") aElement.InnerText = DistritoAreaMetro nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("Telefonos") nElement2.AppendChild(aElement) ' Obtener los telTfonos para esta direcci=n If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_telefono", 147, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "147") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) Map.PMPasoValores(SqlConn, "@i_direccion", 0, SQLINT1&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_telefono", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For M = 1 To intResultado2 aElement2 = xmlDocEnv.CreateElement("Telefono") aElement.AppendChild(aElement2) aElement3 = xmlDocEnv.CreateElement("co_secuencial") aElement3.InnerText = aMatriz2(0, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("telefono") aElement3.InnerText = aMatriz2(1, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("extension") aElement3.InnerText = aMatriz2(2, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("co_tipo") aElement3.InnerText = aMatriz2(3, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("de_telefono") aElement3.InnerText = aMatriz2(4, M) aElement2.AppendChild(aElement3) Next Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function #End Region #Region "ConsultarSecuencialesFuentesIngreso" ' ######################################################################################### ' ConsultarSecuencialesFuentesIngreso: ' ######################################################################################### Private Function ConsultarSecuencialesFuentesIngreso(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(15, 20) Dim aMatriz2(30, 30) Dim aCampos(15) As String Dim I, J, K As Integer Dim nElement, nElement2, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado, intResultado2 As Integer Dim strDescripcionOcupacion As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarFuentesIngreso" aCampos(0) = "co_empleo" aCampos(1) = "co_compania_catalogo" aCampos(2) = "de_compania_normal" aCampos(3) = "co_ocupacion" aCampos(4) = "de_ocupacion" aCampos(5) = "mo_sueldo" aCampos(6) = "co_rango" aCampos(7) = "de_rango" aCampos(8) = "co_verificado" aCampos(9) = "co_vigencia" aCampos(10) = "fe_fecha_mod" aCampos(11) = "co_tipo_empleo" aCampos(12) = "nu_empleado" aCampos(13) = "nu_planilla" aCampos(14) = "nu_segurosocial" Try nElement = xmlDocEnv.CreateElement("FuentesIngreso") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_empleo", 1231, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "F") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1231") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_empleo", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For K = 1 To intResultado If (aMatriz(2, K) <> "" And aMatriz(2, K) <> Nothing) And _ (aMatriz(5, K) <> "" And aMatriz(5, K) <> Nothing) Then nElement2 = xmlDocEnv.CreateElement("FuenteIngreso") nElement.AppendChild(nElement2) For J = 0 To 14 If J = 3 Then strDescripcionOcupacion = ObtenerDescripcionOcupacion(aMatriz(J, K)) If strDescripcionOcupacion <> "NE" Then aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("de_ocupacion") aElement.InnerText = strDescripcionOcupacion nElement2.AppendChild(aElement) Else aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = "" nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("de_ocupacion") aElement.InnerText = "" nElement2.AppendChild(aElement) End If Else If J <> 4 Then aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) End If End If Next ' OHG 22 ENE 2007 - Obtener la moneda del ingreso If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_empleo", 1232, gResponse, gSession) Then Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "Q") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1232") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) Map.PMPasoValores(SqlConn, "@i_trabajo", 0, SQLINT2&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_empleo", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_empleo", strDescError) End If End If aElement = xmlDocEnv.CreateElement("co_moneda") aElement.InnerText = aMatriz2(9, 1) nElement2.AppendChild(aElement) End If Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function #End Region #Region "ConsultarSecuencialesReferenciasPersonales" ' ######################################################################################### ' ConsultarSecuencialesReferenciasPersonales: ' ######################################################################################### Private Function ConsultarSecuencialesReferenciasPersonales(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(14, 20) Dim aCampos(18) As String Dim I, J, K As Integer Dim nElement, nElement2, aElement, aElement2 As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intResultado As Integer Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String aCampos(1) = "no_referencia" aCampos(2) = "nombre" aCampos(3) = "apellido_paterno" aCampos(4) = "apellido_materno" aCampos(5) = "direccion" aCampos(6) = "parentesco" aCampos(7) = "telefono_domicilio" aCampos(8) = "telefono_empresa" aCampos(9) = "telefono_otro" aCampos(10) = "fecha_registro" aCampos(11) = "fecha_modificacion" aCampos(12) = "vigente" aCampos(13) = "verificado" aCampos(14) = "co_parentesco" Try nElement = xmlDocEnv.CreateElement("ReferenciasPersonales") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_refpersonal", 136, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "136") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_refpersonal", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_refpersonal", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If intResultado > 2 Then intResultado = 2 End If For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("ReferenciaPersonal") nElement.AppendChild(nElement2) For J = 0 To 13 aElement = xmlDocEnv.CreateElement(aCampos(J + 1)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) Next Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function #End Region #Region "ConsultarSecuencialesEmail" ' ######################################################################################### ' ConsultarSecuencialesReferenciasPersonales: ' ######################################################################################### Private Function ConsultarSecuencialesEmail(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(13, 20) Dim aCampos(18) As String Dim I, J, K As Integer Dim nElement, nElement2, aElement, aElement2 As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intResultado As Integer Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String Try nElement = xmlDocEnv.CreateElement("Emails") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_email", 1269, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1269") Map.PMPasoValores(SqlConn, "@i_modo", 0, SQLINT1&, "3") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_email", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_email", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If intResultado > 2 Then intResultado = 2 End If For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("Email") nElement.AppendChild(nElement2) aElement = xmlDocEnv.CreateElement("de_email") aElement.InnerText = aMatriz(0, K) nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("co_email") aElement.InnerText = aMatriz(1, K) nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("co_tipo_email") aElement.InnerText = IIf(aMatriz(2, K) = "S", "PERSONAL", "TRABAJO") nElement2.AppendChild(aElement) Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function #End Region #End Region #Region "Internal" Private Function ConsultarReferenciasPersonales(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(14, 20) Dim aCampos(18) As String Dim I, J, K As Integer Dim nElement, nElement2, aElement, aElement2 As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intResultado As Integer Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String 'Dim objAudit As New ServiciosApoyo.Auditoria ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String aCampos(1) = "referencia" aCampos(2) = "nombre" aCampos(3) = "apellido_paterno" aCampos(4) = "apellido_materno" aCampos(5) = "direccion" aCampos(6) = "parentesco" aCampos(7) = "telefono_domicilio" aCampos(8) = "telefono_empresa" aCampos(9) = "telefono_otro" aCampos(10) = "fecha_registro" aCampos(11) = "fecha_modificacion" aCampos(12) = "vigente" aCampos(13) = "verificado" aCampos(14) = "co_parentesco" Try nElement = xmlDocEnv.CreateElement("ReferenciasPersonales") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_refpersonal", 136, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "136") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_refpersonal", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_refpersonal", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If intResultado > 2 Then intResultado = 2 End If For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("ReferenciaPersonal") nElement.AppendChild(nElement2) For J = 0 To 13 aElement = xmlDocEnv.CreateElement(aCampos(J + 1)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) Next Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function Private Function ConsultarPasivos(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(12, 20) Dim aMatriz2(130, 20) Dim aMatriz3(130, 20) Dim aMatriz4(130, 20) Dim aCampos(18) As String Dim I, J, K, L As Integer Dim nElement, nElement2, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado, intResultado2 As Integer Dim decSaldoPromedio, decTotalSaldosCuenta As Decimal Dim decSP1, decSP2, decSP3, decSP4, decSP5, decSP6 As Decimal Dim decTotalPasivosDolares, decTotalPasivosColones As Decimal Dim strTemp As String Dim aTemp() As String Dim decSaldoPromedioTotalColones, decSaldoPromedioTotalDolares, decPlazoFijoDolares, decPlazoFijoColones As Decimal decSaldoPromedioTotalColones = 0 decSaldoPromedioTotalDolares = 0 decTotalSaldosCuenta = 0 decTotalPasivosDolares = 0 decTotalPasivosColones = 0 decPlazoFijoDolares = 0 decPlazoFijoColones = 0 'Dim objAudit As New ServiciosApoyo.Auditoria ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarPasivos" ' CONSULTA DE PASIVOS nElement = xmlDocEnv.CreateElement("Pasivos") rootElement.AppendChild(nElement) Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_cli_posicion", 1176, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "C") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1176") Map.PMPasoValores(SqlConn, "@i_cliente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_cli_posicion", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_cli_posicion", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For K = 1 To intResultado If aMatriz(5, K) <> "0.00" Then nElement2 = xmlDocEnv.CreateElement("Pasivo") nElement.AppendChild(nElement2) aElement = xmlDocEnv.CreateElement("TIPOCUENTA") aElement.InnerText = "Corriente" nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("NUMEROCUENTA") aElement.InnerText = aMatriz(0, K) nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("DISPONIBLE") aElement.InnerText = aMatriz(5, K) nElement2.AppendChild(aElement) ' Consultar los saldos de los últimos 6 meses If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_cuentas.sp_tr_cons_monet_cc", 79, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "79") Map.PMPasoValores(SqlConn, "@i_cta", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) Map.PMPasoValores(SqlConn, "@i_mon", 0, SQLINT1&, CStr(aMatriz(6, K))) Map.PMPasoValores(SqlConn, "@i_empresa", 0, SQLINT2&, "4") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_cuentas", "sp_tr_cons_monet_cc", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz3) intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz4) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If intResultado2 > 6 Then intResultado2 = 6 End If ' Sumar los saldos al corte de cada mes If intResultado2 > 0 Then For L = 1 To intResultado2 decTotalSaldosCuenta = decTotalSaldosCuenta + IIf(IsNumeric(aMatriz4(1, L).ToString().Replace(",", "")), CDec(aMatriz4(1, L).ToString().Replace(",", "")), 0) Next End If ' Calcular el promedio de los saldos decSaldoPromedio = decTotalSaldosCuenta / 6 aElement = xmlDocEnv.CreateElement("SALDOPROMEDIO") aElement.InnerText = Format(decSaldoPromedio, "#,##0.00") nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONEDA") If aMatriz(6, K) = "20" Then aElement.InnerText = "COLONES" decTotalPasivosColones = decTotalPasivosColones + decSaldoPromedio Else aElement.InnerText = "DOLARES" decTotalPasivosDolares = decTotalPasivosDolares + decSaldoPromedio End If nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("CODIGOTIPOCUENTA") aElement.InnerText = aMatriz(7, K) nElement2.AppendChild(aElement) End If ' OHG 31 ENE 2007 - Consultar promedio de ingresos en los últimos tres meses If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_atm.sp_tm_con_datos_tarjeta", 25007, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "25007") Map.PMPasoValores(SqlConn, "@i_cta_banco", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) Map.PMPasoValores(SqlConn, "@i_tipocta", 0, SQLVARCHAR&, "CTE") Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "5") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_atm", "sp_tm_con_datos_tarjeta", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If aMatriz(5, K) <> "0.00" Then aElement = xmlDocEnv.CreateElement("CREDITOPROMEDIO") Dim creditoPromedio As String = IIf(IsNumeric(aMatriz2(0, 1).ToString().Replace(",", "")), aMatriz2(0, 1).ToString().Replace(",", ""), "0") aElement.InnerText = Format(CDec(creditoPromedio), "#,##0.00") nElement2.AppendChild(aElement) strTemp = aMatriz2(1, 1) aTemp = Split(strTemp, "/") If (aTemp.Length >= 3) Then strTemp = aTemp(1) & "/" & aTemp(0) & "/" & aTemp(2) End If aElement = xmlDocEnv.CreateElement("FECHAINICIO") aElement.InnerText = strTemp nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("DEBITOPROMEDIO") Dim debitoPromedio As String = IIf(IsNumeric(aMatriz2(2, 1).ToString().Replace(",", "")), aMatriz2(2, 1).ToString().Replace(",", ""), "0") aElement.InnerText = Format(CDec(debitoPromedio), "#,##0.00") nElement2.AppendChild(aElement) End If Next ' Consulta de Cuentas de Ahorro aCampos(0) = "nu_cuenta" aCampos(1) = "saldo" aCampos(2) = "retenciones" aCampos(3) = "fecha_ult_act" aCampos(4) = "limite_sobregiro" aCampos(5) = "disponible" aCampos(6) = "pignorado" 'aCampos(6) = "pignorado" If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_cli_posicion", 1176, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "A") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1176") Map.PMPasoValores(SqlConn, "@i_cliente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_cli_posicion", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_cli_posicion", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For K = 1 To intResultado If aMatriz(1, K) <> "0.00" Then nElement2 = xmlDocEnv.CreateElement("Pasivo") nElement.AppendChild(nElement2) aElement = xmlDocEnv.CreateElement("TIPOCUENTA") aElement.InnerText = "Ahorro" nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("NUMEROCUENTA") aElement.InnerText = aMatriz(0, K) nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("DISPONIBLE") aElement.InnerText = aMatriz(1, K) nElement2.AppendChild(aElement) ' Consultar los saldos de los últimos 6 meses If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_ahorros.sp_tr_cons_ah", 230, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "230") Map.PMPasoValores(SqlConn, "@i_cta", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) Map.PMPasoValores(SqlConn, "@i_mon", 0, SQLINT1&, CStr(aMatriz(5, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_ahorros", "sp_tr_cons_ah", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If decSP1 = CDec(IIf(IsNumeric(aMatriz2(20, 1).ToString().Replace(",", "")), aMatriz2(20, 1).ToString().Replace(",", ""), "0")) decSP2 = CDec(IIf(IsNumeric(aMatriz2(21, 1).ToString().Replace(",", "")), aMatriz2(21, 1).ToString().Replace(",", ""), "0")) decSP3 = CDec(IIf(IsNumeric(aMatriz2(22, 1).ToString().Replace(",", "")), aMatriz2(22, 1).ToString().Replace(",", ""), "0")) decSP4 = CDec(IIf(IsNumeric(aMatriz2(23, 1).ToString().Replace(",", "")), aMatriz2(23, 1).ToString().Replace(",", ""), "0")) decSP5 = CDec(IIf(IsNumeric(aMatriz2(24, 1).ToString().Replace(",", "")), aMatriz2(24, 1).ToString().Replace(",", ""), "0")) decSP6 = CDec(IIf(IsNumeric(aMatriz2(25, 1).ToString().Replace(",", "")), aMatriz2(25, 1).ToString().Replace(",", ""), "0")) decSaldoPromedio = (decSP1 + decSP2 + decSP3 + decSP4 + decSP5 + decSP6) / 6 aElement = xmlDocEnv.CreateElement("SALDOPROMEDIO") aElement.InnerText = Format(decSaldoPromedio, "#,##0.00") nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONEDA") If aMatriz(5, K) = "20" Then aElement.InnerText = "COLONES" decTotalPasivosColones = decTotalPasivosColones + decSaldoPromedio Else aElement.InnerText = "DOLARES" decTotalPasivosDolares = decTotalPasivosDolares + decSaldoPromedio End If nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("CODIGOTIPOCUENTA") aElement.InnerText = aMatriz(6, K) nElement2.AppendChild(aElement) End If ' OHG 31 ENE 2007 - Consultar promedio de ingresos en los últimos tres meses If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_atm.sp_tm_con_datos_tarjeta", 25007, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "25007") Map.PMPasoValores(SqlConn, "@i_cta_banco", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) Map.PMPasoValores(SqlConn, "@i_tipocta", 0, SQLVARCHAR&, "AHO") Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "5") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_atm", "sp_tm_con_datos_tarjeta", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If aMatriz(1, K) <> "0.00" Then aElement = xmlDocEnv.CreateElement("CREDITOPROMEDIO") Dim sCreditoPromedio As String = IIf(IsNumeric(aMatriz2(0, 1).ToString().Replace(",", "")), aMatriz2(0, 1).ToString().Replace(",", ""), "0") aElement.InnerText = Format(CDec(sCreditoPromedio), "#,##0.00") nElement2.AppendChild(aElement) strTemp = aMatriz2(1, 1) aTemp = Split(strTemp, "/") If (aTemp.Length >= 3) Then strTemp = aTemp(1) & "/" & aTemp(0) & "/" & aTemp(2) End If aElement = xmlDocEnv.CreateElement("FECHAINICIO") aElement.InnerText = strTemp nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("DEBITOPROMEDIO") Dim sDebitoPromedio As String = IIf(IsNumeric(aMatriz2(2, 1).ToString().Replace(",", "")), aMatriz2(2, 1).ToString().Replace(",", ""), "0") aElement.InnerText = Format(CDec(sDebitoPromedio), "#,##0.00") nElement2.AppendChild(aElement) End If Next ' Consulta de Plazos Fijos aCampos(0) = "nu_cuenta" aCampos(1) = "capital" aCampos(2) = "tasa_interes" aCampos(3) = "interes" aCampos(4) = "fecha_vencimiento" aCampos(5) = "pignorado" If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_cli_posicion", 1176, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "F") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1176") Map.PMPasoValores(SqlConn, "@i_cliente", 0, SQLINT4&, CStr(co_ente)) Map.PMPasoValores(SqlConn, "@i_empresa", 0, SQLINT2&, "4") Map.PMPasoValores(SqlConn, "@i_moneda", 0, SQLINT2&, "0") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_cli_posicion", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_cli_posicion", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If nElement = xmlDocEnv.CreateElement("DepositosPlazoFijo") rootElement.AppendChild(nElement) For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("PlazoFijo") nElement.AppendChild(nElement2) For J = 0 To 5 aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) Next Next ' CONSULTA DE PASIVOS nElement = xmlDocEnv.CreateElement("TOTALESPASIVOS") rootElement.AppendChild(nElement) nElement2 = xmlDocEnv.CreateElement("TOTALPASIVOSCOLONES") nElement2.InnerText = decTotalPasivosColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("TOTALPASIVOSDOLARES") nElement2.InnerText = decTotalPasivosDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("TOTALPLAZOSFIJOSCOLONES") nElement2.InnerText = decPlazoFijoColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("TOTALPLAZOSFIJOSDOLARES") nElement2.InnerText = decPlazoFijoDolares nElement.AppendChild(nElement2) Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try 'Throw ex Finally End Try End Function Private Function ConsultarListaNegra(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(50, 2) Dim intResultado As Integer Dim nElement, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim Fecha As String Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim strRespuesta As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String Dim co_info As String 'Dim objAudit As New ServiciosApoyo.Auditoria intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarListaNegra" Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_mala_ref", 120, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "M") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "120") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_mala_ref", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) 'condicion que valida el valor devuelto por el SP, si esta en lista negra S- si esta, 0 no esta co_info = aMatriz(0, 1) If (co_info = "S") Then strRespuesta = "SI" Else strRespuesta = "NO" End If Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg strRespuesta = "NO" End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If nElement = xmlDocEnv.CreateElement("ListaNegra") rootElement.AppendChild(nElement) ' No. Ente aElement = xmlDocEnv.CreateElement("EstaEnListaNegra") aElement.InnerText = strRespuesta nElement.AppendChild(aElement) Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Finally End Try End Function Private Function ConsultarFuentesIngreso(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(15, 20) Dim aMatriz2(30, 30) Dim aCampos(15) As String Dim I, J, K As Integer Dim nElement, nElement2, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado, intResultado2 As Integer Dim strDescripcionOcupacion As String 'Dim objAudit As New ServiciosApoyo.Auditoria ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarFuentesIngreso" aCampos(0) = "nu_fuente_ingreso" aCampos(1) = "co_compania_catalogo" aCampos(2) = "de_compania_normal" aCampos(3) = "co_ocupacion" aCampos(4) = "de_ocupacion" aCampos(5) = "mo_sueldo" aCampos(6) = "co_rango" aCampos(7) = "de_rango" aCampos(8) = "co_verificado" aCampos(9) = "co_vigencia" aCampos(10) = "fe_fecha_mod" aCampos(11) = "co_tipo_empleo" aCampos(12) = "nu_empleado" aCampos(13) = "nu_planilla" aCampos(14) = "nu_segurosocial" Try nElement = xmlDocEnv.CreateElement("FuentesIngresos") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_empleo", 1231, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1231") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_empleo", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For K = 1 To intResultado If (aMatriz(2, K) <> "" And aMatriz(2, K) <> Nothing) And _ (aMatriz(5, K) <> "" And aMatriz(5, K) <> Nothing) Then nElement2 = xmlDocEnv.CreateElement("FuenteIngreso") nElement.AppendChild(nElement2) For J = 0 To 14 If J = 3 Then strDescripcionOcupacion = ObtenerDescripcionOcupacion(aMatriz(J, K)) If strDescripcionOcupacion <> "NE" Then aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("de_ocupacion") aElement.InnerText = strDescripcionOcupacion nElement2.AppendChild(aElement) Else aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = "" nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("de_ocupacion") aElement.InnerText = "" nElement2.AppendChild(aElement) End If Else If J <> 4 Then aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) End If End If Next ' OHG 22 ENE 2007 - Obtener la moneda del ingreso If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_empleo", 1232, gResponse, gSession) Then Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "Q") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1232") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) Map.PMPasoValores(SqlConn, "@i_trabajo", 0, SQLINT2&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_empleo", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_empleo", strDescError) End If End If aElement = xmlDocEnv.CreateElement("co_moneda") aElement.InnerText = aMatriz2(9, 1) nElement2.AppendChild(aElement) End If Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Finally End Try End Function Private Function ObtenerDescripcionOcupacion(ByVal CodOcupacion As String) As String Dim xmlRespuesta As New Xml.XmlDocument 'Dim objConector As New WSConector.Conector 'Dim objAudit As New ServiciosApoyo.Auditoria Dim strFuenteDatos As String = String.Empty Dim strSP As String = String.Empty Dim strRespXml As String Dim aNombreParametro(1), aValorParametro(1) As String Dim strError As String = String.Empty Try If gProceso = Enumerador.ProcesoUltimus.PrestamoPrendario.ToString() Then strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString() strSP = "usp_cp_obtener_descripcion_ocupacion" End If aNombreParametro(1) = "@i_codocupacion" : aValorParametro(1) = CInt(CodOcupacion) strRespXml = outConector.EjecutarComandoSQLArreglo(gProceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0) xmlRespuesta.LoadXml(strRespXml) If xmlRespuesta.SelectSingleNode("NewDataSet").ChildNodes.Count > 0 Then ObtenerDescripcionOcupacion = xmlRespuesta.InnerText Else ObtenerDescripcionOcupacion = "NE" End If Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Finally If strError <> "" Then ObtenerDescripcionOcupacion = "Error: " & strError End If End Try End Function Private Function ConsultarDireccionesSolicitante(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(50, 50) Dim aMatriz2(50, 50) Dim aCampos(19) As String Dim I, J, K, L, M As Integer Dim nElement, aElement, nElement2, aElement2, aElement3 As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado As Integer Dim intResultado2 As Integer Dim DistritoAreaMetro As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarDireccionesSolicitante" aCampos(0) = "nu_direccion" aCampos(1) = "co_pais" aCampos(2) = "de_pais" aCampos(3) = "co_provincia" aCampos(4) = "de_provincia" aCampos(5) = "co_canton" aCampos(6) = "de_canton" aCampos(7) = "co_distrito" aCampos(8) = "de_distrito" aCampos(9) = "co_barrio" aCampos(10) = "de_barrio" aCampos(11) = "co_tipo" aCampos(12) = "de_tipo" aCampos(13) = "de_calle" aCampos(14) = "de_edificio" aCampos(15) = "nu_casa" aCampos(16) = "co_alquilado" aCampos(17) = "mo_mensualidad" aCampos(18) = "de_observacion" aCampos(19) = "co_vigente" 'Dim objAudit As New ServiciosApoyo.Auditoria Try nElement = xmlDocEnv.CreateElement("Direcciones") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_direccion_cons", 1227, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1227") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_direccion_cons", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_direccion_cons", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("Direccion") nElement.AppendChild(nElement2) For J = 0 To 19 aElement = xmlDocEnv.CreateElement(aCampos(J)) aElement.InnerText = aMatriz(J, K) nElement2.AppendChild(aElement) Next DistritoAreaMetro = ObtenerAreaMetro(aMatriz(5, K), aMatriz(7, K)) aElement = xmlDocEnv.CreateElement("co_distrito_area_metro") aElement.InnerText = DistritoAreaMetro nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("Telefonos") nElement2.AppendChild(aElement) ' Obtener los telTfonos para esta direcci=n If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_telefono", 147, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "147") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) Map.PMPasoValores(SqlConn, "@i_direccion", 0, SQLINT1&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_telefono", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If For M = 1 To intResultado2 aElement2 = xmlDocEnv.CreateElement("Telefono") aElement.AppendChild(aElement2) aElement3 = xmlDocEnv.CreateElement("co_telefono") aElement3.InnerText = aMatriz2(0, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("telefono") aElement3.InnerText = aMatriz2(1, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("extension") aElement3.InnerText = aMatriz2(2, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("tipo_telefono") aElement3.InnerText = aMatriz2(3, M) aElement2.AppendChild(aElement3) aElement3 = xmlDocEnv.CreateElement("de_telefono") aElement3.InnerText = aMatriz2(4, M) aElement2.AppendChild(aElement3) Next Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw excError Finally End Try End Function Private Sub IniciarConexionCOBIS() Dim type As Object = Nothing Dim msgno As Object = Nothing Dim severity As Object = Nothing Dim msgtxt As Object = Nothing Dim strError As String = String.Empty 'Dim objAudit As ServiciosApoyo.Auditoria Try 'SqlConn = Map.SqlOpen(CStr(gstrServidorCOBIS), CStr("*" & g_Login), CStr(g_Clave)) SqlConn = Map.SqlOpen(CStr(gstrServidorCOBIS), CStr("" & g_Login), CStr(g_Clave)) If SqlConn > 0 Then gEstatusConexionCOBIS = 1 If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".master.sp_reclogin", 1502, gResponse, gSession) Then ' Envia los parametros del procedimiento Map.PMPasoValores(SqlConn, "@i_role", 0, SQLINT1&, CStr(g_Rol)) Map.PMPasoValores(SqlConn, "@i_server", 0, SQLVARCHAR&, CStr(gstrServidorCOBIS)) Map.PMPasoValores(SqlConn, "@i_login", 0, SQLCHAR&, CStr(g_Login)) Map.PMPasoValores(SqlConn, "@i_terminal", 0, SQLCHAR&, "TERM-CONT") Map.PMPasoValores(SqlConn, "@i_office", 0, SQLINT1&, CStr(g_Oficina)) ' Ejecuto OK If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "master", "sp_reclogin", True, "") Then Map.PMChequea(SqlConn) If Map.FMMapeaMensaje(SqlConn, type, msgno, severity, msgtxt) <> -1 Then Err.Clear() Err.Number = 999 + ERR_COBIS_1 Err.Description = msgtxt Err.Source = "IniciarConexionCOBIS" Err.Raise(Err.Number, Err.Source, Err.Description) End If Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) Err.Clear() Err.Number = 999 ' NO SE COLOCA VTErr_NumErr YA que es tipo Long y causa problema a la hora de ejecutar el RAISE(No devuelve el verdadero mensaje de error) Err.Description = VTErr_Msg Err.Source = "IniciarConexionCOBIS" Err.Raise(Err.Number, Err.Source, Err.Description) End If Else Err.Clear() Err.Number = 512 + ERR_COBIS_2 Err.Description = "COBIS - Error en RPCInit" Err.Source = "IniciarConexionCOBIS" Err.Raise(Err.Number, Err.Source, Err.Description) End If Else Err.Clear() Err.Number = 512 + ERR_COBIS_2 Err.Description = "No se pudo Conectar a la MAP" Err.Source = "IniciarConexionCOBIS" Err.Raise(Err.Number, Err.Source, Err.Description) ''objAudit.grabarLog(gProceso, "ConexionCOBIS", "MapSqlOpen", "E", "NoSePudoConectarALaMAP") End If Catch excError As Exception strError = excError.Message Throw excError Finally If strError <> "" Then If gEstatusConexionCOBIS = 1 Then TerminarConexionCOBIS() End If End If End Try End Sub Private Function ConsultarLoginCOBIS(ByVal g_co_username As String, ByVal g_password As String) As Boolean Dim intNumeroError As Object Dim strDescError As Object Dim strOrigenError As Object Dim co_login, de_clave As String Dim nu_filial, nu_oficina, nu_rol As Integer ''Dim objAudit As New ServiciosApoyo.Auditoria ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarLoginCOBIS" Try ObtenerOficinaUsuario2(g_co_username, g_password) Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Finally If strError <> "" Then Throw excError ConsultarLoginCOBIS = False Else ConsultarLoginCOBIS = True End If End Try End Function Private Function ObtenerOficinaUsuario2(ByVal strUser As String, ByVal strPassword As String) Dim intNumeroError As Object Dim excError As Exception Dim strError As Object Dim strOrigenError As Object Dim strSql, strResp As String Dim conConexion As New Odbc.OdbcConnection Dim comCommand As New Odbc.OdbcCommand Dim dapAdaptador As New Odbc.OdbcDataAdapter Dim dstDatos As New DataSet ''Dim objConector As WSConector.Conector Dim strFuenteDatos As String = String.Empty Dim strSP As String = String.Empty ''Dim objAudit As New ServiciosApoyo.Auditoria Dim aNombreParametro(2), aValorParametro(2) As String Dim xmlDoc As New Xml.XmlDocument Dim xmlRoot As Xml.XmlElement intNumeroError = 0 strOrigenError = "ObtenerUsuarioOficina" strError = "" Try g_Login = strUser ' Obtener los datos de conexión del usuario conConexion.ConnectionString = ObtenerCadenaConexion("sybase") strSql = "SELECT us_login, us_clave, us_oficina, us_filial FROM cobis..ad_usuario WHERE us_login = '" & strUser & "' and us_estado = 'V'" comCommand.Connection = conConexion comCommand.CommandType = CommandType.Text comCommand.CommandText = strSql dapAdaptador.SelectCommand = comCommand conConexion.Open() dapAdaptador.Fill(dstDatos) conConexion.Close() ' Devolver XML strResp = dstDatos.GetXml xmlDoc.LoadXml(strResp) xmlRoot = xmlDoc.DocumentElement.SelectSingleNode("//NewDataSet") If xmlRoot.ChildNodes.Count > 0 Then xmlRoot = xmlDoc.DocumentElement.SelectSingleNode("//NewDataSet/Table") g_Filial = Trim(xmlRoot.SelectSingleNode("us_filial").InnerText) g_Oficina = Trim(xmlRoot.SelectSingleNode("us_oficina").InnerText) g_Clave = Trim(xmlRoot.SelectSingleNode("us_clave").InnerText) Else g_Clave = "" End If ' ########################################################### ' Obtener el Rol con el que se conectará ' ########################################################### If g_Clave <> "" Then If gProceso = Enumerador.ProcesoUltimus.PrestamoPrendario.ToString() Then strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString() strSP = "usp_cp_obtener_rol_usuario" End If aNombreParametro(1) = "@i_modo" : aValorParametro(1) = "0" aNombreParametro(2) = "@i_usuario" : aValorParametro(2) = strUser strResp = outConector.EjecutarComandoSQLArreglo(gProceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0) xmlDoc.LoadXml(strResp) xmlRoot = xmlDoc.DocumentElement.SelectSingleNode("//NewDataSet") If xmlRoot.ChildNodes.Count > 0 Then xmlRoot = xmlDoc.DocumentElement.SelectSingleNode("//NewDataSet/Table") g_Rol = Trim(xmlRoot.SelectSingleNode("Rol").InnerText) g_Filial = Trim(xmlRoot.SelectSingleNode("Filial").InnerText) g_Oficina = Trim(xmlRoot.SelectSingleNode("Oficina").InnerText) Else strError = "Por favor, Ingrese su Rol, Oficina y Filial en la Pantalla de Conexió#¡Muchas Gracias!" Err.Raise(Err.Number, "ObtenerOficinaUsuario2", strError) End If Else strError = "No se pudo encontrar su clave en SYBASE. Consulte a su Administrador" Err.Raise(Err.Number, "ObtenerOficinaUsuario2", strError) End If Catch excError Try If strError = "" Then strError = excError.Message End If ''objAudit.grabarLog(gProceso, "consultaGeneral", "ObtenerOficinaUsuario", "E", strError) Return strError Catch ex As Exception ''grabarError(gProceso, "consultaGeneral", "ObtenerOficinaUsuario", "E", strError) Return strError End Try End Try Return strError End Function Private Function ObtenerCadenaConexion(ByVal FuenteDatos As String) As String Dim strCadena As String = String.Empty Dim objEncriptacion As New LibEncriptacion.Encriptacion Dim strError As String = String.Empty Try strCadena = ReadWebConfig(FuenteDatos) strCadena = objEncriptacion.getCadenaDesencriptada(strCadena, LibEncriptacion.Encriptacion.Llave.PUBLICA, strError) Catch excError As Exception Finally objEncriptacion = Nothing End Try Return strCadena End Function Private Function ReadWebConfig(ByVal Cadena As String) As String Try ReadWebConfig = Configuration.ConfigurationManager.AppSettings(Cadena) Catch ex As Exception Throw ex End Try End Function Private Sub TerminarConexionCOBIS() If SqlConn > 0 Then Map.PMPasoValores(SqlConn, "@i_server", 0, SQLCHAR&, CStr(gstrServidorCOBIS)) Map.PMPasoValores(SqlConn, "@i_login", 0, SQLCHAR&, CStr(g_Login)) Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1502") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "master", "sp_endlogin", True, "") Then Map.PMMapeaVariable(SqlConn, VTresul) Map.PMChequea(SqlConn) End If Map.SqlClose(SqlConn) SqlConn = 0 gEstatusConexionCOBIS = 0 End If End Sub Private Function ConsultarActivos(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(14, 20) Dim aMatriz2(130, 10) Dim aArreglo(100) Dim aCampos(14) As String Dim I, J, K As Integer Dim nElement, nElement2, nElement3, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado, intResultado2 As Integer Dim decAcumuladoColones, decAcumuladoDolares, decCuotaTotalColones, decCuotaTotalDolares As Decimal Dim decHipotecaDolares, decHipotecaColones, decPrendarioDolares, decPrendarioColones, decPersonalDolares, decPersonalColones As Decimal Dim strDiasMora, strTieneOperacionesBanex As String Dim strTemp As String decAcumuladoColones = 0.0 decAcumuladoDolares = 0.0 decCuotaTotalColones = 0.0 decCuotaTotalDolares = 0.0 decHipotecaDolares = 0.0 decHipotecaColones = 0.0 decPrendarioDolares = 0.0 decPrendarioColones = 0.0 decPersonalDolares = 0.0 decPersonalColones = 0.0 strTieneOperacionesBanex = "NO" ' Variables para Manejo de Errores Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarActivos" ' CONSULTA DE ACTIVOS nElement = xmlDocEnv.CreateElement("Activos") rootElement.AppendChild(nElement) ' Consulta de PrTstamos aCampos(0) = "nu_cuenta" aCampos(1) = "co_tipo" aCampos(2) = "tipo" aCampos(3) = "valor_inicial" aCampos(4) = "saldo" aCampos(5) = "tasa_interes" aCampos(6) = "interes" aCampos(7) = "cuenta_sabe" aCampos(8) = "fecha_vencimiento" aCampos(9) = "linea_credito" aCampos(10) = "tipo_linea" aCampos(11) = "rol" aCampos(12) = "cuota" aCampos(13) = "frecuencia" Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_cli_posicion", 1176, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "P") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1176") Map.PMPasoValores(SqlConn, "@i_modo", 0, SQLINT1&, "0") Map.PMPasoValores(SqlConn, "@i_cliente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_cli_posicion", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_cli_posicion", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If nElement2 = xmlDocEnv.CreateElement("Prestamos") nElement.AppendChild(nElement2) For K = 1 To intResultado nElement3 = xmlDocEnv.CreateElement("Prestamo") nElement2.AppendChild(nElement3) intResultado2 = 0 ' Consulta de PrTstamos 'aCampos(0) = "TIPOOPERACION" 'aCampos(1) = "OPERACION" 'aCampos(2) = "CUOTAMENSUAL" 'aCampos(3) = "SALDOACTUAL" 'aCampos(4) = "FECHAVENCIMIENTO" 'aCampos(5) = "ESTADO" 'aCampos(6) = "MONTOORIGINAL" 'aCampos(7) = "FECHAINICIO" 'aCampos(8) = "MONEDA" aElement = xmlDocEnv.CreateElement("TIPOOPERACION") aElement.InnerText = aMatriz(2, K) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("OPERACION") aElement.InnerText = aMatriz(0, K) nElement3.AppendChild(aElement) If Mid(aMatriz(0, K), 3, 1) = "4" Then strTieneOperacionesBanex = "SI" End If If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_cartera.sp_qr_operacion", 7037, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "Q") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "7037") Map.PMPasoValores(SqlConn, "@i_codigo", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_cartera", "sp_qr_operacion", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = intNumeroError & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_qr_operacion", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If ' OHG 31 ENE 2007 - Se obtendrá la cuota mensual con otro SP, por eso se comentan las siguientes lfneas 'aElement = xmlDocEnv.CreateElement("CUOTAMENSUAL") 'aElement.InnerText = aMatriz2(42, 1) 'nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("SALDOACTUAL") aElement.InnerText = aMatriz(4, K) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("FECHAVENCIMIENTO") aElement.InnerText = aMatriz(8, K) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONTOORIGINAL") aElement.InnerText = aMatriz(3, K) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("ESTADO") aElement.InnerText = aMatriz2(29, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("FECHAINICIO") aElement.InnerText = aMatriz2(2, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONEDA") If aMatriz(12, K) = "20" Then aElement.InnerText = "COLONES" decCuotaTotalColones = decCuotaTotalColones + (CDec(Replace(Replace(aMatriz2(43, 1), ",", ""), ".", "")) / 100) decAcumuladoColones = decAcumuladoColones + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Select Case Trim(aMatriz(1, K)) Case "PCON" decPersonalColones = decPersonalColones + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Case "PCREFA" decPersonalColones = decPersonalColones + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Case "HVI" decHipotecaColones = decHipotecaColones + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Case "AUT" decPrendarioColones = decPrendarioColones + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) End Select Else aElement.InnerText = "DOLARES" decCuotaTotalDolares = decCuotaTotalDolares + (CDec(Replace(Replace(aMatriz2(43, 1), ",", ""), ".", "")) / 100) decAcumuladoDolares = decAcumuladoDolares + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Select Case Trim(aMatriz(1, K)) Case "PCON" decPersonalDolares = decPersonalDolares + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Case "PCREFA" decPersonalColones = decPersonalColones + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Case "HVI" decHipotecaDolares = decHipotecaDolares + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) Case "AUT" decPrendarioDolares = decPrendarioDolares + (CDec(Replace(Replace(aMatriz(4, K), ",", ""), ".", "")) / 100) End Select End If nElement3.AppendChild(aElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_cartera.sp_consulta_ultimus", 7980, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "7980") Map.PMPasoValores(SqlConn, "@i_codigo", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_cartera", "sp_consulta_ultimus", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_consulta_ultimus", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If aElement = xmlDocEnv.CreateElement("DIASMORA") aElement.InnerText = aMatriz2(11, 1) nElement3.AppendChild(aElement) ' OHG 31 ENE 2007 - Obtener la cuota de la operaci=n de crTdito completa (capital, interTs, seguro) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_cartera.sp_con_datos_cartera", 7433, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "A") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "7433") Map.PMPasoValores(SqlConn, "@i_oper_banco", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) Map.PMPasoValores(SqlConn, "@o_coderror", 0, SQLINT2&, "0") Map.PMPasoValores(SqlConn, "@o_menerror", 0, SQLVARCHAR&, "") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_cartera", "sp_con_datos_cartera", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = intNumeroError & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_con_datos_cartera", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If aElement = xmlDocEnv.CreateElement("CUOTAMENSUAL") aElement.InnerText = aMatriz2(0, 1) nElement3.AppendChild(aElement) Next nElement2 = xmlDocEnv.CreateElement("ACUMULADOCOLONES") nElement2.InnerText = decAcumuladoColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("ACUMULADODOLARES") nElement2.InnerText = decAcumuladoDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("CUOTATOTALCOLONES") nElement2.InnerText = decCuotaTotalColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("CUOTATOTALDOLARES") nElement2.InnerText = decCuotaTotalDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("HIPOTECACOLONES") nElement2.InnerText = decHipotecaColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("HIPOTECADOLARES") nElement2.InnerText = decHipotecaDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("PRENDARIOCOLONES") nElement2.InnerText = decPrendarioColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("PRENDARIODOLARES") nElement2.InnerText = decPrendarioDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("PERSONALCOLONES") nElement2.InnerText = decPersonalColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("PERSONALDOLARES") nElement2.InnerText = decPersonalDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("TIENEOPERACIONESBANEX") nElement2.InnerText = strTieneOperacionesBanex nElement.AppendChild(nElement2) Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function Private Function Consulta_Desc_TipoID(ByVal Co_TipoID As String) 'Dim objConector As WSConector.Conector Dim strSql As String = String.Empty Dim strResp As String = String.Empty Dim strFuenteDatos As String = String.Empty Dim aNombreParametro(4), aValorParametro(4) As String Dim strError As String = String.Empty Dim De_TipoID As String = String.Empty 'Dim objAudit As New ServiciosApoyo.Auditoria Dim xmlDoc As New Xml.XmlDocument Dim xmlRoot As Xml.XmlElement 'objConector = New WSConector.Conector If gProceso = Enumerador.ProcesoUltimus.PrestamoPrendario.ToString() Then strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString() strSql = "usp_cp_obtener_catalogos" End If Try aNombreParametro(1) = "@i_catalogo" : aValorParametro(1) = "TIPO_IDENTIFICACION" aNombreParametro(2) = "@i_criteria" : aValorParametro(2) = "" aNombreParametro(3) = "@i_filtro" : aValorParametro(3) = Co_TipoID aNombreParametro(4) = "@i_modo" : aValorParametro(4) = 0 strResp = outConector.EjecutarComandoSQLArreglo(gProceso, strFuenteDatos, strSql, aNombreParametro, aValorParametro, 0) xmlDoc.LoadXml(strResp) If xmlDoc.ChildNodes.Count > 0 Then xmlRoot = xmlDoc.DocumentElement.SelectSingleNode("//NewDataSet/Table") De_TipoID = Trim(xmlRoot.SelectSingleNode("Descripcion").InnerText) Else Err.Raise(5366, "usp_cp_obtener_catalogos", "No se pudo encontrar la Descripci=n para el Tipo de Identificaci=n") End If Return De_TipoID Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function Private Function ConsultarDatosGenerales(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(70, 2) Dim intResultado, i As Integer Dim nElement, aElement As Xml.XmlElement Dim nElement2, child As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim Fecha As String Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim codigo, descripcion As String Dim xmlDoc As New Xml.XmlDocument 'Dim objConector As New WSConector.Conector ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String 'Dim objAudit As New ServiciosApoyo.Auditoria intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarDatosGenerales" Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_persona_cons", 132, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "Q") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "132") Map.PMPasoValores(SqlConn, "@i_persona", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_persona_cons", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_persona_cons", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If nElement = xmlDocEnv.CreateElement("Detalle") rootElement.AppendChild(nElement) ' No. Ente aElement = xmlDocEnv.CreateElement("co_ente") aElement.InnerText = co_ente nElement.AppendChild(aElement) '******************************************************************************** '15/07/2008 - EO: Ajuste para retornar número de identificaci=n y tipo de persona '******************************************************************************** Dim co_identificacion As String = "" Dim identificacion As String = "" Dim tipo_persona As String = "" Dim comp, de_tipo_persona As String Dim flag As Integer = 0 co_identificacion = aMatriz(29, 1).Trim() tipo_persona = aMatriz(46, 1).Trim() If co_identificacion = "P" Then identificacion = aMatriz(6, 1).Trim() Else identificacion = aMatriz(5, 1).Trim() End If xmlDoc = ConsultarCatalogos("cl_rel_ptipo") If xmlDoc Is Nothing = False Then nElement2 = xmlDoc.SelectSingleNode("//Resultado") For i = 0 To nElement2.ChildNodes.Count - 1 child = nElement2.ChildNodes(i) codigo = child.SelectSingleNode("codigo").InnerText descripcion = child.SelectSingleNode("descripcion").InnerText.Trim().Substring(0, 1) If tipo_persona = descripcion Then flag = 1 Exit For End If Next If flag = 0 Then Err.Raise(5367, "Valida_COBISvsCatalogo", "El C=digo de Tipo de Persona (" & tipo_persona & ") guardado en el MIS no se encuentra en la tabla (cl_rel_ptipo)") End If End If If codigo = "9" Then codigo = "11" End If de_tipo_persona = Consulta_Desc_TipoID(codigo) ' Codigo Identificacion aElement = xmlDocEnv.CreateElement("co_identificacion") aElement.InnerText = co_identificacion nElement.AppendChild(aElement) ' Identificacion aElement = xmlDocEnv.CreateElement("g_identificacion_cobis") aElement.InnerText = identificacion nElement.AppendChild(aElement) ' Codigo Tipo Persona aElement = xmlDocEnv.CreateElement("g_co_tipo_identificacion") aElement.InnerText = codigo nElement.AppendChild(aElement) ' Descripcion Tipo Persona aElement = xmlDocEnv.CreateElement("g_tipo_identificacion") aElement.InnerText = de_tipo_persona nElement.AppendChild(aElement) '**************************************************************************** ' Apellido Paterno aElement = xmlDocEnv.CreateElement("apellido_paterno") aElement.InnerText = aMatriz(0, 1) nElement.AppendChild(aElement) ' Apellido Materno aElement = xmlDocEnv.CreateElement("apellido_materno") aElement.InnerText = aMatriz(1, 1) nElement.AppendChild(aElement) ' Apellido Casada aElement = xmlDocEnv.CreateElement("apellido_casada") aElement.InnerText = aMatriz(28, 1) nElement.AppendChild(aElement) ' Primer Nombre aElement = xmlDocEnv.CreateElement("primer_nombre") aElement.InnerText = aMatriz(2, 1) nElement.AppendChild(aElement) ' Segundo Nombre aElement = xmlDocEnv.CreateElement("segundo_nombre") aElement.InnerText = aMatriz(27, 1) nElement.AppendChild(aElement) ' Fecha Nacimiento aElement = xmlDocEnv.CreateElement("fecha_nacimiento") aElement.InnerText = aMatriz(17, 1) nElement.AppendChild(aElement) ' Seguro Social aElement = xmlDocEnv.CreateElement("seguro_social") aElement.InnerText = aMatriz(30, 1) nElement.AppendChild(aElement) ' Seguro Social aElement = xmlDocEnv.CreateElement("co_sexo") aElement.InnerText = aMatriz(3, 1) nElement.AppendChild(aElement) ' C=digo de Nacionalidad aElement = xmlDocEnv.CreateElement("co_nacionalidad") aElement.InnerText = aMatriz(7, 1) nElement.AppendChild(aElement) ' Nacionalidad aElement = xmlDocEnv.CreateElement("nacionalidad") aElement.InnerText = aMatriz(8, 1) nElement.AppendChild(aElement) ' Estado Civil aElement = xmlDocEnv.CreateElement("estado_civil") aElement.InnerText = aMatriz(13, 1) nElement.AppendChild(aElement) ' Codigo de Profesion aElement = xmlDocEnv.CreateElement("co_profesion") aElement.InnerText = aMatriz(9, 1) nElement.AppendChild(aElement) ' Profesion aElement = xmlDocEnv.CreateElement("profesion") aElement.InnerText = aMatriz(10, 1) nElement.AppendChild(aElement) ' Calificacion aElement = xmlDocEnv.CreateElement("calificacion") aElement.InnerText = aMatriz(31, 1) nElement.AppendChild(aElement) ' Genera Divisas aElement = xmlDocEnv.CreateElement("genera_divisas") aElement.InnerText = aMatriz(42, 1) nElement.AppendChild(aElement) ' Fecha de Vencimiento aElement = xmlDocEnv.CreateElement("fecha_vencimiento") aElement.InnerText = aMatriz(43, 1) nElement.AppendChild(aElement) '******************************************************************************** '29/07/2008 - EO: Ajuste para retornar el estado del cliente con el Banco '******************************************************************************** ' Estado del Cliente con el Banco aElement = xmlDocEnv.CreateElement("estado_con_banco") aElement.InnerText = aMatriz(36, 1) nElement.AppendChild(aElement) '******************************************************************************** 'IFRS 25052017-- Ajuste para retornar el grupo economico '******************************************************************************** ' Grupo Económico IFRS 22-05-2017 aElement = xmlDocEnv.CreateElement("grupo_economico") aElement.InnerText = aMatriz(20, 1) nElement.AppendChild(aElement) '******************************************************************************** '22/08/2008 - EO: Ajuste para retornar el Pais de Nacimiento '******************************************************************************** Dim strFuenteDatos As String = String.Empty Dim strSql As String = String.Empty Dim objDataSet As New DataSet Dim pais_nac As String Dim co_pais_nac As String = aMatriz(51, 1) Try If co_pais_nac.Trim().Length > 0 Then If gProceso = Enumerador.ProcesoUltimus.PrestamoPrendario.ToString() Then strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString() strSql = "SELECT Pais FROM Catalogos.Nacionalidad WHERE IdNacionalidad = " & co_pais_nac End If objDataSet = outConector.EjecutarComandoSQLXMLDataSet(gProceso, strFuenteDatos, strSql) pais_nac = objDataSet.Tables(0).Rows(0).Item(0).ToString() Else pais_nac = "" End If Catch ex As Exception pais_nac = "" End Try ' Codigo de Pais de Nacimiento aElement = xmlDocEnv.CreateElement("co_pais_nacimiento") aElement.InnerText = co_pais_nac nElement.AppendChild(aElement) ' Pais de Nacimiento aElement = xmlDocEnv.CreateElement("pais_nacimiento") aElement.InnerText = pais_nac nElement.AppendChild(aElement) '******************************************************************************** Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function Private Function ConsultarCatalogos(ByVal Tabla As String) As XmlDocument Dim aMatriz(2, 20) Dim intResultado, i As Integer Dim xmlDoc As Xml.XmlDocument Dim root, nElement, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim Fecha As String Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String 'Dim objAudit As New ServiciosApoyo.Auditoria intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarCatalogos" Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_hp_catalogo", "601", gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_tabla", 0, SQLVARCHAR&, Tabla) Map.PMPasoValores(SqlConn, "@i_tipo", 0, SQLVARCHAR&, "A") Map.PMPasoValores(SqlConn, "@i_modo", 0, SQLINT2&, "0") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_hp_catalogo", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_persona_cons", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If xmlDoc = New Xml.XmlDocument objPI = xmlDoc.CreateProcessingInstruction("xml", "version='1.0'") xmlDoc.AppendChild(objPI) root = xmlDoc.CreateElement("Resultado") xmlDoc.AppendChild(root) For i = 1 To intResultado nElement = xmlDoc.CreateElement("Detalle") root.AppendChild(nElement) 'C=digo aElement = xmlDoc.CreateElement("codigo") aElement.InnerText = aMatriz(0, i) nElement.AppendChild(aElement) 'Descripci=n aElement = xmlDoc.CreateElement("descripcion") aElement.InnerText = aMatriz(1, i) nElement.AppendChild(aElement) Next If intResultado = 0 Then intNumeroError = 4367 strDescError = "No se encontraron registros en la tabla " & Tabla Err.Raise(intNumeroError, "sp_hp_catalogo", strDescError) End If Return xmlDoc Catch ex As Exception log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Throw ex End Try End Function Private Function ObtenerAreaMetro(ByVal CTCanton As String, ByVal CTDistrito As String) As String Dim xmlRespuesta As New Xml.XmlDocument 'Dim objConector As New WSConector.Conector 'Dim objAudit As New ServiciosApoyo.Auditoria Dim strFuenteDatos As String = String.Empty Dim strSP As String = String.Empty Dim strRespXml As String Dim aNombreParametro(2), aValorParametro(2) As String Dim strError As String = String.Empty Try If gProceso = Enumerador.ProcesoUltimus.PrestamoPrendario.ToString() Then strFuenteDatos = Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString() strSP = "usp_cp_obtener_area_metro" End If aNombreParametro(1) = "@co_canton" : aValorParametro(1) = CTCanton aNombreParametro(2) = "@co_distrito" : aValorParametro(2) = CTDistrito strRespXml = outConector.EjecutarComandoSQLArreglo(gProceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0) xmlRespuesta.LoadXml(strRespXml) If xmlRespuesta.SelectSingleNode("NewDataSet").ChildNodes.Count > 0 Then ObtenerAreaMetro = xmlRespuesta.SelectSingleNode("//NewDataSet/Table/AreaMetro").InnerText Else ObtenerAreaMetro = "" End If Catch ex As Exception log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) ObtenerAreaMetro = "Error: " & strError Finally End Try End Function Private Function ConsultarEmail(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(13, 20) Dim aCampos(18) As String Dim I, J, K As Integer Dim nElement, nElement2, aElement, aElement2 As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intResultado As Integer Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String 'Dim objAudit As New ServiciosApoyo.Auditoria ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String Try nElement = xmlDocEnv.CreateElement("Emails") rootElement.AppendChild(nElement) If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_email", 1269, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "S") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1269") Map.PMPasoValores(SqlConn, "@i_modo", 0, SQLINT1&, "1") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_email", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_email", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If intResultado > 2 Then intResultado = 2 End If For K = 1 To intResultado nElement2 = xmlDocEnv.CreateElement("Email") nElement.AppendChild(nElement2) aElement = xmlDocEnv.CreateElement("co_email") aElement.InnerText = K nElement2.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("de_email") aElement.InnerText = aMatriz(0, K) nElement2.AppendChild(aElement) Next Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw excError Finally End Try End Function Private Function ConsultarEnteSolicitante(ByVal Proceso As String, ByVal strIdentificacion As String, ByVal strTipoIdentificacion As String) As String Dim co_ente As String Dim intResp As Integer Dim intElem As Integer Dim intNumeroError As Object Dim strDescError As Object Dim strOrigenError As Object Dim aMatriz(100, 100) Dim intResultado As Integer intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarEnteSolicitante" Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_se_ente", 1182, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_subtipo", 0, SQLCHAR&, "P") ' i_tipo = 2 para Cedula; i_tipo = 3 para Pasaporte If strTipoIdentificacion = "C" Then Map.PMPasoValores(SqlConn, "@i_tipo", 0, SQLINT1&, "2") Else Map.PMPasoValores(SqlConn, "@i_tipo", 0, SQLINT1&, "3") End If Map.PMPasoValores(SqlConn, "@i_modo", 0, SQLINT1&, "0") Map.PMPasoValores(SqlConn, "@i_nombre_bus", 0, SQLVARCHAR&, "%") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT4&, "1182") Map.PMPasoValores(SqlConn, "@i_valor", 0, SQLVARCHAR&, CStr(strIdentificacion)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_se_ente", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) If intResultado <> 0 Then co_ente = aMatriz(0, 1) Else co_ente = "0" End If Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_se_ente", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try strDescError = ex.Message strOrigenError = ex.Source Finally If intNumeroError <> 0 Then Select Case intNumeroError Case -2147220988 ConsultarEnteSolicitante = "0" Case Else Err.Raise(intNumeroError, strOrigenError, strDescError) End Select Else ConsultarEnteSolicitante = co_ente End If End Try End Function Private Function ConsultarScoring(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(15, 2) Dim aMatriz2(8, 50) Dim aMatriz3(2, 20) Dim intResultado, intResultado2, intResultado3 As Integer Dim nElement, nElement2, aElement, cElement As Xml.XmlElement 'Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim i As Integer Dim producto As String ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String 'Dim objAudit As New ServiciosApoyo.Auditoria intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarScoring" Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cobis.sp_cons_scoring_ente", 1273, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "1273") Map.PMPasoValores(SqlConn, "@i_ente", 0, SQLINT4&, CStr(co_ente)) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cobis", "sp_cons_scoring_ente", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) intResultado3 = Map.FMMapeaMatriz(SqlConn, aMatriz3) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_cons_scoring_ente", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If nElement = xmlDocEnv.CreateElement("Scoring") rootElement.AppendChild(nElement) ' Fecha de Creacion del Ente aElement = xmlDocEnv.CreateElement("fe_creacion") aElement.InnerText = aMatriz(0, 1) nElement.AppendChild(aElement) ' Fecha de Aperura del Ultimo Producto aElement = xmlDocEnv.CreateElement("fe_ultimo_producto") aElement.InnerText = aMatriz(1, 1) nElement.AppendChild(aElement) ' Cantidad de Creditos Cancelados aElement = xmlDocEnv.CreateElement("creditos_cancelados") aElement.InnerText = aMatriz(2, 1) nElement.AppendChild(aElement) ' Cantidad de Cheques Devueltos aElement = xmlDocEnv.CreateElement("cheques_devueltos") aElement.InnerText = aMatriz(3, 1) nElement.AppendChild(aElement) ' Marca de Castigo o Incobrable aElement = xmlDocEnv.CreateElement("castigado") aElement.InnerText = aMatriz(4, 1) nElement.AppendChild(aElement) ' Maximo Atraso Historico aElement = xmlDocEnv.CreateElement("max_atraso_historico") aElement.InnerText = aMatriz(5, 1) nElement.AppendChild(aElement) ' Maximo Atraso en los ultimos 12 meses aElement = xmlDocEnv.CreateElement("max_atraso_12m") aElement.InnerText = aMatriz(6, 1) nElement.AppendChild(aElement) ' Maximo Atraso en los ultimos 6 meses aElement = xmlDocEnv.CreateElement("max_atraso_6m") aElement.InnerText = aMatriz(7, 1) nElement.AppendChild(aElement) ' Maximo Atraso en los ultimos 3 meses aElement = xmlDocEnv.CreateElement("max_atraso_3m") aElement.InnerText = aMatriz(8, 1) nElement.AppendChild(aElement) ' Cantidad de Operaciones Canceladas aElement = xmlDocEnv.CreateElement("operaciones_canceladas_6m") aElement.InnerText = aMatriz(9, 1) nElement.AppendChild(aElement) ' Numero de Atrasas de Maximo 30 dias durante los 9 meses anteriores aElement = xmlDocEnv.CreateElement("atrasos_30dias") aElement.InnerText = aMatriz(10, 1) nElement.AppendChild(aElement) ' Morosidad aElement = xmlDocEnv.CreateElement("morosidad") aElement.InnerText = aMatriz(11, 1) nElement.AppendChild(aElement) ' Producto Reestructurado aElement = xmlDocEnv.CreateElement("reestructurado") aElement.InnerText = aMatriz(12, 1) nElement.AppendChild(aElement) ' Relacion del Cliente con el Banco aElement = xmlDocEnv.CreateElement("relclientebanco") aElement.InnerText = aMatriz(13, 1) nElement.AppendChild(aElement) '******************************************************************* '03-03-2009 EO Ajuste para capturar el detalle del scoring '******************************************************************* If intResultado2 > 0 Then nElement2 = xmlDocEnv.CreateElement("ScoringDetalle") rootElement.AppendChild(nElement2) For i = 1 To intResultado2 aElement = xmlDocEnv.CreateElement("Operacion" & i + 1) nElement2.AppendChild(aElement) ' Tipo de Operaci=n cElement = xmlDocEnv.CreateElement("toperacion") cElement.InnerText = aMatriz2(0, i) aElement.AppendChild(cElement) ' Maximo Atraso Historico cElement = xmlDocEnv.CreateElement("max_atraso_hist") cElement.InnerText = aMatriz2(1, i) aElement.AppendChild(cElement) ' Maximo atrase en 3 meses cElement = xmlDocEnv.CreateElement("max_atraso_3m") cElement.InnerText = aMatriz2(2, i) aElement.AppendChild(cElement) ' Maximo atraso en 6 meses cElement = xmlDocEnv.CreateElement("max_atraso_6m") cElement.InnerText = aMatriz2(3, i) aElement.AppendChild(cElement) ' Maximo atraso en 12 meses cElement = xmlDocEnv.CreateElement("max_atraso_12m") cElement.InnerText = aMatriz2(4, i) aElement.AppendChild(cElement) ' Maximo atraso actual cElement = xmlDocEnv.CreateElement("max_atraso_act") cElement.InnerText = aMatriz2(5, i) aElement.AppendChild(cElement) ' Atraso de 30 dias cElement = xmlDocEnv.CreateElement("ds_atraso_30d") cElement.InnerText = aMatriz2(6, i) aElement.AppendChild(cElement) ' Producto Castigado cElement = xmlDocEnv.CreateElement("prod_castigado") cElement.InnerText = aMatriz2(7, i) aElement.AppendChild(cElement) Next End If '********************************************************************** '24-06-2009 EO Ajuste para retornar exposicion del cliente por producto '********************************************************************** If intResultado3 > 0 Then For i = 1 To intResultado3 producto = aMatriz3(0, i).ToUpper().Trim() Select Case producto.Trim() Case "AUTOS" ' Exposicion Autos aElement = xmlDocEnv.CreateElement("exposicion_aut") aElement.InnerText = aMatriz3(1, i).Replace(",", "") nElement.AppendChild(aElement) Case "CONSUMIDOR" ' Exposicion Perosnales aElement = xmlDocEnv.CreateElement("exposicion_per") aElement.InnerText = aMatriz3(1, i).Replace(",", "") nElement.AppendChild(aElement) Case "HIPOTECAS" ' Exposicion Hipotecas aElement = xmlDocEnv.CreateElement("exposicion_hip") aElement.InnerText = aMatriz3(1, i).Replace(",", "") nElement.AppendChild(aElement) Case "TARJETAS" ' Exposicion Tarjetas aElement = xmlDocEnv.CreateElement("exposicion_tar") aElement.InnerText = aMatriz3(1, i).Replace(",", "") nElement.AppendChild(aElement) End Select Next End If Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function Private Function ConsultarTarjetas(ByVal Proceso As String, ByVal co_ente As String) Dim aMatriz(14, 45) Dim aMatriz2(130, 10) Dim aMatriz3(130, 10) Dim aArreglo(100) Dim aCampos(14) As String Dim I, J, K As Integer Dim nElement, nElement2, nElement3, aElement As Xml.XmlElement Dim objPI As Xml.XmlProcessingInstruction Dim intNumeroError As Integer Dim strDescError As String Dim strOrigenError As String Dim intResultado, intResultado2, intResultado3 As Integer Dim decAcumuladoColones, decAcumuladoDolares, decSaldoTotalColones, decSaldoTotalDolares As Decimal Dim strTemp As String Dim aTemp() As String Dim strLimite As String Dim strCodMoneda As String Dim PagoMinimo1, PagoMinimo2 As String Dim strFeUltPago1, strFeUltPago2 As String Dim arrFeUltPago1(), arrFeUltPago2() As String decAcumuladoColones = 0.0 decAcumuladoDolares = 0.0 decSaldoTotalColones = 0.0 decSaldoTotalDolares = 0.0 'Dim objAudit As New ServiciosApoyo.Auditoria ' Variables para Manejo de Errores Dim excError As Exception Dim strError As String intNumeroError = 0 strDescError = "" strOrigenError = "ConsultarTarjetas" ' CONSULTA DE ACTIVOS nElement = xmlDocEnv.CreateElement("TarjetasCredito") rootElement.AppendChild(nElement) Try If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_atm.sp_tm_listar_tarjetas_cliente", 25008, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "25008") Map.PMPasoValores(SqlConn, "@i_cliente", 0, SQLINT4&, CStr(co_ente)) ' OHG 22 FEB 2007 - Se agreg= parámetro adicional para optimizar la búsqueda Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "B") If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_atm", "sp_tm_listar_tarjetas_cliente", True, "") Then intResultado = Map.FMMapeaMatriz(SqlConn, aMatriz) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg Err.Raise(intNumeroError, "sp_cli_posicion", strDescError) End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If nElement2 = xmlDocEnv.CreateElement("Tarjetas") nElement.AppendChild(nElement2) For K = 1 To intResultado If aMatriz(1, K) = "A" Then intResultado2 = 0 ' Obtener detalle de Tarjetas de Credito If Map.FMRpcInit(SqlConn, CStr(gstrServidorCOBIS) & ".cob_atm.sp_tm_con_datos_tarjeta", 25007, gResponse, gSession) Then ' Envia el paso de parámetros Map.PMPasoValores(SqlConn, "@i_operacion", 0, SQLCHAR&, "1") Map.PMPasoValores(SqlConn, "@t_trn", 0, SQLINT2&, "25007") Map.PMPasoValores(SqlConn, "@i_codigo", 0, SQLVARCHAR&, CStr(aMatriz(0, K))) If Map.FMTransmitirRPC(SqlConn, CStr(gstrServidorCOBIS), "cob_atm", "sp_tm_con_datos_tarjeta", True, "") Then intResultado2 = Map.FMMapeaMatriz(SqlConn, aMatriz2) intResultado3 = Map.FMMapeaMatriz(SqlConn, aMatriz3) Map.PMChequea(SqlConn) Else Map.FMMapeaMensaje(SqlConn, VTErr_Tipo, VTErr_NumErr, VTErr_Sev, VTErr_Msg) Map.PMChequea(SqlConn) intNumeroError = vbObjectError + 512 + ERR_COBIS_4 strDescError = VTErr_NumErr & "- " & VTErr_Sev & "- " & VTErr_Msg End If VTRetStatus = Map.FMRetStatus(SqlConn) Map.PMChequea(SqlConn) End If If aMatriz2(6, 1) <> Nothing And aMatriz2(6, 1) <> "0.00" Then strLimite = aMatriz2(6, 1) strCodMoneda = "20" decSaldoTotalColones = decSaldoTotalColones + (CDec(Replace(Replace(aMatriz2(3, 1), ",", ""), ".", "")) / 100) decAcumuladoColones = decAcumuladoColones + (CDec(Replace(Replace(strLimite, ",", ""), ".", "")) / 100) Else If aMatriz2(7, 1) <> Nothing And aMatriz2(7, 1) <> "0.00" Then strLimite = aMatriz2(7, 1) strCodMoneda = "0" Else strLimite = "0" strCodMoneda = "0" End If decSaldoTotalDolares = decSaldoTotalDolares + (CDec(Replace(Replace(aMatriz2(4, 1), ",", ""), ".", "")) / 100) decAcumuladoDolares = decAcumuladoDolares + (CDec(Replace(Replace(strLimite, ",", ""), ".", "")) / 100) End If ' OHG 19 FEB 2007 - Se agreg= una condici=n con intResultado2 para evitar que trate de buscar datos de Tarjetas de CrTdito If (strLimite <> "0" And strLimite <> "0.00") And (aMatriz2(16, 1) = "C") And (intResultado2 > 0) Then nElement3 = xmlDocEnv.CreateElement("Tarjeta") nElement2.AppendChild(nElement3) aElement = xmlDocEnv.CreateElement("TITULARTARJETA") aElement.InnerText = aMatriz2(1, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONEDA") aElement.InnerText = "COLONES" nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("LIMITE") aElement.InnerText = aMatriz2(6, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("SALDO") aElement.InnerText = aMatriz2(3, 1) nElement3.AppendChild(aElement) If Double.Parse(aMatriz3(0, 1).ToString().Replace(",", "")) < 0 Then PagoMinimo1 = "0.00" Else PagoMinimo1 = aMatriz3(0, 1) End If aElement = xmlDocEnv.CreateElement("PAGOMINIMO") aElement.InnerText = PagoMinimo1 nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("CLASIFICACIONPAGO") aElement.InnerText = aMatriz3(4, 1) & " - " & aMatriz3(5, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("ESTADO") aElement.InnerText = aMatriz2(5, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("DIASATRASO") aElement.InnerText = aMatriz3(6, 1) nElement3.AppendChild(aElement) ' OHG 31 ENE 2007 - Ajuste para la fecha de apertura se presente en formato dd/mm/yyyy strTemp = aMatriz2(2, 1) If Len(Trim(strTemp)) > 0 Then aTemp = Split(strTemp, "/") If (aTemp.Length >= 3) Then strTemp = aTemp(1) & "/" & aTemp(0) & "/" & aTemp(2) End If End If aElement = xmlDocEnv.CreateElement("FECHAAPERTURA") aElement.InnerText = strTemp ' OHG 31 ENE 2007 nElement3.AppendChild(aElement) 'AAP Para mostrar fecha en formato dd/MM/yyyy strFeUltPago1 = aMatriz3(2, 1) If Len(Trim(strFeUltPago1)) > 0 Then arrFeUltPago1 = Split(strFeUltPago1, "/") If (arrFeUltPago1.Length >= 3) Then strFeUltPago1 = arrFeUltPago1(1) & "/" & arrFeUltPago1(0) & "/" & arrFeUltPago1(2) End If End If aElement = xmlDocEnv.CreateElement("FECHAULTIMOPAGO") aElement.InnerText = strFeUltPago1 nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONTOULTIMOPAGO") aElement.InnerText = aMatriz3(9, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("SECUENCIAL") aElement.InnerText = aMatriz2(0, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("NUMERO") aElement.InnerText = aMatriz2(1, 1) nElement3.AppendChild(aElement) 'Se agrego para que cada registros retornara dos set uno colones y otro dolares A.P. nElement3 = xmlDocEnv.CreateElement("Tarjeta") nElement2.AppendChild(nElement3) aElement = xmlDocEnv.CreateElement("TITULARTARJETA") aElement.InnerText = aMatriz2(1, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONEDA") aElement.InnerText = "DOLARES" nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("LIMITE") aElement.InnerText = aMatriz2(7, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("SALDO") aElement.InnerText = aMatriz2(4, 1) nElement3.AppendChild(aElement) If Double.Parse(aMatriz3(1, 1).ToString().Replace(",", "")) < 0 Then PagoMinimo2 = "0.00" Else PagoMinimo2 = aMatriz3(1, 1) End If aElement = xmlDocEnv.CreateElement("PAGOMINIMO") aElement.InnerText = PagoMinimo2 nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("CLASIFICACIONPAGO") aElement.InnerText = aMatriz3(4, 1) + " - " + aMatriz3(5, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("ESTADO") aElement.InnerText = aMatriz2(5, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("DIASATRASO") aElement.InnerText = aMatriz3(7, 1) nElement3.AppendChild(aElement) ' OHG 31 ENE 2007 - Ajuste para la fecha de apertura se presente en formato dd/mm/yyyy strTemp = aMatriz2(2, 1) If Len(Trim(strTemp)) > 0 Then aTemp = Split(strTemp, "/") If (aTemp.Length >= 3) Then strTemp = aTemp(1) & "/" & aTemp(0) & "/" & aTemp(2) End If End If aElement = xmlDocEnv.CreateElement("FECHAAPERTURA") aElement.InnerText = strTemp ' OHG 31 ENE 2007 nElement3.AppendChild(aElement) 'AAP Para mostrar fecha en formato dd/MM/yyyy strFeUltPago2 = aMatriz3(3, 1) If Len(Trim(strFeUltPago2)) > 0 Then arrFeUltPago2 = Split(strFeUltPago2, "/") If (arrFeUltPago2.Length >= 3) Then strFeUltPago2 = arrFeUltPago2(1) & "/" & arrFeUltPago2(0) & "/" & arrFeUltPago2(2) End If End If aElement = xmlDocEnv.CreateElement("FECHAULTIMOPAGO") aElement.InnerText = strFeUltPago2 nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("MONTOULTIMOPAGO") aElement.InnerText = aMatriz3(10, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("SECUENCIAL") aElement.InnerText = aMatriz2(0, 1) nElement3.AppendChild(aElement) aElement = xmlDocEnv.CreateElement("NUMERO") aElement.InnerText = aMatriz2(1, 1) nElement3.AppendChild(aElement) End If End If Next nElement2 = xmlDocEnv.CreateElement("ACUMULADOCOLONES") nElement2.InnerText = decAcumuladoColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("ACUMULADODOLARES") nElement2.InnerText = decAcumuladoDolares nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("SALDOTOTALCOLONES") nElement2.InnerText = decSaldoTotalColones nElement.AppendChild(nElement2) nElement2 = xmlDocEnv.CreateElement("SALDOTOTALDOLARES") nElement2.InnerText = decSaldoTotalDolares nElement.AppendChild(nElement2) Catch ex As Exception Try log.EscribirArchivo("ULA.Davivienda.WCFServiciosCobisGenerales", ex) Catch ex2 As Exception End Try Throw ex Finally End Try End Function #End Region End Class