Refactor envelope type handling and validation logic
- Change ContractType property to use Constants.ContractType enum for improved type safety. - Move EnvelopeType selection to a shared module-level variable for consistent access. - Allow user selection of contract type when creating envelopes. - Refine envelope validation to check for required elements per receiver, with improved error messages.
This commit is contained in:
@@ -56,7 +56,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
|||||||
public int ReminderIntervalDays { get; set; } = 0;
|
public int ReminderIntervalDays { get; set; } = 0;
|
||||||
|
|
||||||
[Column("CONTRACT_TYPE")]
|
[Column("CONTRACT_TYPE")]
|
||||||
public int ContractType { get; set; }
|
public Constants.ContractType ContractType { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public bool TFA_Enabled { get; set; } = false;
|
public bool TFA_Enabled { get; set; } = false;
|
||||||
|
|||||||
@@ -50,17 +50,21 @@ Public Class EnvelopeEditorController
|
|||||||
Public Function ValidateEnvelopeForSending(pErrors As List(Of String)) As List(Of String)
|
Public Function ValidateEnvelopeForSending(pErrors As List(Of String)) As List(Of String)
|
||||||
Dim oEnvelopeErrors = pErrors
|
Dim oEnvelopeErrors = pErrors
|
||||||
|
|
||||||
If ElementModel.ElementsExist(Envelope.Id) = False Then
|
If Envelope.EnvelopeTypeId <> Domain.Constants.ContractType.ReadAndSign Then
|
||||||
oEnvelopeErrors.Add(Resources.Envelope.Missing_Elements)
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ElementModel.OneElementPerReceiverExist(Envelope.Id) = False Then
|
If ElementModel.ElementsExist(Envelope.Id) = False Then
|
||||||
|
oEnvelopeErrors.Add(Resources.Envelope.Missing_Elements)
|
||||||
|
End If
|
||||||
|
|
||||||
For Each receiverItem As Receiver In Envelope.Receivers
|
If ElementModel.OneElementPerReceiverExist(Envelope.Id) = False Then
|
||||||
If ElementModel.ElementsExist(Envelope.Id, receiverItem.Id) = False Then
|
|
||||||
oEnvelopeErrors.Add(String.Format(Resources.Envelope.Missing_Elements_for_Receiver, receiverItem.Name))
|
For Each receiverItem As Receiver In Envelope.Receivers
|
||||||
End If
|
If ElementModel.ElementsExist(Envelope.Id, receiverItem.Id) = False Then
|
||||||
Next
|
oEnvelopeErrors.Add(String.Format(Resources.Envelope.Missing_Elements_for_Receiver, receiverItem.Name))
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ Module ModuleSettings
|
|||||||
Public MyState As State
|
Public MyState As State
|
||||||
Public CurrentEnvelopID As Integer = 0
|
Public CurrentEnvelopID As Integer = 0
|
||||||
Public CurrentEnvelopetitle As String = ""
|
Public CurrentEnvelopetitle As String = ""
|
||||||
|
Public EnvelopeType As EnvelopeType
|
||||||
End Module
|
End Module
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ Public Class frmEnvelopeMainData
|
|||||||
|
|
||||||
Private Property EnvelopeTypeModel As EnvelopeTypeModel
|
Private Property EnvelopeTypeModel As EnvelopeTypeModel
|
||||||
|
|
||||||
<Bindable(True)>
|
'<Bindable(True)>
|
||||||
Private Property EnvelopeType As New EnvelopeType
|
'Private Property EnvelopeType As New EnvelopeType
|
||||||
|
|
||||||
Public Property State As State
|
Public Property State As State
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ Public Class frmEnvelopeMainData
|
|||||||
cmbLanguage.Properties.Items.AddRange(New List(Of String) From {"de", "en"})
|
cmbLanguage.Properties.Items.AddRange(New List(Of String) From {"de", "en"})
|
||||||
|
|
||||||
groupAllOptions.Expanded = False
|
groupAllOptions.Expanded = False
|
||||||
Dim EnvelopeType = oTypes.FirstOrDefault()
|
EnvelopeType = oTypes.FirstOrDefault()
|
||||||
If NewEnvelopeMode = True Then
|
If NewEnvelopeMode = True Then
|
||||||
|
|
||||||
|
|
||||||
@@ -139,8 +139,8 @@ Public Class frmEnvelopeMainData
|
|||||||
Envelope.FinalEmailToCreator = cmbEmailToCreator.SelectedIndex
|
Envelope.FinalEmailToCreator = cmbEmailToCreator.SelectedIndex
|
||||||
Envelope.FinalEmailToReceivers = cmbEmailToReceivers.SelectedIndex
|
Envelope.FinalEmailToReceivers = cmbEmailToReceivers.SelectedIndex
|
||||||
Envelope.TFA_Enabled = chked_2Faktor.EditValue
|
Envelope.TFA_Enabled = chked_2Faktor.EditValue
|
||||||
' ContractType kann zzt nicht über die Oberfläche gesetzt werden
|
' ContractType kann zzt nicht über die Oberfläche gesetzt werden - jetzt sollte es gehen.
|
||||||
Envelope.ContractType = ContractType.Contract
|
Envelope.EnvelopeType = EnvelopeType
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub frmEnvelopeMainData_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
Private Sub frmEnvelopeMainData_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||||
|
|||||||
Reference in New Issue
Block a user