This commit is contained in:
PitzM 2023-12-04 15:43:56 +01:00
commit cb44e25fea
14 changed files with 38 additions and 32 deletions

View File

@ -13,12 +13,6 @@ Public Class EmailData
Public Property SignatureLink As String
Public Property Message As String
Public ReadOnly Property EmailSubjectTranslated
Get
Return String.Format(My.Resources.Email.Sie_haben_ein_Dokument_zur_Unterschrift_erhalten___0_, EmailSubject)
End Get
End Property
Public Sub New(pEnvelope As Envelope, pReceiver As EnvelopeReceiver)
EmailAdress = pReceiver.Email
EmailSubject = pEnvelope.Subject

View File

@ -13,9 +13,13 @@ Public Class EmailTemplate
Private _replaceDictionary As Dictionary(Of String, String)
Public Sub New()
Private DbConfig As DbConfig
Public Sub New(pState As State)
InitBodyTemplates()
InitSubjectTemplates()
DbConfig = pState.DbConfig
End Sub
Private Sub InitSubjectTemplates()
@ -36,16 +40,16 @@ Public Class EmailTemplate
"<MESSAGE>",
"",
"Mit freundlichen Grüßen",
"<NAME_SENDER>"
"<NAME_PORTAL>"
}
_DocumentSignedBodyTemplate = New List(Of String) From {
"Guten Tag, <NAME_RECEIVER>",
"",
"Ihre Unterschrift auf dem Dokument <DOCUMENT_TITLE> wurde gespeichert.",
"hiermit bestätigen wir Ihnen die erfolgreiche Signatur für den Vorgang <DOCUMENT_TITLE>.",
"",
"Mit freundlichen Grüßen",
"<NAME_SENDER>"
"<NAME_PORTAL>"
}
_DocumentDeletedBodyTemplate = New List(Of String) From {
@ -54,7 +58,7 @@ Public Class EmailTemplate
"Der User <NAME_SENDER> hat den Umschlag <DOCUMENT_TITLE> gelöscht.",
"",
"Mit freundlichen Grüßen",
"<NAME_SENDER>"
"<NAME_PORTAL>"
}
_DocumentCompletedBodyTemplate = New List(Of String) From {
@ -63,7 +67,7 @@ Public Class EmailTemplate
"Das Dokument <DOCUMENT_TITLE> wurde von allen Beteiligten unterschrieben.",
"",
"Mit freundlichen Grüßen",
"<NAME_SENDER>"
"<NAME_PORTAL>"
}
End Sub
@ -71,6 +75,7 @@ Public Class EmailTemplate
_replaceDictionary = New Dictionary(Of String, String) From {
{"<NAME_RECEIVER>", pEmailData.ReceiverName},
{"<NAME_SENDER>", pEmailData.SenderName},
{"<NAME_PORTAL>", DbConfig.ExternalProgramName},
{"<SIGNATURE_TYPE>", "signieren"},
{"<LINK_TO_DOCUMENT>", pEmailData.SignatureLink},
{"<LINK_TO_DOCUMENT_TEXT>", $"{pEmailData.SignatureLink.Truncate(40)}.."},

View File

@ -1,7 +1,9 @@
Imports System.Drawing
Imports System.Runtime.Serialization
Imports DevExpress.Utils.Svg
Imports DigitalData.Modules.Base
Imports EnvelopeGenerator.Common.Constants
Imports Newtonsoft.Json
Public Class EnvelopeReceiver
Public Property Id As Integer = 0
@ -13,6 +15,7 @@ Public Class EnvelopeReceiver
End Get
End Property
<JsonIgnore>
Public ReadOnly Property Image As SvgBitmap
Get
Try

View File

@ -78,6 +78,9 @@
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
</Reference>

View File

@ -15,7 +15,8 @@ Public Class CertificateDocumentJob
Dim JobId = pContext.JobDetail.Key
oLogger.Info("Starting job {0}", JobId)
Dim oSql = $"SELECT * FROM TBSIG_ENVELOPE WHERE STATUS = {Constants.EnvelopeStatus.EnvelopeCompletelySigned}"
Dim oCompleteStatus As Integer = Constants.EnvelopeStatus.EnvelopeCompletelySigned
Dim oSql = $"SELECT * FROM TBSIG_ENVELOPE WHERE STATUS = {oCompleteStatus}"
Dim oTable = oDatabase.GetDatatable(oSql)
oLogger.Info("Found [{0}] completed envelopes.", oTable.Rows.Count)

View File

@ -16,7 +16,7 @@ Public Class EmailModel
oSql += " VALUES (@EMAIL_ADRESS, @EMAIL_SUBJ, @EMAIL_BODY, @ADDED_WHO, @SENDING_PROFILE, @REFERENCE_ID, @REFERENCE_STRING, @REMINDER_TYPE_ID, @WF_ID)"
Dim oCommand As New SqlCommand(oSql)
oCommand.Parameters.Add("EMAIL_ADRESS", SqlDbType.NVarChar).Value = pEmail.EmailAdress
oCommand.Parameters.Add("EMAIL_SUBJ", SqlDbType.NVarChar).Value = pEmail.EmailSubjectTranslated
oCommand.Parameters.Add("EMAIL_SUBJ", SqlDbType.NVarChar).Value = pEmail.EmailSubject
oCommand.Parameters.Add("EMAIL_BODY", SqlDbType.NVarChar).Value = pEmail.EmailBody
oCommand.Parameters.Add("ADDED_WHO", SqlDbType.NVarChar).Value = "DDEnvelopGenerator"
oCommand.Parameters.Add("SENDING_PROFILE", SqlDbType.Int).Value = State.DbConfig.SendingProfile

View File

@ -71,7 +71,7 @@ Public Class EnvelopeModel
Public Function List() As IEnumerable(Of Envelope)
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE] WHERE USER_ID = {State.UserId} AND STATUS IN (1001,1002,1003,1004,1005)"
Dim oSql = $"EXEC PRSIG_GET_ENVELOPES_FOR_USER {State.UserId}"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).

