2023-11-06 Neuer Status "Teil-Signiert", "Vollständig Signiert"

Teil-Validierung
This commit is contained in:
2023-11-06 16:23:05 +01:00
parent f4549c0481
commit fc100df537
11 changed files with 86 additions and 31 deletions

View File

@@ -265,21 +265,20 @@ Public Class EnvelopeEditorController
Dim oExistingReceivers As List(Of EnvelopeReceiver) = ReceiverModel.ListReceivers(pCurrentReceivers)
Dim oExistingAddresses = oExistingReceivers.Select(Function(r) r.Email)
' Neue Empfänger
Dim oNewReceivers = pCurrentReceivers.
Where(Function(r) Not oExistingAddresses.Contains(r.Email)).ToList()
For Each oReceiver In oNewReceivers
oReceiver.Id = 0
Next
' Empfänger, die bereits einmal verwendet wurden
For Each oCurrentReceiver In pCurrentReceivers
If oCurrentReceiver.Id = 0 Then
Dim oExistingReceiver As EnvelopeReceiver = oExistingReceivers.Where(Function(r) r.Email = oCurrentReceiver.Email).First()
oCurrentReceiver.Id = oExistingReceiver.Id
Dim oExistingReceiver As EnvelopeReceiver = oExistingReceivers.Where(Function(r) r.Email.Equals(oCurrentReceiver.Email, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault()
If oExistingReceiver IsNot Nothing Then
oCurrentReceiver.Id = oExistingReceiver.Id
End If
End If
Next
Dim oConnection = Database.GetConnection()
Dim oTransaction = oConnection.BeginTransaction()

View File

@@ -1,5 +1,4 @@
Imports System.ComponentModel
Imports System.Runtime.Remoting.Messaging
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
@@ -117,12 +116,15 @@ Partial Public Class frmEnvelopeEditor
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Try
If SaveEnvelopeWithReceiverDocumentValidation() = False Then
Return
End If
If ViewDocuments.GetSelectedRows().Count > 0 Then
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
If SaveEnvelopeWithOutValidation() Then
Dim oForm As New frmFieldEditor() With {
Dim oForm As New frmFieldEditor() With {
.Document = Controller.Envelope.Documents.
Where(Function(d) d.Filename = oDocument.Filename).
SingleOrDefault(),
@@ -130,8 +132,8 @@ Partial Public Class frmEnvelopeEditor
.Receivers = Receivers.ToList,
.State = State
}
oForm.ShowDialog()
End If
oForm.ShowDialog()
End If
Catch ex As Exception
Logger.Error(ex)
@@ -148,6 +150,26 @@ Partial Public Class frmEnvelopeEditor
Return SaveEnvelope(False)
End Function
''' <summary>
''' Speichert den Envelope und prüft
''' ob Receiver und Dokument vorhanden ist.
''' </summary>
Private Function SaveEnvelopeWithReceiverDocumentValidation() As Boolean
If SaveEnvelope(False) = True Then
Dim oEnvelope = Controller.Envelope
Dim oErrors = oEnvelope.ValidateReceiverDocumentData()
If oErrors.Any Then
ShowValidationErrors(Resources.Envelope.Errors_when_saving_the_envelope, oErrors)
Return False
End If
Else
Return False
End If
Return True
End Function
Private Function SaveEnvelope(pWithValidation As Boolean) As Boolean
Dim oSubject = GetEditValueFromTextControl(txtSubject)
Dim oMessage = GetEditValueFromTextControl(txtMessage)

View File

@@ -68,12 +68,7 @@ Public Class frmMain
Controller = New EnvelopeListController(State)
LoadEnvelopes()
GridBuilder = New GridBuilder(ViewEnvelopes)
GridBuilder.SetDefaults(ViewEnvelopes)
GridBuilder.SetReadOnlyOptions(ViewEnvelopes)
LoadCompletedEnvelopes()
Catch ex As Exception
Logger.Error(ex)