refactor(SQL): move to common
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using Dapper;
|
||||
using EnvelopeGenerator.Application.Interfaces.SQLExecutor;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using System.Data;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.SQL;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EnvelopeCreateReadSQL : ISQL<Envelope>
|
||||
{
|
||||
/// <summary>
|
||||
/// USER_ID, TITLE, TFAEnabled, MESSAGE
|
||||
/// </summary>
|
||||
public string Raw => @"
|
||||
DECLARE @OUT_UID varchar(36);
|
||||
|
||||
EXEC [dbo].[PRSIG_API_CREATE_ENVELOPE]
|
||||
{0},
|
||||
{1},
|
||||
{2},
|
||||
{3},
|
||||
@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 CreateParams(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);
|
||||
parameters.Add("@OutUid", dbType: DbType.String, size: 36, direction: ParameterDirection.Output);
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user