View File

@ -20,7 +20,7 @@ Public Class EmailService
EnvelopeModel = New EnvelopeModel(pState)
ReceiverModel = New ReceiverModel(pState)
EmailModel = New EmailModel(pState)
EmailTemplate = New EmailTemplate()
EmailTemplate = New EmailTemplate(pState)
End Sub
Public Function SendEnvelopeDeletedEmail(pEnvelope As Envelope, pReceiver As EnvelopeReceiver) As Boolean

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
<package id="Quartz" version="3.8.0" targetFramework="net462" />
</packages>

View File

@ -17,7 +17,7 @@ namespace EnvelopeGenerator.Web.Controllers
{
this.database = database;
this.logConfig = logging.LogConfig;
this.logger = logging.LogConfig.GetLoggerFor(GetType().Name);
this.logger = logging.LogConfig.GetLogger();
this.state = database.State;
}

View File

@ -27,6 +27,7 @@ namespace EnvelopeGenerator.Web.Controllers
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
logger.Debug("Loaded envelope [{0}] for receiver [{1}]", response.Envelope.Id, response.Envelope.Id);
return Json(response);
}
catch (Exception e)
@ -52,18 +53,6 @@ namespace EnvelopeGenerator.Web.Controllers
string annotationData = await envelopeService.EnsureValidAnnotationData(Request);
//envelopeService.InsertDocumentStatus(new DocumentStatus()
//{
// EnvelopeId = response.Envelope.Id,
// ReceiverId = response.Receiver.Id,
// Value = annotationData,
// Status = Common.Constants.DocumentStatus.Signed
//});
//envelopeService.InsertHistoryEntrySigned(response);
//emailService.SendSignedEmail(response.Receiver.Id, response.Envelope.Id);
var signResult = actionService?.SignEnvelope(response.Envelope, response.Receiver);
return Ok();

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
@ -42,4 +42,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -19,7 +19,11 @@ namespace EnvelopeGenerator.Web
builder.Services.AddSingleton<EnvelopeService>();
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddControllersWithViews().AddJsonOptions(q =>
{
// Prevents serialization error when serializing SvgBitmap in EnvelopeReceiver
q.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
});
// Configure and start scheduler
builder.Services.AddQuartz(q =>

View File

@ -44,7 +44,7 @@
body: JSON.stringify({}),
}
console.debug('OpenDocument/Calling url: ' + url)
console.debug('OpenDocument/Calling url: ' + url)
return fetch(url, this.withCSRFToken(options))
.then(this.handleResponse)
.then((res) => {