From 37032a48c9fb93e0d4506fab0fb0b2d3bf371a3d Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 6 May 2025 10:45:54 +0200 Subject: [PATCH] Enhance envelope receiver functionality and documentation Updated IEnvelopeReceiverExecutor with XML comments for AddEnvelopeReceiverAsync method and added necessary using directives. Introduced XML documentation for CreateParameters in EnvelopeReceiverAddReadSQL. Modified AddEnvelopeReceiverAsync in EnvelopeReceiverExecutor to accept individual parameters, improving clarity and usability. --- .../SQLExecutor/IEnvelopeReceiverExecutor.cs | 14 ++++++++++++- .../SQL/EnvelopeReceiverAddReadSQL.cs | 21 ++++++++++++++++++- .../Executor/EnvelopeReceiverExecutor.cs | 4 ++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Application/Contracts/SQLExecutor/IEnvelopeReceiverExecutor.cs b/EnvelopeGenerator.Application/Contracts/SQLExecutor/IEnvelopeReceiverExecutor.cs index 73120389..10bcbe28 100644 --- a/EnvelopeGenerator.Application/Contracts/SQLExecutor/IEnvelopeReceiverExecutor.cs +++ b/EnvelopeGenerator.Application/Contracts/SQLExecutor/IEnvelopeReceiverExecutor.cs @@ -1,8 +1,20 @@ -namespace EnvelopeGenerator.Application.Contracts.SQLExecutor; +using EnvelopeGenerator.Domain.Entities; + +namespace EnvelopeGenerator.Application.Contracts.SQLExecutor; /// /// /// public interface IEnvelopeReceiverExecutor { + /// + /// + /// + /// + /// + /// + /// + /// + /// + Task AddEnvelopeReceiverAsync(string envelope_uuid, string emailAddress, string salutation, string? phone = null, CancellationToken cancellation = default); } diff --git a/EnvelopeGenerator.Application/SQL/EnvelopeReceiverAddReadSQL.cs b/EnvelopeGenerator.Application/SQL/EnvelopeReceiverAddReadSQL.cs index e4fe1881..c94aecbc 100644 --- a/EnvelopeGenerator.Application/SQL/EnvelopeReceiverAddReadSQL.cs +++ b/EnvelopeGenerator.Application/SQL/EnvelopeReceiverAddReadSQL.cs @@ -1,4 +1,5 @@ -using EnvelopeGenerator.Application.Contracts.SQLExecutor; +using Dapper; +using EnvelopeGenerator.Application.Contracts.SQLExecutor; using EnvelopeGenerator.Domain.Entities; namespace EnvelopeGenerator.Application.SQL; @@ -30,4 +31,22 @@ public class EnvelopeReceiverAddReadSQL : ISQL FROM TBSIG_ENVELOPE_RECEIVER WHERE [GUID] = @OUT_RECEIVER_ID; "; + + /// + /// + /// + /// + /// + /// + /// + /// + public static DynamicParameters CreateParameters(string envelope_uuid, string emailAddress, string salutation, string? phone = null) + { + var parameters = new DynamicParameters(); + parameters.Add("@ENV_UID", envelope_uuid); + parameters.Add("@EMAIL_ADRESS", emailAddress); + parameters.Add("@SALUTATION", salutation); + parameters.Add("@PHONE", phone); + return parameters; + } } diff --git a/EnvelopeGenerator.Infrastructure/Executor/EnvelopeReceiverExecutor.cs b/EnvelopeGenerator.Infrastructure/Executor/EnvelopeReceiverExecutor.cs index 7120aaa4..f62a3b96 100644 --- a/EnvelopeGenerator.Infrastructure/Executor/EnvelopeReceiverExecutor.cs +++ b/EnvelopeGenerator.Infrastructure/Executor/EnvelopeReceiverExecutor.cs @@ -19,12 +19,12 @@ public class EnvelopeReceiverExecutor: SQLExecutor, IEnvelopeReceiverExecutor _erRepository = erRepository; } - public async Task AddEnvelopeReceiverAsync(DynamicParameters parameters, bool addEnvelope = true, CancellationToken cancellation = default) + public async Task AddEnvelopeReceiverAsync(string envelope_uuid, string emailAddress, string salutation, string? phone = null, CancellationToken cancellation = default) { using var connection = new SqlConnection(Params.ConnectionString); var sql = Provider.GetRequiredService(); await connection.OpenAsync(cancellation); - var envelopeReceivers = await connection.QueryAsync(sql.Raw, parameters); + var envelopeReceivers = await connection.QueryAsync(sql.Raw, EnvelopeReceiverAddReadSQL.CreateParameters(envelope_uuid, emailAddress, salutation, phone)); var er = envelopeReceivers.FirstOrDefault(); if (er is null)