16-08-23
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Threading.Tasks
|
||||
Imports DevExpress.XtraSplashScreen
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common
|
||||
|
||||
@@ -69,23 +71,30 @@ Partial Public Class frmEnvelopeEditor
|
||||
End Sub
|
||||
|
||||
Private Sub btnEditFields_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditFields.ItemClick
|
||||
If ViewDocuments.GetSelectedRows().Count > 0 Then
|
||||
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
|
||||
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
|
||||
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||||
|
||||
Try
|
||||
If ViewDocuments.GetSelectedRows().Count > 0 Then
|
||||
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
|
||||
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
|
||||
|
||||
If SaveEnvelope() Then
|
||||
Dim oForm As New frmFieldEditor() With {
|
||||
.Document = Controller.Envelope.Documents.
|
||||
Where(Function(d) d.Filename = oDocument.Filename).
|
||||
SingleOrDefault(),
|
||||
.GDPictureKey = oGDPictureKey,
|
||||
.Receivers = Receivers.ToList,
|
||||
.State = State
|
||||
}
|
||||
oForm.ShowDialog()
|
||||
If SaveEnvelope() Then
|
||||
Dim oForm As New frmFieldEditor() With {
|
||||
.Document = Controller.Envelope.Documents.
|
||||
Where(Function(d) d.Filename = oDocument.Filename).
|
||||
SingleOrDefault(),
|
||||
.GDPictureKey = oGDPictureKey,
|
||||
.Receivers = Receivers.ToList,
|
||||
.State = State
|
||||
}
|
||||
oForm.Show()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Finally
|
||||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function SaveEnvelope() As Boolean
|
||||
@@ -95,16 +104,10 @@ Partial Public Class frmEnvelopeEditor
|
||||
' Ensure all receivers are saved
|
||||
ViewReceivers.CloseEditor()
|
||||
|
||||
Dim oReceivers = Receivers.ToList
|
||||
If Controller.CreateEnvelopeReceivers(Receivers.ToList) = False Then
|
||||
MsgBox("Fehler beim Speichern der Empfänger!", MsgBoxStyle.Critical, Text)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oEnvelope = Controller.Envelope
|
||||
oEnvelope.Subject = oSubject
|
||||
oEnvelope.Message = oMessage
|
||||
oEnvelope.Receivers = oReceivers
|
||||
oEnvelope.Receivers = Receivers.ToList
|
||||
oEnvelope.Documents = Documents.ToList
|
||||
|
||||
Dim oErrors = oEnvelope.Validate()
|
||||
@@ -112,7 +115,14 @@ Partial Public Class frmEnvelopeEditor
|
||||
Dim oError = "Fehler beim Speichern des Umschlags:" & vbNewLine & vbNewLine & String.Join(vbNewLine, oErrors)
|
||||
MsgBox(oError, MsgBoxStyle.Exclamation, Text)
|
||||
Return False
|
||||
ElseIf Controller.SaveEnvelope(oEnvelope) = False Then
|
||||
End If
|
||||
|
||||
If Controller.CreateEnvelopeReceivers(oEnvelope.Receivers) = False Then
|
||||
MsgBox("Fehler beim Speichern der Empfänger!", MsgBoxStyle.Critical, Text)
|
||||
Return False
|
||||
End If
|
||||
|
||||
If Controller.SaveEnvelope(oEnvelope) = False Then
|
||||
MsgBox("Fehler beim Speichern des Umschlags!", MsgBoxStyle.Critical, Text)
|
||||
Return False
|
||||
Else
|
||||
@@ -120,22 +130,31 @@ Partial Public Class frmEnvelopeEditor
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnDeleteReceiver_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDeleteReceiver.ItemClick
|
||||
If ViewReceivers.SelectedRowsCount = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' TODO: Delete receivers for ALL documents
|
||||
Dim oReceiver As EnvelopeReceiver = ViewReceivers.GetFocusedRow()
|
||||
|
||||
If oReceiver Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oMessage2 = "Es gibt für diesen Empfänger bereits Elemente. Wollen Sie den Empfänger trotzdem löschen?"
|
||||
Dim oMessage = "Wollen Sie den ausgewählten Empfänger löschen?"
|
||||
If Controller.ElementsExist(oReceiver.Id) Then
|
||||
oMessage = "Es gibt für diesen Empfänger bereits Elemente. Wollen Sie den Empfänger trotzdem löschen?"
|
||||
End If
|
||||
|
||||
If MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.No Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Controller.DeleteReceiver(oReceiver) Then
|
||||
Receivers.Remove(oReceiver)
|
||||
Else
|
||||
MsgBox("Empfänger konnte nicht entfernt werden.", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user