2023-09-20 MP
This commit is contained in:
parent
302a8c24ec
commit
12556e41e4
@ -1,3 +1,4 @@
|
||||
Public Class DbConfig
|
||||
Public Property DocumentPath As String = ""
|
||||
Public Property SendingProfile As Integer = 0
|
||||
End Class
|
||||
|
||||
7
EnvelopeGenerator.Common/Entities/EmailData.vb
Normal file
7
EnvelopeGenerator.Common/Entities/EmailData.vb
Normal file
@ -0,0 +1,7 @@
|
||||
Public Class EmailData
|
||||
Public Property EmailAdress As String
|
||||
Public Property EmailSubject As String
|
||||
Public Property EmailBody As String
|
||||
|
||||
Public Property ReferenceID As Integer
|
||||
End Class
|
||||
@ -95,6 +95,7 @@
|
||||
<Compile Include="Constants.vb" />
|
||||
<Compile Include="DbConfig.vb" />
|
||||
<Compile Include="Entities\ElementMetadata.vb" />
|
||||
<Compile Include="Entities\EmailData.vb" />
|
||||
<Compile Include="Entities\Envelope.vb" />
|
||||
<Compile Include="Entities\EnvelopeDocument.vb" />
|
||||
<Compile Include="Entities\EnvelopeDocumentElement.vb" />
|
||||
@ -106,6 +107,7 @@
|
||||
<Compile Include="Models\BaseModel.vb" />
|
||||
<Compile Include="Models\DocumentModel.vb" />
|
||||
<Compile Include="Models\ElementModel.vb" />
|
||||
<Compile Include="Models\EmailModel.vb" />
|
||||
<Compile Include="Models\EnvelopeModel.vb" />
|
||||
<Compile Include="Models\HistoryModel.vb" />
|
||||
<Compile Include="Models\ReceiverModel.vb" />
|
||||
|
||||
35
EnvelopeGenerator.Common/Models/EmailModel.vb
Normal file
35
EnvelopeGenerator.Common/Models/EmailModel.vb
Normal file
@ -0,0 +1,35 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class EmailModel
|
||||
Inherits BaseModel
|
||||
|
||||
Public Sub New(pState As State)
|
||||
MyBase.New(pState)
|
||||
End Sub
|
||||
|
||||
Public Function Insert(pEmail As EmailData) As Boolean
|
||||
Try
|
||||
Dim oSql = "INSERT INTO [dbo].[TBEMLP_EMAIL_OUT] (EMAIL_ADRESS, EMAIL_SUBJ, EMAIL_BODY, ADDED_WHO, SENDING_PROFILE, REFERENCE_ID) "
|
||||
oSql += " VALUES (@EMAIL_ADRESS, @EMAIL_SUBJ, @EMAIL_BODY, @ADDED_WHO, @SENDING_PROFILE, @REFERENCE_ID)"
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("EMAIL_ADRESS", SqlDbType.NVarChar).Value = pEmail.EmailAdress
|
||||
oCommand.Parameters.Add("EMAIL_SUBJ", SqlDbType.NVarChar).Value = pEmail.EmailSubject
|
||||
oCommand.Parameters.Add("EMAIL_BODY", SqlDbType.NVarChar).Value = pEmail.EmailBody
|
||||
oCommand.Parameters.Add("ADDED_WHO", SqlDbType.NVarChar).Value = "Envelop Generator"
|
||||
oCommand.Parameters.Add("SENDING_PROFILE", SqlDbType.Int).Value = State.DbConfig.SendingProfile
|
||||
oCommand.Parameters.Add("REFERENCE_ID", SqlDbType.Int).Value = pEmail.ReferenceID
|
||||
|
||||
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
|
||||
@ -12,6 +12,7 @@ Public MustInherit Class BaseController
|
||||
Public ElementModel As ElementModel
|
||||
Public HistoryModel As HistoryModel
|
||||
Public UserModel As UserModel
|
||||
Public EmailModel As EmailModel
|
||||
|
||||
Public ReadOnly Property Database As MSSQLServer
|
||||
Public ReadOnly Property State As State
|
||||
@ -30,6 +31,7 @@ Public MustInherit Class BaseController
|
||||
ElementModel = New ElementModel(pState)
|
||||
HistoryModel = New HistoryModel(pState)
|
||||
UserModel = New UserModel(pState)
|
||||
EmailModel = New EmailModel(pState)
|
||||
End Sub
|
||||
|
||||
Public Function DeleteEnvelope(pEnvelope As Envelope) As Boolean
|
||||
|
||||
@ -31,6 +31,27 @@ Public Class EnvelopeEditorController
|
||||
|
||||
#Region "Public"
|
||||
Public Function SendEnvelope() As Boolean
|
||||
Dim oResult As Boolean = True
|
||||
|
||||
For Each receiverItem As EnvelopeReceiver In Envelope.Receivers
|
||||
|
||||
' TODO Email-Template füllen
|
||||
Dim oEmailBody As String = String.Empty
|
||||
|
||||
Dim oEmailData As EmailData = New EmailData With
|
||||
{
|
||||
.EmailAdress = receiverItem.Email,
|
||||
.EmailSubject = Envelope.Subject,
|
||||
.EmailBody = oEmailBody,
|
||||
.ReferenceID = Envelope.Id
|
||||
}
|
||||
|
||||
If EmailModel.Insert(oEmailData) = False Then
|
||||
Logger.Error("EMail data could not be inserted.")
|
||||
oResult = False
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
If EnvelopeModel.Send(Envelope) Then
|
||||
@ -141,6 +162,17 @@ Public Class EnvelopeEditorController
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CreateThumbnail(pDocumentPath As String) As Bitmap
|
||||
Try
|
||||
Dim oThumbNail As Bitmap = Thumbnail.GetThumbnailFromPDFFile(pDocumentPath)
|
||||
|
||||
Return oThumbNail
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Overloads Function DeleteDocument(pDocument As EnvelopeDocument) As Boolean
|
||||
Dim oConnection As SqlConnection = Database.GetConnection
|
||||
Dim oTransaction As SqlTransaction = oConnection.BeginTransaction
|
||||
|
||||
@ -54,6 +54,12 @@ Partial Public Class frmEnvelopeEditor
|
||||
txtMessage.EditValue = Controller.Envelope.Message
|
||||
txtSubject.EditValue = Controller.Envelope.Subject
|
||||
|
||||
For Each docItem As EnvelopeDocument In Documents
|
||||
If docItem.Thumbnail Is Nothing Then
|
||||
docItem.Thumbnail = Controller.CreateThumbnail(docItem.Filepath)
|
||||
End If
|
||||
Next
|
||||
|
||||
If Envelope.Status = Constants.EnvelopeStatus.Sent Then
|
||||
SetFormReadonly()
|
||||
End If
|
||||
|
||||
@ -71,7 +71,8 @@ Public Class frmMain
|
||||
Dim oRow = oTable.Rows.Item(0)
|
||||
|
||||
Return New DbConfig() With {
|
||||
.DocumentPath = oRow.ItemEx("DOCUMENT_PATH", "")
|
||||
.DocumentPath = oRow.ItemEx("DOCUMENT_PATH", ""),
|
||||
.SendingProfile = oRow.ItemEx("SENDING_PROFILE", 0)
|
||||
}
|
||||
Catch ex As Exception
|
||||
Return New DbConfig()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user