- Updated `Extension.cs` to remove old methods and introduce a new parameter creation method. - Modified `IEnvelopeExecutor.cs` to change `CreateEnvelopeAsync` signature for clarity. - Added a consistent `CreateParmas` method in `EnvelopeCreateReadSQL.cs`. - Changed service registration in `DependencyExtensions.cs` from singleton to scoped. - Revised `CreateEnvelopeAsync` in `EnvelopeExecutor.cs` to utilize the new parameter structure and removed user addition logic. These changes enhance code clarity, maintainability, and consistency in parameter handling.
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using Dapper;
|
|
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
|
|
namespace EnvelopeGenerator.Application.SQL;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class EnvelopeCreateReadSQL : ISQL<Envelope>
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string Raw => @"
|
|
USE [DD_ECM];
|
|
DECLARE @OUT_UID varchar(36);
|
|
|
|
EXEC [dbo].[PRSIG_API_CREATE_ENVELOPE]
|
|
@USER_ID = @UserId,
|
|
@TITLE = @Title,
|
|
@TFAEnabled = @TfaEnabled,
|
|
@MESSAGE = @Message,
|
|
@OUT_UID = @OUT_UID OUTPUT;
|
|
|
|
SELECT TOP(1) *
|
|
FROM [dbo].[TBSIG_ENVELOPE]
|
|
WHERE [ENVELOPE_UUID] = @OUT_UID;
|
|
";
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <param name="title"></param>
|
|
/// <param name="message"></param>
|
|
/// <param name="tfaEnabled"></param>
|
|
/// <returns></returns>
|
|
public static DynamicParameters CreateParmas(int userId, string title = "", string message = "", bool tfaEnabled = false)
|
|
{
|
|
var parameters = new DynamicParameters();
|
|
parameters.Add("@UserId", userId);
|
|
parameters.Add("@Title", title);
|
|
parameters.Add("@TfaEnabled", tfaEnabled ? 1 : 0);
|
|
parameters.Add("@Message", message);
|
|
return parameters;
|
|
}
|
|
} |