From 95a1fd13552ab258fa32d254807040f6276edf29 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 7 May 2025 01:20:27 +0200 Subject: [PATCH] Add DocumentCreateReadSQL class for SQL operations Introduces the `DocumentCreateReadSQL` class in the `EnvelopeGenerator.Application.SQL` namespace, implementing the `ISQL` 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. --- .../SQL/DocumentCreateReadSQL.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 EnvelopeGenerator.Application/SQL/DocumentCreateReadSQL.cs diff --git a/EnvelopeGenerator.Application/SQL/DocumentCreateReadSQL.cs b/EnvelopeGenerator.Application/SQL/DocumentCreateReadSQL.cs new file mode 100644 index 00000000..02b4ec73 --- /dev/null +++ b/EnvelopeGenerator.Application/SQL/DocumentCreateReadSQL.cs @@ -0,0 +1,45 @@ +using Dapper; +using EnvelopeGenerator.Application.Contracts.SQLExecutor; +using EnvelopeGenerator.Domain.Entities; + +namespace EnvelopeGenerator.Application.SQL; + +/// +/// +/// +public class DocumentCreateReadSQL : ISQL +{ + /// + /// + /// + 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 + "; + + /// + /// + /// + /// + /// + /// + 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; + } +}