- Changed return type of `CreateEnvelopeAsync` to ensure a non-null `Envelope` is always returned. - Updated `AddEnvelopeReceiverAsync` to allow nullable `salutation` parameter. - Renamed cancellation token parameter in `CreateEnvelopeReceiverCommandHandler` for consistency. - Enhanced error handling in `CreateEnvelopeAsync` to throw exceptions on failure with improved messages. - Adjusted `CreateParameters` method to accept nullable `salutation`.
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using Dapper;
|
|
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;
|
|
";
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="envelope_uuid"></param>
|
|
/// <param name="emailAddress"></param>
|
|
/// <param name="salutation"></param>
|
|
/// <param name="phone"></param>
|
|
/// <returns></returns>
|
|
public static DynamicParameters CreateParameters(string envelope_uuid, string emailAddress, string? salutation = null, 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;
|
|
}
|
|
}
|