Updated CreateParmas method to accept only base64 string. Converted base64 to byte array and added it as ByteData. Adjusted SQL command and DocumentExecutor to reflect these changes.
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using Dapper;
|
|
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
|
|
namespace EnvelopeGenerator.Application.SQL;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class DocumentCreateReadSQL : ISQL<EnvelopeDocument>
|
|
{
|
|
/// <summary>
|
|
/// Base64, OUT_UID
|
|
/// </summary>
|
|
public string Raw => @"
|
|
DECLARE @BYTE_DATA1 as VARBINARY(MAX)
|
|
SET @BYTE_DATA1 = @ByteData
|
|
DECLARE @OUT_DOCID int
|
|
|
|
EXEC [dbo].[PRSIG_API_ADD_DOC]
|
|
{0},
|
|
@BYTE_DATA1,
|
|
@OUT_DOCID OUTPUT
|
|
|
|
SELECT TOP(1) *
|
|
FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT]
|
|
WHERE [GUID] = @OUT_DOCID
|
|
";
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="base64"></param>
|
|
/// <returns></returns>
|
|
public static DynamicParameters CreateParmas(string base64)
|
|
{
|
|
var parameters = new DynamicParameters();
|
|
byte[] byteData = Convert.FromBase64String(base64);
|
|
parameters.Add("ByteData", byteData, System.Data.DbType.Binary);
|
|
return parameters;
|
|
}
|
|
}
|