Add history creation functionality to EnvelopeReceiverController
Updated the `EnvelopeReceiverController` to include a new region for creating history. Added a SQL command to insert a history state into the database, established a database connection, and executed the command within a `using` block. The result is read to check for success, and the method now returns an `Ok` response with the result.
This commit is contained in:
parent
486b717801
commit
f6f4137332
@ -239,6 +239,8 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
|
||||
#region Add document element
|
||||
string sql = @"
|
||||
USE [DD_ECM]
|
||||
|
||||
DECLARE @OUT_SUCCESS bit;
|
||||
|
||||
EXEC [dbo].[PRSIG_API_ADD_DOC_RECEIVER_ELEM]
|
||||
@ -276,6 +278,45 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Create history
|
||||
string connectionString = "Server=YOUR_SERVER;Database=YOUR_DATABASE;Trusted_Connection=True;";
|
||||
|
||||
string sql_hist = @"
|
||||
USE [DD_ECM]
|
||||
|
||||
DECLARE @OUT_SUCCESS bit;
|
||||
|
||||
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
||||
@ENV_UID = @ENV_UID,
|
||||
@STATUS_ID = @STATUS_ID,
|
||||
@USER_ID = @USER_ID,
|
||||
@OUT_SUCCESS = @OUT_SUCCESS OUTPUT;
|
||||
|
||||
SELECT @OUT_SUCCESS as [@OUT_SUCCESS];";
|
||||
|
||||
using (SqlConnection conn = new(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
using (SqlCommand cmd = new SqlCommand(sql_hist, conn))
|
||||
{
|
||||
cmd.CommandType = CommandType.Text;
|
||||
|
||||
cmd.Parameters.AddWithValue("@ENV_UID", envelope.Uuid);
|
||||
cmd.Parameters.AddWithValue("@STATUS_ID", 1003);
|
||||
cmd.Parameters.AddWithValue("@USER_ID", userId);
|
||||
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
bool outSuccess = reader.GetBoolean(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
return Ok(res);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user