31-10-2023

This commit is contained in:
Jonathan Jenne
2023-10-31 09:05:24 +01:00
parent b5e0908149
commit dc24ae3631
10 changed files with 435 additions and 264 deletions

View File

@@ -3,17 +3,14 @@
Public Class EnvelopeReceiver
Public Property Id As Integer
Public Property UserId As Integer
Public Property Signature As String
Public Property Name As String
Public Property Company As String = ""
Public Property JobTitle As String = ""
Public Property Email As String
Public ReadOnly Property Signature As String
Get
Return StringEx.GetChecksum(Email.ToUpper)
End Get
End Property
Public ReadOnly Property HasId As Boolean
Get
Return Id > 0
@@ -23,4 +20,8 @@ Public Class EnvelopeReceiver
Public Property Sequence As Integer = 0
Public Property PrivateMessage As String = ""
Public Property AccessCode As String = ""
Public Function GetSignature() As String
Return StringEx.GetChecksum(Email.ToUpper)
End Function
End Class

View File

@@ -8,8 +8,10 @@
''' <returns>The EnvelopeKey</returns>
Public Shared Function EncodeEnvelopeReceiverId(pEnvelopeUuid As String, pReceiverSignature As String) As String
Dim oString = $"{pEnvelopeUuid}::{pReceiverSignature}"
'TODO: Verschlüsseln
Return oString
Dim oBytes = Text.Encoding.UTF8.GetBytes(oString)
Dim oBase64String = Convert.ToBase64String(oBytes)
Return oBase64String
End Function
''' <summary>
@@ -18,13 +20,14 @@
''' <param name="pEnvelopeReceiverId">The EnvelopeKey</param>
''' <returns>A tuple containing EnvelopeUUID and Receiver Signature</returns>
Public Shared Function DecodeEnvelopeReceiverId(pEnvelopeReceiverId As String) As Tuple(Of String, String)
Dim oSplit = pEnvelopeReceiverId.Split(New String() {"::"}, StringSplitOptions.None)
'TODO: Entschlüsseln
Dim oBytes = Convert.FromBase64String(pEnvelopeReceiverId)
Dim oString = Text.Encoding.UTF8.GetString(oBytes)
Dim oSplit = oString.Split(New String() {"::"}, StringSplitOptions.None)
Return New Tuple(Of String, String)(oSplit(0), oSplit(1))
End Function
Public Shared Function GetEnvelopeURL(pHost As String, pEnvelopeUuid As String, pReceiverSignature As String) As String
Dim oEnvelopeUserReference As String = EncodeEnvelopeReceiverId(pEnvelopeUuid, pReceiverSignature)
Dim oURL As String = String.Format("{0}/EnvelopeKey/{1}", pHost.Trim(), oEnvelopeUserReference)
Return oURL

View File

@@ -6,12 +6,14 @@ Imports DigitalData.Modules.Logging
Public Class EnvelopeModel
Inherits BaseModel
Private UserModel As UserModel
Private ReadOnly UserModel As UserModel
Private ReadOnly ReceiverModel As ReceiverModel
Public Sub New(pState As State)
MyBase.New(pState)
UserModel = New UserModel(pState)
ReceiverModel = New ReceiverModel(pState)
End Sub
Private Function ToEnvelope(pRow As DataRow) As Envelope
@@ -29,6 +31,7 @@ Public Class EnvelopeModel
}
oEnvelope.User = UserModel.SelectUser(oEnvelope.UserId)
oEnvelope.Receivers = ReceiverModel.ListEnvelopeReceivers(oEnvelope.Id)
Return oEnvelope
End Function

View File

@@ -14,7 +14,8 @@ Public Class ReceiverModel
.Id = pRow.ItemEx("GUID", 0),
.Email = pRow.ItemEx("EMAIL_ADDRESS", ""),
.Name = pRow.ItemEx("NAME", ""),
.Sequence = pRow.ItemEx("SEQUENCE", 0)
.Sequence = pRow.ItemEx("SEQUENCE", 0),
.Signature = pRow.ItemEx("SIGNATURE", "")
}
End Function
@@ -40,7 +41,7 @@ Public Class ReceiverModel
Dim oCommand = New SqlCommand(oSql)
oCommand.Parameters.Add("EMAIL", SqlDbType.NVarChar).Value = pReceiver.Email
oCommand.Parameters.Add("SIGNATURE", SqlDbType.NVarChar).Value = pReceiver.Signature
oCommand.Parameters.Add("SIGNATURE", SqlDbType.NVarChar).Value = pReceiver.GetSignature()
Dim oResult = Database.ExecuteNonQuery(oCommand)
If oResult = True Then