2023-08-07

This commit is contained in:
Jonathan Jenne
2023-08-07 11:23:52 +02:00
parent c8b2f21fea
commit 462bf4a61f
53 changed files with 1415 additions and 33 deletions

View File

@@ -0,0 +1,48 @@
Public Class Envelope
Public Property Id As Integer = 0
Public Property Subject As String
Public Property Message As String
Public Property UserId As Integer
Public Property Uuid As String = Guid.NewGuid.ToString()
Public Property Status As Constants.EnvelopeStatus
Public Property Documents As New List(Of EnvelopeDocument)
Public Property Receivers As New List(Of EnvelopeReceiver)
Public Function Validate() As List(Of String)
Dim oErrors As New List(Of String)
If String.IsNullOrWhiteSpace(Subject) Then
oErrors.Add(My.Resources.Envelope.Missing_Subject)
End If
If String.IsNullOrWhiteSpace(Message) Then
oErrors.Add(My.Resources.Envelope.Missing_Message)
End If
If Documents.Count = 0 Then
oErrors.Add(My.Resources.Envelope.Missing_Documents)
End If
If Receivers.Count = 0 Then
oErrors.Add(My.Resources.Envelope.Missing_Receivers)
End If
For Each Receiver In Receivers
If IsValidEmailAddress(Receiver.Email) = False Then
oErrors.Add(String.Format(My.Resources.Envelope.Invalid_Email_Address, Receiver.Name))
End If
Next
Return oErrors
End Function
Private Function IsValidEmailAddress(pEmailAddress As String) As Boolean
Try
Dim oAddress = New System.Net.Mail.MailAddress(pEmailAddress)
Return oAddress.Address = pEmailAddress
Catch ex As Exception
Return False
End Try
End Function
End Class