TFS_ANTIGUO/PrendarioDavivienda/ULA.Davivienda.WCFServiciosCobisCartera/ULA.Davivienda.WCFServiciosCobisCartera.DAL/UtilitariaBD.vb

287 lines
11 KiB
VB.net

Imports ULA.Davivienda.WCFServiciosCobisCartera.Entidades
Public Class UtilitariaBD
Public Const ULT_STATUS_TSK_ACTIVE = 1
Public Const ULT_STATUS_TSK_FINALIZED = 2
Public Const ULT_STATUS_TSK_COMPLETE = 3
Public Const ULT_STATUS_TSK_ABORTED = 7
#Region "BuscaOperacionSQL"
Public Shared Function BuscaOperacionSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal Usuario As String) As String()
Dim strSP As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(2), aValorParametro(2) As String
Dim strError As String = String.Empty
Dim strXMLOperacion As String = String.Empty
Dim strXMLInOperacion As String = String.Empty
Dim strXMLOperacionRegenera As String = String.Empty
Dim strEsOperacionLiquidada As String = String.Empty
Dim strPolizasSeguros As String = String.Empty
Dim strBeneficiariosREgistrados As String = String.Empty
Dim strNumGarantia As String = String.Empty
Dim arrXMLOperacion() As String = New String(7) {"", "", "", "", "", "", "", ""}
Dim xmlRoot As MSXML2.IXMLDOMNode = Nothing
Dim xmlRespuesta As MSXML2.DOMDocument = Nothing
Try
xmlRespuesta = New MSXML2.DOMDocument()
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "1"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
xmlRespuesta.loadXML(strRespXml)
xmlRoot = xmlRespuesta.documentElement
If (Not IsNothing(xmlRoot.selectSingleNode("Table"))) Then
strXMLOperacion = xmlRoot.selectSingleNode("Table/df_xml_operacion").text
strXMLInOperacion = xmlRoot.selectSingleNode("Table/df_xml_in_operacion").text
strXMLOperacionRegenera = xmlRoot.selectSingleNode("Table/df_xml_reg_operacion").text
strEsOperacionLiquidada = xmlRoot.selectSingleNode("Table/df_tramite_liquidado").text
strPolizasSeguros = xmlRoot.selectSingleNode("Table/df_poliza_seguro").text
strBeneficiariosREgistrados = xmlRoot.selectSingleNode("Table/df_benef_registrados").text
strNumGarantia = xmlRoot.selectSingleNode("Table/df_nu_garantia").text
arrXMLOperacion(0) = strXMLOperacion
arrXMLOperacion(1) = strXMLInOperacion
arrXMLOperacion(2) = strXMLOperacionRegenera
arrXMLOperacion(3) = strEsOperacionLiquidada
arrXMLOperacion(4) = strPolizasSeguros
arrXMLOperacion(5) = strBeneficiariosREgistrados
arrXMLOperacion(6) = strNumGarantia
End If
Catch ex As Exception
strError = "BuscaOperacionSQL - " & ex.Message
Throw New Exception(strError)
End Try
BuscaOperacionSQL = arrXMLOperacion
End Function
#End Region
#Region "GuardaOperacionSQL"
Public Shared Sub GuardaOperacionSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal NumOperacion As String,
ByVal xmlOperacion As String,
ByVal xmlInOperacion As String,
ByVal Usuario As String)
Dim strSP As String = String.Empty
Dim strError As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(5), aValorParametro(5) As String
Try
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "2"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
aNombreParametro(3) = "@i_operacion" : aValorParametro(3) = NumOperacion
aNombreParametro(4) = "@i_xml_operacion" : aValorParametro(4) = xmlOperacion
aNombreParametro(5) = "@i_xml_in_operacion" : aValorParametro(5) = "" 'xmlInOperacion '????Si Genera Problemas se quita
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
Catch ex As Exception
strError = "GuardaOperacionSQL - " & ex.Message
Throw New Exception(strError)
End Try
End Sub
Public Shared Sub GuardaActualizacionOperacionSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal xmlRegeneracionOperacion As String,
ByVal Usuario As String)
Dim strSP As String = String.Empty
Dim strError As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(3), aValorParametro(3) As String
Try
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "2"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
aNombreParametro(3) = "@i_xml_reg_operacion" : aValorParametro(3) = xmlRegeneracionOperacion
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
Catch ex As Exception
strError = "GuardaActualizacionOperacionSQL - " & ex.Message
Throw New Exception(strError)
End Try
End Sub
Public Shared Sub LimpiarFlagDesembolsoRegistradoSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal Usuario As String)
Dim strSP As String = String.Empty
Dim strError As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(2), aValorParametro(2) As String
Try
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "7"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
Catch ex As Exception
strError = "LimpiarFlagDesembolsoRegistradoSQL - " & ex.Message
Throw New Exception(strError)
End Try
End Sub
Public Shared Sub GuardaGarantiaSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal NumGarantia As String,
ByVal Usuario As String)
Dim strSP As String = String.Empty
Dim strError As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(3), aValorParametro(3) As String
Try
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "2"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
aNombreParametro(3) = "@i_nu_garantia" : aValorParametro(3) = NumGarantia
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
Catch ex As Exception
strError = "GuardaGarantiaSQL - " & ex.Message
Throw New Exception(strError)
End Try
End Sub
Public Shared Sub GuardaOperacionSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal PolizasSeguros As String,
ByVal BeneficiariosRegistrados As String,
ByVal Usuario As String)
Dim strSP As String = String.Empty
Dim strError As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(4), aValorParametro(4) As String
Try
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "2"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
aNombreParametro(3) = "@i_poliza_seguro" : aValorParametro(3) = PolizasSeguros
aNombreParametro(4) = "@i_benef_registrados" : aValorParametro(4) = BeneficiariosRegistrados
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
Catch ex As Exception
strError = "GuardaOperacionSQL - " & ex.Message
Throw New Exception(strError)
End Try
End Sub
Public Shared Sub EliminarOperacionSQL(ByVal Proceso As String,
ByVal Solicitud As String,
ByVal Usuario As String)
Dim strSP As String = String.Empty
Dim strError As String = String.Empty
Dim strRespXml As String = String.Empty
Dim strFuenteDatos As String = String.Empty
Dim aNombreParametro(2), aValorParametro(2) As String
Try
strFuenteDatos = Entidades.Enumerador.FuenteDatosUltimus.BPMPRENDARIO.ToString()
strSP = "usp_cp_numero_operacion"
aNombreParametro(1) = "@i_opcion" : aValorParametro(1) = "6"
aNombreParametro(2) = "@i_solicitud" : aValorParametro(2) = Solicitud
strRespXml = outConector.EjecutarComandoSQLArreglo(Proceso, strFuenteDatos, strSP, aNombreParametro, aValorParametro, 0)
Catch ex As Exception
strError = "EliminarOperacionSQL - " & ex.Message
Throw New Exception(strError)
End Try
End Sub
#End Region
End Class