client/ClasesModulos/ClassMyUtils.vb

131 lines
5.3 KiB
VB.net

Public Class ClassMyUtils
Public Function ISNull(ByVal Comodin As String, ByVal VarValReplace As Object) As Object
If IsDBNull(Comodin) Then
ISNull = VarValReplace
Else
ISNull = Comodin
End If
End Function
Public Function FnObtenValAnterior(ByVal SQLcad As String) As String
Dim clCmp As clsComplejo
clCmp = New clsComplejo
clCmp.fdtDataSet(SQLcad)
Dim fila As DataRow
fila = clCmp.ds.Tables(0).Rows(0)
FnObtenValAnterior = fila("Notas")
Return FnObtenValAnterior
End Function
Public Sub RT_Auditoria(ByVal idUsuario As Long, ByVal IdSuceso As Long, ByVal IdTipoSuceso As Long, ByVal AuditoriaTexto As String)
Dim strSQL As String
Dim ClassCom As New clsComplejo
Dim Classc As New ClassMyUtils
Try
strSQL = "spGrabaAuditoria " & IdSuceso & "," & idUsuario & "," & IdTipoSuceso & ",'" & AuditoriaTexto & "','" & My.Application.Info.ProductName & "/" & My.User.Name & "','" & My.Computer.Name & "','" & ClassCom.ObtenFecha(Date.Now.Date, "YYYYMMDD") & "'"
ClassCom.sbInserta(strSQL)
Catch er As Exception
MessageBox.Show("Error en RT_Auditoria: " & er.Message & " sql: " & strSQL, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Public Sub LogProcesoHit(Funcion As String, Texto As String)
Dim strSQL As String
Dim ClassCom As New clsComplejo
Dim Classc As New ClassMyUtils
Try
strSQL = "INSERT INTO PROCESOHITLOG(STRFUNCION,STRLOG,FECHA) VALUES ('" & Funcion & "'," & "'" & Texto & "',getdate())"
ClassCom.sbInserta(strSQL)
Catch er As Exception
MessageBox.Show("LogProcesoHit " & er.Message & " sql: " & strSQL, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Public Sub RT_Auditoria(ByVal varUser As Long, ByVal varSuceso As Long, ByVal varPC As String, ByVal varProgram As String, ByVal varCTxtAud As String)
Dim strSQL As String
Dim ClassCom As New clsComplejo
Dim Classc As New ClassMyUtils
Try
'MODIFICO JACG 16/02/2014
strSQL = ""
strSQL = "INSERT INTO AUDITORIA " + vbCr
strSQL = strSQL & "(IdUsuario,IdSuceso,FechAudi,CTxtAud,"
strSQL = strSQL & "PCname,AudPrgId,AudUsrId,AudMaquina,AudFecHra) " + vbCr
strSQL = strSQL & "VALUES ("
strSQL = strSQL & varUser & "," & varSuceso & ",convert(datetime,'" & Classc.ObtenFecha(Now.Date, "dd/mm/yyyy") & "',103),'" & varCTxtAud & "','" & varPC & "','"
strSQL = strSQL & varProgram & "','" & My.User.Name & "','" & My.Computer.Name & "',getdate()"
strSQL = strSQL & ")"
' ClassCom.sbInserta(strSQL)
Catch er As Exception
MessageBox.Show("Error en RT_Auditoria: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Public Function ObtenFecha(ByVal FOriginal As Date, ByVal strFormato As String) As String
Dim strFechaRet As String
Select Case UCase(strFormato)
Case Is = "DD/MM/YYYY"
strFechaRet = Format(Microsoft.VisualBasic.Day(FOriginal), "00") & "/" & Format(Month(FOriginal), "00") & "/" & Year(FOriginal)
Case Is = "YYYY/MM/DD"
strFechaRet = Year(FOriginal) & "/" & Format(Month(FOriginal), "00") & "/" & Format(Microsoft.VisualBasic.Day(FOriginal), "00")
Case Is = "MM/DD/YYYY"
strFechaRet = Format(Month(FOriginal), "00") & "/" & Format(Microsoft.VisualBasic.Day(FOriginal), "00") & "/" & Year(FOriginal)
Case Is = "DDMMYYYY"
strFechaRet = Format(Microsoft.VisualBasic.Day(FOriginal), "00") & Format(Month(FOriginal), "00") & Year(FOriginal)
End Select
ObtenFecha = strFechaRet
End Function
Public Function ObtenALIASProducto(ByVal strNomProd As String) As String
Select Case strNomProd
Case Is = "BANCATRADICIONAL"
ObtenALIASProducto = "OPERACIONES COMERCIALES"
Case Is = "CREDITO"
ObtenALIASProducto = "CREDITO"
End Select
End Function
Public Function ObtenNombreProducto(ByVal strAliasProd As String) As String
Select Case UCase(strAliasProd)
Case Is = UCase("Credito")
ObtenNombreProducto = "Credito"
Case Is = UCase("BANCATRADICIONAL")
ObtenNombreProducto = "BANCATRADICIONAL"
Case Is = UCase("BANCAINTERNACIONAL")
ObtenNombreProducto = "BANCAINTERNACIONAL"
Case Is = UCase("TESORERIA")
ObtenNombreProducto = "TESORERIA"
End Select
End Function
Public Sub DesactivarControlAcceso(ByVal idUsuario As Integer)
Dim strSQL As String
Dim ClassCom As New clsComplejo
Dim Classc As New ClassMyUtils
Try
strSQL = "spCRU_AccesoControl '" & idUsuario & "',1,3"
ClassCom.sbInserta(strSQL)
Catch er As Exception
MessageBox.Show("Error en ActualizaAccesoControlDesactivar: " & er.Message & " sql: " & strSQL, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
End Class