Add DocumentCreateReadSQL class for SQL operations
Introduces the `DocumentCreateReadSQL` class in the `EnvelopeGenerator.Application.SQL` namespace, implementing the `ISQL<EnvelopeDocument>` interface. This class includes a `Raw` property for a SQL query to insert and retrieve documents, along with a static method `CreateParmas` to generate `DynamicParameters` for SQL queries using base64 encoded strings and envelope UUIDs.
This commit is contained in:
parent
613b2130a5
commit
95a1fd1355
45
EnvelopeGenerator.Application/SQL/DocumentCreateReadSQL.cs
Normal file
45
EnvelopeGenerator.Application/SQL/DocumentCreateReadSQL.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using Dapper;
|
||||||
|
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.SQL;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DocumentCreateReadSQL : ISQL<EnvelopeDocument>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Raw => @"
|
||||||
|
USE [DD_ECM]
|
||||||
|
|
||||||
|
DECLARE @BYTE_DATA1 as VARBINARY(MAX)
|
||||||
|
SET @BYTE_DATA1 = CONVERT(VARBINARY(MAX),'@Base64')
|
||||||
|
DECLARE @OUT_DOCID int
|
||||||
|
|
||||||
|
EXEC [dbo].[PRSIG_API_ADD_DOC]
|
||||||
|
@ENV_UID = @OUT_UID,
|
||||||
|
@BYTE_DATA = @BYTE_DATA1,
|
||||||
|
@OUT_DOCID = @OUT_DOCID OUTPUT
|
||||||
|
|
||||||
|
SELECT TOP(1) *
|
||||||
|
FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT]
|
||||||
|
WHERE [GUID] = @OUT_DOCID
|
||||||
|
";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="base64"></param>
|
||||||
|
/// <param name="envelope_uuid"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DynamicParameters CreateParmas(string base64, string envelope_uuid)
|
||||||
|
{
|
||||||
|
var parameters = new DynamicParameters();
|
||||||
|
parameters.Add("@Base64", base64);
|
||||||
|
parameters.Add("@OUT_UID", envelope_uuid);
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user