Add AddEnvelopeReceiver method and SQL class
Introduces the `AddEnvelopeReceiver` method in the `Extension` class to add envelope receivers with parameters for UUID, email, salutation, and optional phone. Also adds the `EnvelopeReceiverAddReadSQL` class implementing `ISQL<Envelope>`, containing a SQL query to create a new receiver using the stored procedure `PRSIG_API_CREATE_RECEIVER`. Includes XML documentation for improved code readability and maintainability.
This commit is contained in:
parent
b609253893
commit
7b7a4b4f65
@ -55,4 +55,26 @@ public static class Extension
|
||||
|
||||
return await executor.CreateEnvelopeAsync(parameters, cancellation: cancellation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="executor"></param>
|
||||
/// <param name="envelope_uuid"></param>
|
||||
/// <param name="emailAdress"></param>
|
||||
/// <param name="salutation"></param>
|
||||
/// <param name="phone"></param>
|
||||
/// <param name="cancellation"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<EnvelopeReceiver?> AddEnvelopeReceiver(this ISQLExecutor executor, string envelope_uuid, string emailAdress, string salutation, string? phone = null, CancellationToken cancellation = default)
|
||||
{
|
||||
var parameters = new DynamicParameters();
|
||||
parameters.Add("@ENV_UID", envelope_uuid);
|
||||
parameters.Add("@EMAIL_ADRESS", emailAdress);
|
||||
parameters.Add("@SALUTATION", salutation);
|
||||
parameters.Add("@PHONE", phone);
|
||||
|
||||
var envelopeReceivers = await executor.Execute<EnvelopeReceiver, EnvelopeReceiverAddReadSQL>(parameters, cancellation);
|
||||
return envelopeReceivers.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.SQL;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EnvelopeReceiverAddReadSQL : ISQL<Envelope>
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Raw => @"
|
||||
USE [DD_ECM]
|
||||
GO
|
||||
|
||||
DECLARE @OUT_RECEIVER_ID int
|
||||
|
||||
DECLARE @ENV_UID varchar(36) = @ENV_UID
|
||||
|
||||
EXEC [dbo].[PRSIG_API_CREATE_RECEIVER]
|
||||
@ENV_UID = @ENV_UID,
|
||||
@EMAIL_ADRESS = @EMAIL_ADRESS ,
|
||||
@SALUTATION = @SALUTATION,
|
||||
@PHONE = @PHONE,
|
||||
@OUT_RECEIVER_ID = @OUT_RECEIVER_ID OUTPUT
|
||||
|
||||
SELECT TOP(1) *
|
||||
FROM TBSIG_ENVELOPE_RECEIVER
|
||||
WHERE [GUID] = @OUT_RECEIVER_ID;
|
||||
";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user