Add EnvelopeTypeId to EmailData and dynamic signature type

Introduced EnvelopeTypeId as a read-only property in EmailData, set during construction. Updated TemplateService.InitDictionary to use EnvelopeTypeId for determining signature type and message content, replacing the hardcoded [SIGNATURE_TYPE] value. Also added necessary imports for domain entities and constants.
This commit is contained in:
OlgunR
2026-03-03 09:19:18 +01:00
parent 9b70ca8ce6
commit a7fff24f80
2 changed files with 16 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ Public Class EmailData
Public Property ATT1_REL_TYPE As String = ""
Public Property ADDED_WHO_PROCESS As String = "DDEnvelopGenerator"
Public ReadOnly Property EnvelopeTypeId As Integer = 0
''' <summary>
''' Constructor for sending email to receiver
''' </summary>
@@ -41,6 +43,7 @@ Public Class EmailData
SenderAdress = pEnvelope.User.Email
SenderName = pEnvelope.User.GetFullName()
EnvelopeTitle = pEnvelope.Title
EnvelopeTypeId = pEnvelope.EnvelopeTypeId
End Sub
Public Function TextToHtml(input As String) As String
If String.IsNullOrEmpty(input) Then Return ""
@@ -77,6 +80,7 @@ Public Class EmailData
SenderAdress = pEnvelope.User.Email
SenderName = pEnvelope.User.GetFullName()
EnvelopeTitle = pEnvelope.Title
EnvelopeTypeId = pEnvelope.EnvelopeTypeId
End Sub
End Class

View File

@@ -1,6 +1,8 @@
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Imports EnvelopeGenerator.CommonServices.My.Resources
Imports EnvelopeGenerator.Domain.Constants
Imports EnvelopeGenerator.Domain.Entities
Public Class TemplateService
Inherits BaseService
@@ -20,11 +22,20 @@ Public Class TemplateService
Private Sub InitDictionary(pEmailData As EmailData, Optional pReason As String = "")
Logger.Debug("Initializing dictionary..")
Dim signatureType As String
If pEmailData.EnvelopeTypeId = 1 Then
signatureType = "Signieren"
pEmailData.Message = "Bitte lesen und unterzeichnen Sie dieses Dokument."
ElseIf pEmailData.EnvelopeTypeId = 2 Then
signatureType = "Lesen und bestätigen"
pEmailData.Message = "Bitte lesen und bestätigen Sie, dieses Dokument gelesen zu haben."
End If
_replaceDictionary = New Dictionary(Of String, String) From {
{"[NAME_RECEIVER]", pEmailData.ReceiverName},
{"[NAME_SENDER]", pEmailData.SenderName},
{"[NAME_PORTAL]", DbConfig.ExternalProgramName},
{"[SIGNATURE_TYPE]", "signieren"},
{"[SIGNATURE_TYPE]", signatureType},
{"[LINK_TO_DOCUMENT]", pEmailData.SignatureLink},
{"[LINK_TO_DOCUMENT_TEXT]", $"{pEmailData.SignatureLink.Truncate(40)}.."},
{"[DOCUMENT_TITLE]", pEmailData.EnvelopeTitle},