52 lines
1.7 KiB
VB.net
52 lines
1.7 KiB
VB.net
Imports DevExpress.DataAccess.Native.Web
|
|
Imports DigitalData.Modules.Base
|
|
|
|
Public Class ActionService
|
|
Inherits BaseClass
|
|
|
|
Private ReadOnly EmailService As EmailService
|
|
Private ReadOnly HistoryService As HistoryService
|
|
|
|
Private ReadOnly ReceiverModel As ReceiverModel
|
|
|
|
|
|
Public Sub New(pState As State)
|
|
MyBase.New(pState.LogConfig)
|
|
|
|
EmailService = New EmailService(pState)
|
|
HistoryService = New HistoryService(pState)
|
|
|
|
ReceiverModel = New ReceiverModel(pState)
|
|
End Sub
|
|
|
|
Public Function DeleteEnvelope(pEnvelope As Envelope) As Boolean
|
|
HistoryService.SetEnvelopeStatus(pEnvelope, Constants.EnvelopeStatus.EnvelopeDeleted, pEnvelope.User.Email)
|
|
|
|
For Each oReceiver As EnvelopeReceiver In pEnvelope.Receivers
|
|
EmailService.SendEnvelopeDeletedEmail(oReceiver.Id, pEnvelope.Id)
|
|
Next
|
|
|
|
Return True
|
|
End Function
|
|
|
|
Public Function OpenEnvelope(pEnvelope As Envelope, pReceiverId As Integer) As Boolean
|
|
Dim oReceiver As EnvelopeReceiver = ReceiverModel.GetById(pReceiverId)
|
|
Dim oUserReference = oReceiver.Email
|
|
|
|
Return HistoryService.SetEnvelopeStatus(pEnvelope, Constants.EnvelopeStatus.DocumentOpened, oUserReference)
|
|
End Function
|
|
|
|
Public Function SignEnvelope(pEnvelope As Envelope, pReceiverId As Integer) As Boolean
|
|
Dim oReceiver As EnvelopeReceiver = ReceiverModel.GetById(pReceiverId)
|
|
Dim oUserReference = oReceiver.Email
|
|
|
|
If HistoryService.SetEnvelopeStatus(pEnvelope, Constants.EnvelopeStatus.DocumentSigned, oUserReference) = False Then
|
|
Return False
|
|
End If
|
|
|
|
Return EmailService.SendSignedEmail(oReceiver.Id, pEnvelope.Id)
|
|
End Function
|
|
|
|
|
|
|
|
End Class |