29-11-2023
This commit is contained in:
@@ -4,6 +4,7 @@ Imports DevExpress.Utils.Svg
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraPrinting.Native
|
||||
Imports DevExpress.XtraSplashScreen
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common
|
||||
@@ -70,7 +71,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
End If
|
||||
Next
|
||||
|
||||
If Envelope.Status = Constants.EnvelopeStatus.Sent Then
|
||||
If Envelope.Status = Constants.EnvelopeStatus.EnvelopeSent Then
|
||||
' TODO - Nach Testen
|
||||
' SetFormReadonly()
|
||||
End If
|
||||
@@ -95,10 +96,6 @@ Partial Public Class frmEnvelopeEditor
|
||||
ViewDocuments.OptionsBehavior.ReadOnly = True
|
||||
End Sub
|
||||
|
||||
Private Sub frmEnvelopeEditor_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
Controller.CleanupEnvelope()
|
||||
End Sub
|
||||
|
||||
Private Sub btnDeleteFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDeleteFile.ItemClick
|
||||
If ViewDocuments.GetSelectedRows().Count > 0 Then
|
||||
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
|
||||
@@ -133,7 +130,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
Where(Function(d) d.Filename = oDocument.Filename).
|
||||
SingleOrDefault(),
|
||||
.GDPictureKey = oGDPictureKey,
|
||||
.Receivers = Receivers.ToList,
|
||||
.Receivers = Controller.Envelope.Receivers.ToList,
|
||||
.State = State
|
||||
}
|
||||
oForm.ShowDialog()
|
||||
@@ -174,6 +171,37 @@ Partial Public Class frmEnvelopeEditor
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function ValidateEnvelope() As List(Of String)
|
||||
Dim oSubject = GetEditValueFromTextControl(txtSubject)
|
||||
Dim oMessage = GetEditValueFromTextControl(txtMessage)
|
||||
|
||||
Dim oErrors As New List(Of String)
|
||||
|
||||
If String.IsNullOrWhiteSpace(oSubject) Then
|
||||
oErrors.Add(Resources.Envelope.Missing_Subject)
|
||||
End If
|
||||
|
||||
If String.IsNullOrWhiteSpace(oMessage) Then
|
||||
oErrors.Add(Resources.Envelope.Missing_Message)
|
||||
End If
|
||||
|
||||
If Documents.Count = 0 Then
|
||||
oErrors.Add(Resources.Envelope.Missing_Documents)
|
||||
End If
|
||||
|
||||
If Receivers.Count = 0 Then
|
||||
oErrors.Add(Resources.Envelope.Missing_Receivers)
|
||||
End If
|
||||
|
||||
For Each Receiver In Receivers
|
||||
If Helpers.IsValidEmailAddress(Receiver.Email) = False Then
|
||||
oErrors.Add(String.Format(Resources.Envelope.Invalid_Email_Address, Receiver.Name))
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oErrors
|
||||
End Function
|
||||
|
||||
Private Function SaveEnvelope(pWithValidation As Boolean) As Boolean
|
||||
Dim oSubject = GetEditValueFromTextControl(txtSubject)
|
||||
Dim oMessage = GetEditValueFromTextControl(txtMessage)
|
||||
@@ -181,20 +209,25 @@ Partial Public Class frmEnvelopeEditor
|
||||
' Ensure all receivers are saved
|
||||
ViewReceivers.CloseEditor()
|
||||
|
||||
Dim oEnvelope = Controller.Envelope
|
||||
oEnvelope.Subject = oSubject
|
||||
oEnvelope.Message = oMessage
|
||||
oEnvelope.Documents = Documents.ToList
|
||||
|
||||
If pWithValidation = True Then
|
||||
Dim oErrors = oEnvelope.Validate()
|
||||
Dim oErrors = ValidateEnvelope()
|
||||
If oErrors.Any Then
|
||||
ShowValidationErrors(Resources.Envelope.Errors_when_saving_the_envelope, oErrors)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
If Controller.CreateEnvelopeReceivers(Receivers.ToList) = False Then
|
||||
Dim oEnvelope = Controller.Envelope
|
||||
oEnvelope.Subject = oSubject
|
||||
oEnvelope.Message = oMessage
|
||||
oEnvelope.Documents = Documents.ToList
|
||||
|
||||
|
||||
'oEnvelope.Receivers = Receivers.ToList
|
||||
|
||||
|
||||
|
||||
If Controller.SaveReceivers(oEnvelope, Receivers.ToList) = False Then
|
||||
MsgBox(Resources.Envelope.Error_when_saving_the_recipients, MsgBoxStyle.Critical, Text)
|
||||
Return False
|
||||
End If
|
||||
@@ -249,7 +282,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
End Sub
|
||||
|
||||
Private Sub btnSendEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSendEnvelope.ItemClick
|
||||
If Controller.Envelope.Status = Constants.EnvelopeStatus.Sent Then
|
||||
If Controller.Envelope.Status = Constants.EnvelopeStatus.EnvelopeSent Then
|
||||
MsgBox(Resources.Envelope.Envelope_already_sent, MsgBoxStyle.Information, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -258,7 +291,9 @@ Partial Public Class frmEnvelopeEditor
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oErrors = Controller.ValidateEnvelopeForSending()
|
||||
Dim oErrors = ValidateEnvelope()
|
||||
oErrors = Controller.ValidateEnvelopeForSending(oErrors)
|
||||
|
||||
If oErrors.Any() Then
|
||||
ShowValidationErrors(Resources.Envelope.Error_sending_the_envelope, oErrors)
|
||||
Exit Sub
|
||||
|
||||
Reference in New Issue
Block a user