Improve annotation handling and date retrieval robustness
Refactored annotation processing in PDFBurner.vb to handle null elements and annotations safely, preventing possible errors and improving code clarity. Updated GetSignedDate in ReceiverModel.vb to ensure consistent DateTime return values, handle DBNull and type conversions, and improve error handling.
This commit is contained in:
@@ -270,12 +270,26 @@ Public Class ReceiverModel
|
||||
Private Function GetSignedDate(pEmailAddress As String, pEnvelopeId As Integer) As Date
|
||||
Try
|
||||
Dim oStatusInt As Integer = EnvelopeStatus.DocumentSigned
|
||||
Return Database.GetScalarValue($"SELECT ACTION_DATE FROM [DD_ECM].[dbo].[TBSIG_ENVELOPE_HISTORY] WHERE ENVELOPE_ID = {pEnvelopeId}
|
||||
Dim value = Database.GetScalarValue($"SELECT ACTION_DATE FROM [DD_ECM].[dbo].[TBSIG_ENVELOPE_HISTORY] WHERE ENVELOPE_ID = {pEnvelopeId}
|
||||
And USER_REFERENCE = '{pEmailAddress}' AND [STATUS] = {oStatusInt}")
|
||||
|
||||
If value Is Nothing OrElse value Is DBNull.Value Then
|
||||
Return DateTime.MinValue
|
||||
End If
|
||||
|
||||
If TypeOf value Is DateTime Then
|
||||
Return DirectCast(value, DateTime)
|
||||
End If
|
||||
|
||||
Dim parsedDate As DateTime
|
||||
If DateTime.TryParse(value.ToString(), parsedDate) Then
|
||||
Return parsedDate
|
||||
End If
|
||||
|
||||
Return DateTime.MinValue
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
Return DateTime.MinValue
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user