Files
SIG/Ventas/PuntoVenta.aspx.vb
2023-10-09 11:55:07 -07:00

52 lines
1.8 KiB
VB.net

Partial Class Ventas_PuntoVenta
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Request("PV_CveUsuario") Is Nothing Then
Dim fe As String = NowADS().ToString("dd-MM-yyyy HH:mm:ss")
Dim fi As String = encriptarHEX("AD_SISTEMAS_PV_" + fe)
Response.Redirect(String.Format("/Ventas/PuntoVenta.aspx?PV_CveUsuario={0}&PV_fe={1}&PV_fi={2}", UsuarioActual.CveUsuario, fe, fi))
End If
End If
End Sub
Public Function encriptar(ByVal vsValue As String) As String
Dim hashValue As New System.Security.Cryptography.SHA1CryptoServiceProvider()
' Convert the original string to array of Bytes
Dim byteValue As [Byte]() = System.Text.Encoding.UTF8.GetBytes(vsValue)
' Compute the Hash, returns an array of Bytes
Dim byteHash As [Byte]() = hashValue.ComputeHash(byteValue)
hashValue.Clear()
' Return a base 64 encoded string of the Hash value
Return (Convert.ToBase64String(byteHash))
End Function
Public Function encriptarHEX(ByVal vsValue As String) As String
Dim hashValue As New System.Security.Cryptography.SHA1CryptoServiceProvider()
Dim Respuesta As String = ""
' Convert the original string to array of Bytes
Dim byteValue As [Byte]() = System.Text.Encoding.UTF8.GetBytes(vsValue)
' Compute the Hash, returns an array of Bytes
Dim byteHash As [Byte]() = hashValue.ComputeHash(byteValue)
hashValue.Clear()
' Return a base 64 encoded string of the Hash value
Dim i As Integer
For i = 0 To byteHash.Length - 1
Respuesta = Respuesta + Hex(byteHash(i)).ToString.PadLeft(2, "0"c)
Next
Return Respuesta
End Function
End Class