This commit is contained in:
Jonathan Jenne
2023-11-13 10:32:15 +01:00
parent 3874bc742d
commit 623cf43520
9 changed files with 221 additions and 28 deletions

View File

@@ -47,6 +47,19 @@
Contract = 1
ReadAndSign = 2
End Enum
Public Enum ColorType
ReceiverColor1 = 1
ReceiverColor2 = 2
ReceiverColor3 = 3
ReceiverColor4 = 4
ReceiverColor5 = 5
ReceiverColor6 = 6
ReceiverColor7 = 7
ReceiverColor8 = 8
ReceiverColor9 = 9
ReceiverColor10 = 10
End Enum
#End Region
End Class

View File

@@ -1,10 +1,19 @@
Imports DigitalData.Modules.Base
Imports System.Drawing
Imports DigitalData.Modules.Base
Imports EnvelopeGenerator.Common.Constants
Public Class EnvelopeReceiver
Public Property Id As Integer = 0
Public Property UserId As Integer
Public Property Signature As String
Public ReadOnly Property Color As Color
Get
Return Helpers.ColorTypeToColor(ColorType)
End Get
End Property
Public Property ColorType As ColorType
Public Property Name As String
Public Property Company As String = ""

View File

@@ -1,4 +1,7 @@
Public Class Helpers
Imports System.Drawing
Imports EnvelopeGenerator.Common.Constants
Public Class Helpers
''' <summary>
''' Encodes the EnvelopeUUID and the ReceiverSignature into an EnvelopeKey
@@ -8,7 +11,7 @@
''' <returns>The EnvelopeKey</returns>
Public Shared Function EncodeEnvelopeReceiverId(pEnvelopeUuid As String, pReceiverSignature As String) As String
Dim oString = $"{pEnvelopeUuid}::{pReceiverSignature}"
Dim oBytes = Text.Encoding.UTF8.GetBytes(oString)
Dim oBytes = System.Text.Encoding.UTF8.GetBytes(oString)
Dim oBase64String = Convert.ToBase64String(oBytes)
Return oBase64String
@@ -21,7 +24,7 @@
''' <returns>A tuple containing EnvelopeUUID and Receiver Signature</returns>
Public Shared Function DecodeEnvelopeReceiverId(pEnvelopeReceiverId As String) As Tuple(Of String, String)
Dim oBytes = Convert.FromBase64String(pEnvelopeReceiverId)
Dim oString = Text.Encoding.UTF8.GetString(oBytes)
Dim oString = System.Text.Encoding.UTF8.GetString(oBytes)
Dim oSplit = oString.Split(New String() {"::"}, StringSplitOptions.None)
Return New Tuple(Of String, String)(oSplit(0), oSplit(1))
@@ -33,4 +36,39 @@
Return oURL
End Function
Public Shared Function ColorTypeToColor(pColorType As ColorType) As Color
Select Case pColorType
Case ColorType.ReceiverColor1
Return Color.Blue
Case ColorType.ReceiverColor2
Return Color.Maroon
Case ColorType.ReceiverColor3
Return Color.LightSeaGreen
Case ColorType.ReceiverColor4
Return Color.LimeGreen
Case ColorType.ReceiverColor5
Return Color.Magenta
Case ColorType.ReceiverColor6
Return Color.MediumSpringGreen
Case ColorType.ReceiverColor7
Return Color.OrangeRed
Case ColorType.ReceiverColor8
Return Color.DodgerBlue
Case ColorType.ReceiverColor9
Return Color.Purple
Case ColorType.ReceiverColor10
Return Color.Gold
End Select
End Function
End Class

View File

@@ -11,14 +11,15 @@ Public Class ReceiverModel
MyBase.New(pState)
End Sub
Private Function ToReceiver(pRow As DataRow) As EnvelopeReceiver
Private Function ToReceiver(pRow As DataRow, pColorIndex As Integer) As EnvelopeReceiver
Return New EnvelopeReceiver() With {
.Id = pRow.ItemEx("GUID", 0),
.Email = pRow.ItemEx("EMAIL_ADDRESS", ""),
.Name = pRow.ItemEx("NAME", ""),
.Sequence = pRow.ItemEx("SEQUENCE", 0),
.Signature = pRow.ItemEx("SIGNATURE", ""),
.Status = ReceiverStatus.Unsigned
.Status = ReceiverStatus.Unsigned,
.ColorType = DirectCast(pColorIndex + 1, ColorType)
}
End Function