Updated the `CertificateModel.vb` and `EmailData.vb` files to replace direct access to the `FullName` property with the `GetFullName()` method for retrieving creator, sender, and receiver names. This change enhances flexibility and maintains consistency across the codebase. Additionally, added a new static `GetFullName` method in the `EGUserExtensions.cs` file to centralize the formatting of user names by concatenating the `Prename` and `Name` properties.
52 lines
1.9 KiB
VB.net
52 lines
1.9 KiB
VB.net
Imports System.Data.SqlClient
|
|
Imports EnvelopeGenerator.Domain.Entities
|
|
|
|
|
|
|
|
Public Class CertificateModel
|
|
Inherits BaseModel
|
|
|
|
Public Sub New(pState As State)
|
|
MyBase.New(pState)
|
|
End Sub
|
|
|
|
Public Function Insert(pEnvelope As Envelope) As Boolean
|
|
Try
|
|
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_CERTIFICATE] "
|
|
oSql += " ([ENVELOPE_ID] "
|
|
oSql += " ,[ENVELOPE_UUID]"
|
|
oSql += " ,[ENVELOPE_SUBJECT]"
|
|
oSql += " ,[CREATOR_ID]"
|
|
oSql += " ,[CREATOR_NAME]"
|
|
oSql += " ,[CREATOR_EMAIL]"
|
|
oSql += " ,[ENVELOPE_STATUS])"
|
|
oSql += " VALUES "
|
|
oSql += " (@ENVELOPE_ID "
|
|
oSql += " ,@ENVELOPE_UUID"
|
|
oSql += " ,@ENVELOPE_SUBJECT"
|
|
oSql += " ,@CREATOR_ID"
|
|
oSql += " ,@CREATOR_NAME"
|
|
oSql += " ,@CREATOR_EMAIL"
|
|
oSql += " ,@ENVELOPE_STATUS)"
|
|
|
|
Dim oCommand As New SqlCommand(oSql)
|
|
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pEnvelope.Id
|
|
oCommand.Parameters.Add("ENVELOPE_UUID", SqlDbType.NVarChar).Value = pEnvelope.Uuid
|
|
oCommand.Parameters.Add("ENVELOPE_SUBJECT", SqlDbType.NVarChar).Value = String.Empty
|
|
oCommand.Parameters.Add("CREATOR_ID", SqlDbType.Int).Value = pEnvelope.UserId
|
|
oCommand.Parameters.Add("CREATOR_NAME", SqlDbType.NVarChar).Value = pEnvelope.User.GetFullName()
|
|
oCommand.Parameters.Add("CREATOR_EMAIL", SqlDbType.NVarChar).Value = pEnvelope.User.Email
|
|
oCommand.Parameters.Add("ENVELOPE_STATUS", SqlDbType.Int).Value = pEnvelope.Status
|
|
|
|
If Database.ExecuteNonQuery(oCommand) Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
End Class
|