Compare commits

...

2 Commits

Author SHA1 Message Date
Jonathan Jenne
b312396bb5 16-08-23 2023-08-16 12:06:10 +02:00
Jonathan Jenne
069f5a6f88 14-08-23 2023-08-14 13:33:53 +02:00
17 changed files with 574 additions and 203 deletions

View File

@@ -1,5 +1,5 @@
Public Class EnvelopeDocumentElement Public Class EnvelopeDocumentElement
Public Property Id As Integer = 0 Public Property Id As Integer = -1
Public Property X As Double Public Property X As Double
Public Property Y As Double Public Property Y As Double
Public Property Width As Double Public Property Width As Double
@@ -11,5 +11,18 @@
Public Property [ReadOnly] As Boolean = False Public Property [ReadOnly] As Boolean = False
Public Property Page As Integer = 1 Public Property Page As Integer = 1
Public Property Status As Constants.ElementStatus = Constants.ElementStatus.Created Public Property Status As Constants.ElementStatus = Constants.ElementStatus.Created
Public Property AnnotationIndex As Integer Public Property Index As Integer = 0
Public ReadOnly Property Top As Single
Get
Return Math.Round(Y, 5)
End Get
End Property
Public ReadOnly Property Left As Single
Get
Return Math.Round(X, 5)
End Get
End Property
End Class End Class

View File

@@ -64,6 +64,19 @@ Public Class DocumentModel
End Try End Try
End Function End Function
Public Function Delete(pDocumentId As Integer, pTransaction As SqlTransaction) As Boolean
Try
Dim oSql = "DELETE FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE GUID = @GUID"
Dim oCommand As New SqlCommand(oSql)
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = pDocumentId
Return Database.ExecuteNonQuery(oCommand, pTransaction)
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Private Function GetDocumentId(pFilename As String, pEnvelope As Envelope, pTransaction As SqlTransaction) As Integer Private Function GetDocumentId(pFilename As String, pEnvelope As Envelope, pTransaction As SqlTransaction) As Integer
Try Try
Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_ENVELOPE_DOCUMENT WHERE FILENAME = '{pFilename}' AND ENVELOPE_ID = {pEnvelope.Id}", pTransaction) Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_ENVELOPE_DOCUMENT WHERE FILENAME = '{pFilename}' AND ENVELOPE_ID = {pEnvelope.Id}", pTransaction)

View File

@@ -19,8 +19,7 @@ Public Class ElementModel
.Y = pRow.ItemEx("POSITION_Y", 0.0), .Y = pRow.ItemEx("POSITION_Y", 0.0),
.Width = pRow.ItemEx("WIDTH", 0.0), .Width = pRow.ItemEx("WIDTH", 0.0),
.Height = pRow.ItemEx("HEIGHT", 0.0), .Height = pRow.ItemEx("HEIGHT", 0.0),
.Page = pRow.ItemEx("PAGE", 0), .Page = pRow.ItemEx("PAGE", 0)
.AnnotationIndex = pRow.ItemEx("ANNOTATION_INDEX", 0)
} }
End Function End Function
@@ -41,7 +40,7 @@ Public Class ElementModel
Public Function List(pDocumentId As Integer) As List(Of EnvelopeDocumentElement) Public Function List(pDocumentId As Integer) As List(Of EnvelopeDocumentElement)
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId} ORDER BY PAGE ASC, ANNOTATION_INDEX ASC" Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId} ORDER BY PAGE ASC"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow). Return oTable?.Rows.Cast(Of DataRow).
@@ -67,8 +66,7 @@ Public Class ElementModel
,[REQUIRED] ,[REQUIRED]
,[READ_ONLY] ,[READ_ONLY]
,[STATUS] ,[STATUS]
,[PAGE] ,[PAGE])
,[ANNOTATION_INDEX])
VALUES VALUES
(@DOCUMENT_ID (@DOCUMENT_ID
,@RECEIVER_ID ,@RECEIVER_ID
@@ -80,8 +78,7 @@ Public Class ElementModel
,@REQUIRED ,@REQUIRED
,@READ_ONLY ,@READ_ONLY
,@STATUS ,@STATUS
,@PAGE ,@PAGE)"
,@INDEX)"
Dim oCommand As New SqlCommand(oSql) Dim oCommand As New SqlCommand(oSql)
oCommand.Parameters.Add("DOCUMENT_ID", SqlDbType.NVarChar).Value = pElement.DocumentId oCommand.Parameters.Add("DOCUMENT_ID", SqlDbType.NVarChar).Value = pElement.DocumentId
@@ -95,7 +92,6 @@ Public Class ElementModel
oCommand.Parameters.Add("READ_ONLY", SqlDbType.Bit).Value = pElement.ReadOnly oCommand.Parameters.Add("READ_ONLY", SqlDbType.Bit).Value = pElement.ReadOnly
oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = pElement.Status.ToString oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = pElement.Status.ToString
oCommand.Parameters.Add("PAGE", SqlDbType.Int).Value = pElement.Page oCommand.Parameters.Add("PAGE", SqlDbType.Int).Value = pElement.Page
oCommand.Parameters.Add("INDEX", SqlDbType.Int).Value = pElement.AnnotationIndex
If Database.ExecuteNonQuery(oCommand) Then If Database.ExecuteNonQuery(oCommand) Then
pElement.Id = GetElementId(pElement) pElement.Id = GetElementId(pElement)
@@ -154,4 +150,24 @@ Public Class ElementModel
Return False Return False
End Try End Try
End Function End Function
Public Function DeleteElements(pReceiverId As Integer, pDocumentId As Integer, pTransaction As SqlTransaction) As Boolean
Try
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT WHERE RECEIVER_ID = {pReceiverId} AND DOCUMENT_ID = {pDocumentId}"
Return Database.ExecuteNonQuery(oSql, pTransaction)
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function DeleteElements(pDocumentId As Integer, pTransaction As SqlTransaction) As Boolean
Try
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT WHERE DOCUMENT_ID = {pDocumentId}"
Return Database.ExecuteNonQuery(oSql, pTransaction)
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class End Class

View File

@@ -80,10 +80,10 @@ Public Class EnvelopeModel
End Try End Try
End Function End Function
Public Function Delete(pEnvelope As Envelope) As Boolean Public Function Delete(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
Try Try
Dim oSql = $"DELETE FROM [dbo].[TBSIG_ENVELOPE] WHERE GUID = {pEnvelope.Id}" Dim oSql = $"DELETE FROM [dbo].[TBSIG_ENVELOPE] WHERE GUID = {pEnvelope.Id}"
Return Database.ExecuteNonQuery(oSql) Return Database.ExecuteNonQuery(oSql, pTransaction)
Catch ex As Exception Catch ex As Exception
Return False Return False

View File

@@ -137,7 +137,12 @@ Public Class ReceiverModel
Public Function ListReceivers(pExistingReceivers As IEnumerable(Of EnvelopeReceiver)) As IEnumerable(Of EnvelopeReceiver) Public Function ListReceivers(pExistingReceivers As IEnumerable(Of EnvelopeReceiver)) As IEnumerable(Of EnvelopeReceiver)
Try Try
If pExistingReceivers.Count = 0 Then
Return New List(Of EnvelopeReceiver)
End If
Dim oAddresses = pExistingReceivers.Select(Function(r) $"'{r.Email}'").JoinToString(",") Dim oAddresses = pExistingReceivers.Select(Function(r) $"'{r.Email}'").JoinToString(",")
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_RECEIVER] WHERE EMAIL_ADDRESS IN ({oAddresses})" Dim oSql = $"SELECT * FROM [dbo].[TBSIG_RECEIVER] WHERE EMAIL_ADDRESS IN ({oAddresses})"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
@@ -151,10 +156,10 @@ Public Class ReceiverModel
End Try End Try
End Function End Function
Public Function Delete(pReceiverId As Integer, pDocumentId As Integer) As Boolean Public Function Delete(pReceiverId As Integer, pEnvelopeId As Integer, pTransaction As SqlTransaction) As Boolean
Try Try
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER WHERE RECEIVER_ID = {pReceiverId} AND DOCUMENT_ID = {pDocumentId}" Dim oSql = $"DELETE FROM TBSIG_ENVELOPE_RECEIVER WHERE RECEIVER_ID = {pReceiverId} AND ENVELOPE_ID = {pEnvelopeId}"
Return Database.ExecuteNonQuery(oSql) Return Database.ExecuteNonQuery(oSql, pTransaction)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)

View File

@@ -0,0 +1,101 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Base
Imports EnvelopeGenerator.Common
Imports System.Data.SqlClient
Public MustInherit Class BaseController
Inherits BaseClass
Public EnvelopeModel As EnvelopeModel
Public DocumentModel As DocumentModel
Public ReceiverModel As ReceiverModel
Public ElementModel As ElementModel
Public HistoryModel As HistoryModel
Public UserModel As UserModel
Public ReadOnly Property Database As MSSQLServer
Public ReadOnly Property State As State
Public Sub New(pState As State)
MyBase.New(pState.LogConfig)
State = pState
Database = pState.Database
InitializeModels(pState)
End Sub
Private Sub InitializeModels(pState As State)
EnvelopeModel = New EnvelopeModel(pState)
DocumentModel = New DocumentModel(pState)
ReceiverModel = New ReceiverModel(pState)
ElementModel = New ElementModel(pState)
HistoryModel = New HistoryModel(pState)
UserModel = New UserModel(pState)
End Sub
Public Function DeleteEnvelope(pEnvelope As Envelope) As Boolean
Dim oConnection As SqlConnection = Database.GetConnection()
Dim oTransaction As SqlTransaction = oConnection.BeginTransaction()
Try
Dim oResult = pEnvelope.Documents.
Select(Function(d) DeleteDocument(d, oTransaction)).
All(Function(r) r = True)
If oResult = False Then
Throw New ApplicationException("could not delete documents")
End If
Dim oResult2 = pEnvelope.Receivers.
Select(Function(r) ReceiverModel.Delete(r.Id, pEnvelope.Id, oTransaction)).
All(Function(r) r = True)
If oResult2 = False Then
Throw New ApplicationException("could not delete receivers")
End If
Dim oResult3 = EnvelopeModel.Delete(pEnvelope, oTransaction)
If oResult3 = False Then
Throw New ApplicationException("could not delete envelope")
End If
oTransaction.Commit()
Return True
Catch ex As Exception
Logger.Error(ex)
oTransaction.Rollback()
Return False
End Try
End Function
Public Function DeleteDocument(pDocument As EnvelopeDocument, pTransaction As SqlTransaction) As Boolean
Try
If DocumentModel.Delete(pDocument.Id, pTransaction) = True Then
Dim oResult = ElementModel.DeleteElements(pDocument.Id, pTransaction)
If oResult = False Then
Throw New ApplicationException("Could not delete elements!")
End If
Else
Throw New ApplicationException("Could not delete document!")
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
Try
IO.File.Delete(pDocument.Filepath)
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
Return True
End Function
End Class

View File

@@ -1,60 +1,28 @@
Imports System.Data.Common Imports System.Data.SqlClient
Imports System.Data.SqlClient
Imports System.IO Imports System.IO
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports EnvelopeGenerator.Common Imports EnvelopeGenerator.Common
Imports EnvelopeGenerator.Common.Constants Imports EnvelopeGenerator.Common.Constants
Public Class EnvelopeEditorController Public Class EnvelopeEditorController
Inherits BaseClass Inherits BaseController
Private ReadOnly Database As MSSQLServer
Private ReadOnly State As State = Nothing
Private EnvelopeModel As EnvelopeModel
Private DocumentModel As DocumentModel
Private ReceiverModel As ReceiverModel
Private ElementModel As ElementModel
Private HistoryModel As HistoryModel
Private UserModel As UserModel
Public ReadOnly Envelope As Envelope = Nothing Public ReadOnly Envelope As Envelope = Nothing
Public Sub New(pState As State) Public Sub New(pState As State)
MyBase.New(pState.LogConfig) MyBase.New(pState)
Database = pState.Database
State = pState
InitializeModels(pState)
Envelope = CreateEnvelope() Envelope = CreateEnvelope()
End Sub End Sub
Public Sub New(pState As State, pEnvelope As Envelope) Public Sub New(pState As State, pEnvelope As Envelope)
MyBase.New(pState.LogConfig) MyBase.New(pState)
Database = pState.Database
State = pState
InitializeModels(pState)
Envelope = pEnvelope Envelope = pEnvelope
Envelope.Documents = DocumentModel.List(pEnvelope.Id) Envelope.Documents = DocumentModel.List(pEnvelope.Id)
Envelope.Receivers = ReceiverModel.ListEnvelopeReceivers(pEnvelope.Id) Envelope.Receivers = ReceiverModel.ListEnvelopeReceivers(pEnvelope.Id)
End Sub End Sub
Private Sub InitializeModels(pState As State)
EnvelopeModel = New EnvelopeModel(pState)
DocumentModel = New DocumentModel(pState)
ReceiverModel = New ReceiverModel(pState)
ElementModel = New ElementModel(pState)
HistoryModel = New HistoryModel(pState)
UserModel = New UserModel(pState)
End Sub
#Region "Public" #Region "Public"
Public Function CreateEnvelope() As Envelope Public Function CreateEnvelope() As Envelope
Dim oEnvelope As New Envelope() With { Dim oEnvelope As New Envelope() With {
@@ -114,9 +82,7 @@ Public Class EnvelopeEditorController
Public Function CleanupEnvelope() As Boolean Public Function CleanupEnvelope() As Boolean
If Envelope.Status = Common.Constants.EnvelopeStatus.Created Then If Envelope.Status = Common.Constants.EnvelopeStatus.Created Then
'TODO: Delete Documents and Receivers and elements Return DeleteEnvelope(Envelope)
Return EnvelopeModel.Delete(Envelope)
Else Else
Return True Return True
End If End If
@@ -141,14 +107,17 @@ Public Class EnvelopeEditorController
End Try End Try
End Function End Function
Public Function DeleteDocument(pDocument As EnvelopeDocument) As Boolean Public Overloads Function DeleteDocument(pDocument As EnvelopeDocument) As Boolean
Dim oSql = "DELETE FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE FILENAME = @FILENAME AND ENVELOPE_ID = @ENVELOPE_ID" Dim oConnection As SqlConnection = Database.GetConnection
Dim oCommand As New SqlCommand(oSql) Dim oTransaction As SqlTransaction = oConnection.BeginTransaction
oCommand.Parameters.Add("FILENAME", SqlDbType.NVarChar).Value = pDocument.Filename
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = Envelope.Id
'TODO: delete document file, from temp and from documentpath
Return Database.ExecuteNonQuery(oCommand) If DeleteDocument(pDocument, oTransaction) = True Then
oTransaction.Commit()
Return True
Else
oTransaction.Rollback()
Return False
End If
End Function End Function
Public Function SaveEnvelopeDocumentsToFilesystem(pEnvelope As Envelope) As Boolean Public Function SaveEnvelopeDocumentsToFilesystem(pEnvelope As Envelope) As Boolean
@@ -206,28 +175,21 @@ Public Class EnvelopeEditorController
End Try End Try
End Function End Function
Public Function CreateEnvelopeReceivers(pReceivers As List(Of EnvelopeReceiver)) As Boolean Public Function CreateEnvelopeReceivers(pCurrentReceivers As List(Of EnvelopeReceiver)) As Boolean
Dim oExistingReceivers As List(Of EnvelopeReceiver) = ReceiverModel.ListReceivers(pReceivers) Dim oExistingReceivers As List(Of EnvelopeReceiver) = ReceiverModel.ListReceivers(pCurrentReceivers)
Dim oExistingAddresses = oExistingReceivers.Select(Function(r) r.Email) Dim oExistingAddresses = oExistingReceivers.Select(Function(r) r.Email)
Dim oNewReceivers = pReceivers. Dim oNewReceivers = pCurrentReceivers.
Where(Function(r) Not oExistingAddresses.Contains(r.Email)).ToList() Where(Function(r) Not oExistingAddresses.Contains(r.Email)).ToList()
Dim oOldReceivers = pReceivers. For Each oReceiver In oNewReceivers
Where(Function(r) oExistingAddresses.Contains(r.Email)).ToList() oReceiver.Id = 0
For Each oReceiver In oOldReceivers
oReceiver.Id = oExistingReceivers.
Where(Function(r) r.Email = oReceiver.Email).
Select(Function(r) r.Id).
FirstOrDefault()
Next Next
Dim oConnection = Database.GetConnection() Dim oConnection = Database.GetConnection()
Dim oTransaction = oConnection.BeginTransaction() Dim oTransaction = oConnection.BeginTransaction()
Try Try
If InsertReceivers(oNewReceivers, oTransaction) = False Then If InsertReceivers(oNewReceivers, oTransaction) = False Then
Throw New ApplicationException("Could not insert receivers!") Throw New ApplicationException("Could not insert receivers!")
End If End If
@@ -261,16 +223,35 @@ Public Class EnvelopeEditorController
End Try End Try
End Function End Function
Private Function DeleteReceiver(pReceiver As EnvelopeReceiver) As Boolean Public Function DeleteReceiver(pReceiver As EnvelopeReceiver) As Boolean
Dim oConnection As SqlConnection = Database.GetConnection()
Dim oTransaction As SqlTransaction = oConnection.BeginTransaction()
Try Try
If ReceiverModel.Delete(pReceiver.Id, Envelope.Id, oTransaction) = True Then
Dim oResult = Envelope.Documents.
Select(Function(d) ElementModel.DeleteElements(pReceiver.Id, d.Id, oTransaction)).
All(Function(pResult) pResult = True)
If oResult = False Then
Throw New ApplicationException("Could not delete elements!")
End If
Else
Throw New ApplicationException("Could not delete receiver!")
End If
oTransaction.Commit()
Return True
Catch ex As Exception Catch ex As Exception
Logger.Error(ex)
oTransaction.Rollback()
Return False
End Try End Try
End Function End Function
Public Function ElementsExist(pDocumentId As Integer, pReceiverId As Integer) As Boolean Public Function ElementsExist(pReceiverId As Integer) As Boolean
Return ElementModel.ElementsExist(pDocumentId, pReceiverId) Return ElementModel.ElementsExist(Envelope.Id, pReceiverId)
End Function End Function
Private Function InsertReceivers(pReceivers As List(Of EnvelopeReceiver), pTransaction As SqlTransaction) As Boolean Private Function InsertReceivers(pReceivers As List(Of EnvelopeReceiver), pTransaction As SqlTransaction) As Boolean

View File

@@ -1,22 +1,18 @@
Imports DigitalData.Modules.Base Imports EnvelopeGenerator.Common
Imports DigitalData.Modules.Database
Imports EnvelopeGenerator.Common
Public Class EnvelopeListController Public Class EnvelopeListController
Inherits BaseClass Inherits BaseController
Private ReadOnly Database As MSSQLServer
Private ReadOnly State As State
Private ReadOnly EnvelopeModel As EnvelopeModel
Public Sub New(pState As State) Public Sub New(pState As State)
MyBase.New(pState.LogConfig) MyBase.New(pState)
Database = pState.Database
State = pState
EnvelopeModel = New EnvelopeModel(pState)
End Sub End Sub
Public Function ListEnvelopes() As IEnumerable(Of Envelope) Public Function ListEnvelopes() As IEnumerable(Of Envelope)
Return EnvelopeModel.List() Return EnvelopeModel.List()
End Function End Function
Public Overloads Function DeleteEnvelope(pEnvelope As Envelope) As Boolean
Return MyBase.DeleteEnvelope(pEnvelope)
End Function
End Class End Class

View File

@@ -1,38 +1,75 @@
Imports DigitalData.Modules.Base Imports EnvelopeGenerator.Common
Imports DigitalData.Modules.Database
Imports EnvelopeGenerator.Common
Imports GdPicture14.Annotations Imports GdPicture14.Annotations
Public Class FieldEditorController Public Class FieldEditorController
Inherits BaseClass Inherits BaseController
Private ReadOnly ElementModel As ElementModel
Private ReadOnly Database As MSSQLServer
Private ReadOnly Document As EnvelopeDocument Private ReadOnly Document As EnvelopeDocument
Public Property Elements As New List(Of EnvelopeDocumentElement) Public Property Elements As New List(Of EnvelopeDocumentElement)
Public Class ElementInfo
Public ReceiverId As Integer
Public Page As Integer
Public Guid As Integer
End Class
Public Sub New(pState As State, pDocument As EnvelopeDocument) Public Sub New(pState As State, pDocument As EnvelopeDocument)
MyBase.New(pState.LogConfig) MyBase.New(pState)
Database = pState.Database
Document = pDocument Document = pDocument
ElementModel = New ElementModel(pState) ElementModel = New ElementModel(pState)
End Sub End Sub
Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote) Public Function GetElementInfo(pAnnotationTag As String) As ElementInfo
Dim oTag As String() = pAnnotation.Tag.Split("|"c) Dim oTag As String() = pAnnotationTag.Split("|"c)
Dim oReceiverId = Integer.Parse(oTag(0)) Dim oReceiverId = Integer.Parse(oTag(0))
Dim oPage = Integer.Parse(oTag(1)) Dim oPage = Integer.Parse(oTag(1))
Dim oIndex = Integer.Parse(oTag(2)) Dim oGuid = Integer.Parse(oTag(2))
Dim oELement = Elements.Where(Function(e) e.AnnotationIndex = oIndex And e.Page = oPage And e.ReceiverId = oReceiverId).SingleOrDefault()
If oELement IsNot Nothing Then Return New ElementInfo With {
oELement.Height = pAnnotation.Height .Guid = oGuid,
oELement.Width = pAnnotation.Width .Page = oPage,
oELement.X = pAnnotation.Left .ReceiverId = oReceiverId
oELement.Y = pAnnotation.Top }
End Function
Private Function GetElementByPosition(pAnnotation As AnnotationStickyNote, pPage As Integer, pReceiverId As Integer) As EnvelopeDocumentElement
Dim oElement = Elements.
Where(Function(e)
Return e.Left = CSng(Math.Round(pAnnotation.Left, 5)) And
e.Top = CSng(Math.Round(pAnnotation.Top, 5)) And
e.Page = pPage And
e.ReceiverId = pReceiverId
End Function).SingleOrDefault()
Return oElement
End Function
Private Function GetElementByGuid(pGuid As Integer) As EnvelopeDocumentElement
Dim oElement = Elements.Where(Function(e) pGuid = e.Id).SingleOrDefault()
Return oElement
End Function
Public Function GetElement(pAnnotation As AnnotationStickyNote) As EnvelopeDocumentElement
Dim oInfo = GetElementInfo(pAnnotation.Tag)
If oInfo.Guid = -1 Then
Return GetElementByPosition(pAnnotation, oInfo.Page, oInfo.ReceiverId)
Else Else
Return GetElementByGuid(oInfo.Guid)
End If
End Function
Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote)
Dim oElement = GetElement(pAnnotation)
If oElement IsNot Nothing Then
oElement.Height = pAnnotation.Height
oElement.Width = pAnnotation.Width
oElement.X = pAnnotation.Left
oElement.Y = pAnnotation.Top
Else
Dim oInfo = GetElementInfo(pAnnotation.Tag)
Elements.Add(New EnvelopeDocumentElement() With { Elements.Add(New EnvelopeDocumentElement() With {
.ElementType = Common.Constants.ElementType.Signature.ToString, .ElementType = Common.Constants.ElementType.Signature.ToString,
.Height = pAnnotation.Height, .Height = pAnnotation.Height,
@@ -40,13 +77,18 @@ Public Class FieldEditorController
.X = pAnnotation.Left, .X = pAnnotation.Left,
.Y = pAnnotation.Top, .Y = pAnnotation.Top,
.DocumentId = Document.Id, .DocumentId = Document.Id,
.ReceiverId = oReceiverId, .ReceiverId = oInfo.ReceiverId,
.AnnotationIndex = oIndex, .Page = oInfo.Page
.Page = oPage
}) })
End If End If
End Sub End Sub
Public Function ClearElements(pPage As Integer, pReceiverId As Integer) As IEnumerable(Of EnvelopeDocumentElement)
Return Elements.
Where(Function(e) e.Page <> pPage And e.ReceiverId <> pReceiverId).
ToList()
End Function
Public Function LoadElements() As Boolean Public Function LoadElements() As Boolean
Elements = ElementModel.List(Document.Id) Elements = ElementModel.List(Document.Id)
@@ -77,4 +119,20 @@ Public Class FieldEditorController
End Try End Try
End Function End Function
Public Function DeleteElement(pElement As EnvelopeDocumentElement) As Boolean
Try
' Element aus Datenbank löschen
If ElementModel.DeleteElement(pElement) Then
Dim oElement = New List(Of EnvelopeDocumentElement)() From {pElement}
Elements = Elements.Except(oElement).ToList()
Return True
Else
Logger.Error("Element [{0}] could not be deleted!", pElement.Id)
Return False
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class End Class

View File

@@ -105,6 +105,7 @@
<Compile Include="Controllers\EnvelopeEditorController.vb" /> <Compile Include="Controllers\EnvelopeEditorController.vb" />
<Compile Include="Controllers\EnvelopeListController.vb" /> <Compile Include="Controllers\EnvelopeListController.vb" />
<Compile Include="Controllers\FieldEditorController.vb" /> <Compile Include="Controllers\FieldEditorController.vb" />
<Compile Include="Controllers\BaseController.vb" />
<Compile Include="frmEnvelopeEditor.vb"> <Compile Include="frmEnvelopeEditor.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@@ -1,9 +1,10 @@
DevExpress.XtraEditors.SearchLookUpEdit, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.SearchLookUpEdit, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -29,10 +29,11 @@ Partial Public Class frmEnvelopeEditor
Private Sub InitializeComponent() Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container() Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmEnvelopeEditor)) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmEnvelopeEditor))
Dim TableColumnDefinition2 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition() Dim TableColumnDefinition1 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition()
Dim TableRowDefinition3 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() Dim TableRowDefinition1 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
Dim TableRowDefinition4 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition() Dim TableRowDefinition2 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
Dim TileViewItemElement2 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement() Dim TileViewItemElement1 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement()
Dim SplashScreenManager1 As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, Nothing, True, True)
Me.colFilename = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.colFilename = New DevExpress.XtraGrid.Columns.TileViewColumn()
Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl()
Me.btnSave = New DevExpress.XtraBars.BarButtonItem() Me.btnSave = New DevExpress.XtraBars.BarButtonItem()
@@ -41,11 +42,13 @@ Partial Public Class frmEnvelopeEditor
Me.btnDeleteFile = New DevExpress.XtraBars.BarButtonItem() Me.btnDeleteFile = New DevExpress.XtraBars.BarButtonItem()
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
Me.btnEditFields = New DevExpress.XtraBars.BarButtonItem() Me.btnEditFields = New DevExpress.XtraBars.BarButtonItem()
Me.btnDeleteReceiver = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup5 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
Me.GridDocuments = New DevExpress.XtraGrid.GridControl() Me.GridDocuments = New DevExpress.XtraGrid.GridControl()
Me.ViewDocuments = New DevExpress.XtraGrid.Views.Tile.TileView() Me.ViewDocuments = New DevExpress.XtraGrid.Views.Tile.TileView()
@@ -67,8 +70,6 @@ Partial Public Class frmEnvelopeEditor
Me.FrmEditorBindingSource = New System.Windows.Forms.BindingSource(Me.components) Me.FrmEditorBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.EnvelopeDocumentBindingSource = New System.Windows.Forms.BindingSource(Me.components) Me.EnvelopeDocumentBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.RibbonPageGroup5 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.btnDeleteReceiver = New DevExpress.XtraBars.BarButtonItem()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerControl1.Panel1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl1.Panel1, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -163,6 +164,12 @@ Partial Public Class frmEnvelopeEditor
Me.btnEditFields.ImageOptions.SvgImage = CType(resources.GetObject("btnEditFields.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.btnEditFields.ImageOptions.SvgImage = CType(resources.GetObject("btnEditFields.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.btnEditFields.Name = "btnEditFields" Me.btnEditFields.Name = "btnEditFields"
' '
'btnDeleteReceiver
'
Me.btnDeleteReceiver.Caption = "Empfänger löschen"
Me.btnDeleteReceiver.Id = 8
Me.btnDeleteReceiver.Name = "btnDeleteReceiver"
'
'RibbonPage1 'RibbonPage1
' '
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3, Me.RibbonPageGroup4, Me.RibbonPageGroup5}) Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3, Me.RibbonPageGroup4, Me.RibbonPageGroup5})
@@ -196,6 +203,12 @@ Partial Public Class frmEnvelopeEditor
Me.RibbonPageGroup4.Name = "RibbonPageGroup4" Me.RibbonPageGroup4.Name = "RibbonPageGroup4"
Me.RibbonPageGroup4.Text = "RibbonPageGroup4" Me.RibbonPageGroup4.Text = "RibbonPageGroup4"
' '
'RibbonPageGroup5
'
Me.RibbonPageGroup5.ItemLinks.Add(Me.btnDeleteReceiver)
Me.RibbonPageGroup5.Name = "RibbonPageGroup5"
Me.RibbonPageGroup5.Text = "RibbonPageGroup5"
'
'SplitContainerControl1 'SplitContainerControl1
' '
Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill
@@ -233,18 +246,18 @@ Partial Public Class frmEnvelopeEditor
Me.ViewDocuments.GridControl = Me.GridDocuments Me.ViewDocuments.GridControl = Me.GridDocuments
Me.ViewDocuments.Name = "ViewDocuments" Me.ViewDocuments.Name = "ViewDocuments"
Me.ViewDocuments.OptionsTiles.ItemSize = New System.Drawing.Size(248, 202) Me.ViewDocuments.OptionsTiles.ItemSize = New System.Drawing.Size(248, 202)
Me.ViewDocuments.TileColumns.Add(TableColumnDefinition2) Me.ViewDocuments.TileColumns.Add(TableColumnDefinition1)
TableRowDefinition3.Length.Value = 152.0R TableRowDefinition1.Length.Value = 152.0R
TableRowDefinition4.Length.Value = 34.0R TableRowDefinition2.Length.Value = 34.0R
Me.ViewDocuments.TileRows.Add(TableRowDefinition3) Me.ViewDocuments.TileRows.Add(TableRowDefinition1)
Me.ViewDocuments.TileRows.Add(TableRowDefinition4) Me.ViewDocuments.TileRows.Add(TableRowDefinition2)
TileViewItemElement2.Column = Me.colFilename TileViewItemElement1.Column = Me.colFilename
TileViewItemElement2.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement1.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter
TileViewItemElement2.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.Squeeze TileViewItemElement1.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.Squeeze
TileViewItemElement2.RowIndex = 1 TileViewItemElement1.RowIndex = 1
TileViewItemElement2.Text = "colFilename" TileViewItemElement1.Text = "colFilename"
TileViewItemElement2.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter TileViewItemElement1.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter
Me.ViewDocuments.TileTemplate.Add(TileViewItemElement2) Me.ViewDocuments.TileTemplate.Add(TileViewItemElement1)
' '
'SplitContainerControl2 'SplitContainerControl2
' '
@@ -405,17 +418,9 @@ Partial Public Class frmEnvelopeEditor
Me.OpenFileDialog1.FileName = "OpenFileDialog1" Me.OpenFileDialog1.FileName = "OpenFileDialog1"
Me.OpenFileDialog1.Filter = "PDF Files|*.pdf" Me.OpenFileDialog1.Filter = "PDF Files|*.pdf"
' '
'RibbonPageGroup5 'SplashScreenManager1
' '
Me.RibbonPageGroup5.ItemLinks.Add(Me.btnDeleteReceiver) SplashScreenManager1.ClosingDelay = 500
Me.RibbonPageGroup5.Name = "RibbonPageGroup5"
Me.RibbonPageGroup5.Text = "RibbonPageGroup5"
'
'btnDeleteReceiver
'
Me.btnDeleteReceiver.Caption = "Empfänger löschen"
Me.btnDeleteReceiver.Id = 8
Me.btnDeleteReceiver.Name = "btnDeleteReceiver"
' '
'frmEnvelopeEditor 'frmEnvelopeEditor
' '

View File

@@ -1,4 +1,6 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports System.Threading.Tasks
Imports DevExpress.XtraSplashScreen
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports EnvelopeGenerator.Common Imports EnvelopeGenerator.Common
@@ -69,23 +71,30 @@ Partial Public Class frmEnvelopeEditor
End Sub End Sub
Private Sub btnEditFields_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditFields.ItemClick Private Sub btnEditFields_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditFields.ItemClick
If ViewDocuments.GetSelectedRows().Count > 0 Then Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
Try
If ViewDocuments.GetSelectedRows().Count > 0 Then
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
If SaveEnvelope() Then If SaveEnvelope() Then
Dim oForm As New frmFieldEditor() With { Dim oForm As New frmFieldEditor() With {
.Document = Controller.Envelope.Documents. .Document = Controller.Envelope.Documents.
Where(Function(d) d.Filename = oDocument.Filename). Where(Function(d) d.Filename = oDocument.Filename).
SingleOrDefault(), SingleOrDefault(),
.GDPictureKey = oGDPictureKey, .GDPictureKey = oGDPictureKey,
.Receivers = Receivers.ToList, .Receivers = Receivers.ToList,
.State = State .State = State
} }
oForm.ShowDialog() oForm.Show()
End If
End If End If
End If Catch ex As Exception
Logger.Error(ex)
Finally
SplashScreenManager.CloseOverlayForm(oHandle)
End Try
End Sub End Sub
Private Function SaveEnvelope() As Boolean Private Function SaveEnvelope() As Boolean
@@ -95,16 +104,10 @@ Partial Public Class frmEnvelopeEditor
' Ensure all receivers are saved ' Ensure all receivers are saved
ViewReceivers.CloseEditor() 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 Dim oEnvelope = Controller.Envelope
oEnvelope.Subject = oSubject oEnvelope.Subject = oSubject
oEnvelope.Message = oMessage oEnvelope.Message = oMessage
oEnvelope.Receivers = oReceivers oEnvelope.Receivers = Receivers.ToList
oEnvelope.Documents = Documents.ToList oEnvelope.Documents = Documents.ToList
Dim oErrors = oEnvelope.Validate() 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) Dim oError = "Fehler beim Speichern des Umschlags:" & vbNewLine & vbNewLine & String.Join(vbNewLine, oErrors)
MsgBox(oError, MsgBoxStyle.Exclamation, Text) MsgBox(oError, MsgBoxStyle.Exclamation, Text)
Return False 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) MsgBox("Fehler beim Speichern des Umschlags!", MsgBoxStyle.Critical, Text)
Return False Return False
Else Else
@@ -120,22 +130,31 @@ Partial Public Class frmEnvelopeEditor
End If End If
End Function 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 Private Sub btnDeleteReceiver_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDeleteReceiver.ItemClick
If ViewReceivers.SelectedRowsCount = 0 Then If ViewReceivers.SelectedRowsCount = 0 Then
Exit Sub Exit Sub
End If 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?" 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 If MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.No Then
Exit Sub Exit Sub
End If 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 Sub
End Class End Class

View File

@@ -1,8 +1,12 @@
Imports DevExpress.XtraBars Imports System.Windows.Forms.VisualStyles.VisualStyleElement.Window
Imports DevExpress.Utils
Imports DevExpress.XtraBars
Imports DevExpress.XtraBars.Ribbon.ViewInfo
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports EnvelopeGenerator.Common Imports EnvelopeGenerator.Common
Imports GdPicture14 Imports GdPicture14
Imports GdPicture14.Annotations Imports GdPicture14.Annotations
Imports NLog.Fluent
Partial Public Class frmFieldEditor Partial Public Class frmFieldEditor
Private LogConfig As LogConfig Private LogConfig As LogConfig
@@ -63,23 +67,38 @@ Partial Public Class frmFieldEditor
Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem
Dim oItem = New BarButtonItem(BarManager1, pReceiver.Name) Dim oItem = New BarButtonItem(BarManager1, pReceiver.Name)
AddHandler oItem.ItemClick, AddressOf BarItem_Click AddHandler oItem.ItemClick, AddressOf ReceiverItem_Click
oItem.Tag = pReceiver oItem.Tag = pReceiver
Return oItem Return oItem
End Function End Function
Private Sub BarItem_Click(sender As Object, e As ItemClickEventArgs) Private Sub ReceiverItem_Click(sender As Object, e As ItemClickEventArgs)
AddElements() Me.SuspendLayout()
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
Dim oCurrentPage = GDViewer.CurrentPage
Dim oCurrentPosition = GDViewer.GetVScrollBarPosition()
If oReceiver.Id = SelectedReceiver.Id Then
Exit Sub
End If
AddElementsToController()
If Controller.SaveElements(SelectedReceiver.Id) Then If Controller.SaveElements(SelectedReceiver.Id) Then
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
SetReceiver(oReceiver) SetReceiver(oReceiver)
ClearAnnotations() ClearAnnotations()
LoadAnnotations(oReceiver.Id) LoadAnnotations(oReceiver.Id)
GDViewer.DisplayFirstPage() DisplayPage(oCurrentPage)
GDViewer.SetVScrollBarPosition(oCurrentPosition)
GDViewer.Redraw()
TestViewerActionSuccessful("ReceiverItem_Click/Redraw")
Else Else
MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text) MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
End If End If
Me.ResumeLayout()
End Sub End Sub
Private Sub SetReceiver(pReceiver As EnvelopeReceiver) Private Sub SetReceiver(pReceiver As EnvelopeReceiver)
@@ -87,7 +106,14 @@ Partial Public Class frmFieldEditor
SelectedReceiver = pReceiver SelectedReceiver = pReceiver
End Sub End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick Private Sub DisplayPage(pPage As Integer)
GDViewer.LockViewer = True
GDViewer.DisplayPage(pPage)
GDViewer.LockViewer = False
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem1.ItemClick
If GDViewer IsNot Nothing Then If GDViewer IsNot Nothing Then
AddHandler GDViewer.BeforeAnnotationAddedByUser, AddressOf Viewer_BeforeAnnotationAddedByUser AddHandler GDViewer.BeforeAnnotationAddedByUser, AddressOf Viewer_BeforeAnnotationAddedByUser
@@ -102,7 +128,7 @@ Partial Public Class frmFieldEditor
Private Sub Viewer_AnnotationAddedByUser(pAnnotationIdx As Integer) Private Sub Viewer_AnnotationAddedByUser(pAnnotationIdx As Integer)
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx) Dim oAnnotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx)
Dim oPage = GDViewer.CurrentPage Dim oPage = GDViewer.CurrentPage
Dim oTag = GetAnnotationTag(SelectedReceiver.Id, oPage, pAnnotationIdx) Dim oTag = GetAnnotationTag(SelectedReceiver.Id, oPage, -1)
If TypeOf oAnnotation Is AnnotationStickyNote Then If TypeOf oAnnotation Is AnnotationStickyNote Then
Dim oStickyNote As AnnotationStickyNote = oAnnotation Dim oStickyNote As AnnotationStickyNote = oAnnotation
@@ -123,34 +149,67 @@ Partial Public Class frmFieldEditor
'NOOP 'NOOP
End Sub End Sub
Private Sub btnSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick Private Sub btnSave_ItemClick(sender As Object, e As ItemClickEventArgs) Handles btnSave.ItemClick
'TODO: Save Annotations in Background Dim oCurrentPage = GDViewer.CurrentPage
AddElements()
AddElementsToController()
If Not Controller.SaveElements(SelectedReceiver.Id) Then If Not Controller.SaveElements(SelectedReceiver.Id) Then
MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text) MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
End If End If
GDViewer.DisplayPage(GDViewer.CurrentPage) UpdateAnnotationTag()
DisplayPage(oCurrentPage)
GDViewer.Redraw()
TestViewerActionSuccessful("btnSave_ItemClick/Redraw")
End Sub End Sub
Private Sub AddElements() Private Sub AddElementsToController()
Dim oPageCount = GDViewer.PageCount Dim oPageCount = GDViewer.PageCount
For oPage = 1 To oPageCount For oPage = 1 To oPageCount
GDViewer.DisplayPage(oPage) GDViewer.DisplayPage(oPage)
Dim oAnnotationCount = GDViewer.GetAnnotationCount() AddElementsToController(oPage)
Next
End Sub
Private Sub AddElementsToController(pPage As Integer)
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
For oAnnotationIndex = 0 To oAnnotationCount - 1
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(oAnnotationIndex)
If TypeOf oAnnotation Is AnnotationStickyNote Then
Dim oStickyNote As AnnotationStickyNote = oAnnotation
Controller.AddOrUpdateElement(oStickyNote)
End If
Next
End Sub
Private Sub UpdateAnnotationTag()
Dim oPageCount = GDViewer.PageCount
For oPage = 1 To oPageCount
GDViewer.DisplayPage(oPage)
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
For oAnnotationIndex = 0 To oAnnotationCount - 1 For oAnnotationIndex = 0 To oAnnotationCount - 1
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(oAnnotationIndex) Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(oAnnotationIndex)
If TypeOf oAnnotation Is AnnotationStickyNote Then If TypeOf oAnnotation Is AnnotationStickyNote Then
Dim oStickyNote As AnnotationStickyNote = oAnnotation Dim oStickyNote As AnnotationStickyNote = oAnnotation
Controller.AddOrUpdateElement(oStickyNote) Dim oTag = oStickyNote.Tag
Dim oInfo = Controller.GetElementInfo(oTag)
If oInfo.Guid = -1 Then
Dim oElement = Controller.GetElement(oStickyNote)
oStickyNote.Tag = GetAnnotationTag(SelectedReceiver.Id, oPage, oElement.Id)
End If
End If End If
Next Next
Next Next
End Sub End Sub
Private Sub ApplyAnnotationStyle(ByRef pAnnotation As Annotation) Private Sub ApplyAnnotationStyle(ByRef pAnnotation As Annotation)
If TypeOf pAnnotation Is AnnotationStickyNote Then If TypeOf pAnnotation Is AnnotationStickyNote Then
Dim oStickyNote As AnnotationStickyNote = pAnnotation Dim oStickyNote As AnnotationStickyNote = pAnnotation
@@ -163,21 +222,36 @@ Partial Public Class frmFieldEditor
End Sub End Sub
Private Sub BarButtonItem3_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDelete.ItemClick Private Sub btnDelete_ItemClick(sender As Object, e As ItemClickEventArgs) Handles btnDelete.ItemClick
Dim oSelected = GDViewer.GetSelectedAnnotationIdx() Dim oSelected = GDViewer.GetSelectedAnnotationIdx()
If TestViewerActionSuccessful("btnDelete_ItemClick/GetSelectedAnnotationIdx") = False Then
Logger.Warn("Selected Annotation could not be fetched!")
Exit Sub
End If
If oSelected = -1 Then If oSelected = -1 Then
Exit Sub Exit Sub
End If End If
If MsgBox("Wollen Sie die Annotation löschen?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, Text) = DialogResult.Yes Then If MsgBox("Wollen Sie die Annotation löschen?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, Text) = DialogResult.Yes Then
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(oSelected)
Dim oElement = Controller.GetElement(oAnnotation)
' Delete Element if it was already saved to db
If oElement IsNot Nothing Then
Controller.DeleteElement(oElement)
End If
GDViewer.DeleteAnnotation(oSelected) GDViewer.DeleteAnnotation(oSelected)
If TestViewerActionSuccessful("btnDelete_ItemClick/DeleteAnnotation") = False Then
Logger.Warn("Annotation could not be deleted!")
End If
End If End If
End Sub End Sub
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement, pReceiverId As Integer) Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement, pReceiverId As Integer)
Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR") Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR")
Dim oIndex = Manager.GetAnnotationIdx(oAnnotation)
Dim oPage = pElement.Page Dim oPage = pElement.Page
If Manager.GetStat() = GdPictureStatus.OK Then If Manager.GetStat() = GdPictureStatus.OK Then
@@ -188,29 +262,54 @@ Partial Public Class frmFieldEditor
oAnnotation.Fill = True oAnnotation.Fill = True
oAnnotation.FillColor = Color.DarkRed oAnnotation.FillColor = Color.DarkRed
oAnnotation.Text = "SIGNATUR" oAnnotation.Text = "SIGNATUR"
oAnnotation.Tag = GetAnnotationTag(pReceiverId, oPage, oIndex) oAnnotation.Tag = GetAnnotationTag(pReceiverId, oPage, pElement.Id)
Else
'If Manager.SaveAnnotationsToPage() = GdPictureStatus.OK Then Dim oStatus = Manager.GetStat()
'End If MsgBox(String.Format("GDViewer returned error [{0}] on action [{1}]", oStatus.ToString, "LoadAnnotation"))
Logger.Error("GDViewer returned error [{0}] on action [{1}]", oStatus.ToString, "LoadAnnotation")
End If End If
End Sub End Sub
Private Sub ClearAnnotations() Private Sub ClearAnnotations()
Dim oPageCount = GDViewer.PageCount Dim oPageCount = GDViewer.PageCount
For oPage = 1 To oPageCount For oPage = 1 To oPageCount
GDViewer.DisplayPage(oPage) DisplayPage(oPage)
Dim oAnnotationCount = GDViewer.GetAnnotationCount() Dim oAnnotationCount = GDViewer.GetAnnotationCount()
For oAnnotationIndex = 0 To oAnnotationCount - 1 For oAnnotationIndex = 0 To oAnnotationCount - 1
GDViewer.DeleteAnnotation(oAnnotationIndex) ' We always delete the first item in the list of annotations,
' because DeleteAnnotation expects and index, not an identifier
GDViewer.DeleteAnnotation(0)
If TestViewerActionSuccessful("ClearAnnotations") = False Then
Logger.Warn("Annotation could not be cleared!")
End If
Next Next
Next Next
End Sub End Sub
Private Function TestViewerActionSuccessful(pAction As String) As Boolean
Dim oStatus = GDViewer.GetStat()
If oStatus = GdPictureStatus.OK Then
Return True
Else
MsgBox(String.Format("GDViewer returned error [{0}] on action [{1}]", oStatus.ToString, pAction))
Logger.Error("GDViewer returned error [{0}] on action [{1}]", oStatus.ToString, pAction)
Return False
End If
End Function
Private Sub LoadAnnotations(pReceiverId As Integer) Private Sub LoadAnnotations(pReceiverId As Integer)
Dim oPageCount = GDViewer.PageCount Dim oPageCount = GDViewer.PageCount
For oPage = 1 To oPageCount For oPage = 1 To oPageCount
GDViewer.DisplayPage(oPage) DisplayPage(oPage)
If TestViewerActionSuccessful("LoadAnnotations/DisplayPage") = False Then
Logger.Warn("Page could not be displayed!")
End If
Dim oCurrentPage = oPage Dim oCurrentPage = oPage
Dim oElements = Controller.Elements. Dim oElements = Controller.Elements.
Where(Function(e) e.Page = oCurrentPage And e.ReceiverId = pReceiverId). Where(Function(e) e.Page = oCurrentPage And e.ReceiverId = pReceiverId).
@@ -222,8 +321,8 @@ Partial Public Class frmFieldEditor
Next Next
End Sub End Sub
Private Function GetAnnotationTag(pReceiver As Integer, pPage As Integer, pIndex As Integer) As String Private Function GetAnnotationTag(pReceiver As Integer, pPage As Integer, pGuid As Integer) As String
Return $"{pReceiver}|{pPage}|{pIndex}" Return $"{pReceiver}|{pPage}|{pGuid}"
End Function End Function
End Class End Class

View File

@@ -1,9 +1,9 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmMain Partial Class frmMain
Inherits DevExpress.XtraBars.Ribbon.RibbonForm Inherits DevExpress.XtraBars.Ribbon.RibbonForm
'Form overrides dispose to clean up the component list. 'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _ <System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean) Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then If disposing AndAlso components IsNot Nothing Then
components.Dispose() components.Dispose()
@@ -17,12 +17,14 @@ Partial Class frmMain
'NOTE: The following procedure is required by the Windows Form Designer 'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer. 'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor. 'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _ <System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent() Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain)) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))
Dim SplashScreenManager1 As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, Nothing, True, True)
Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl()
Me.btnCreateEnvelope = New DevExpress.XtraBars.BarButtonItem() Me.btnCreateEnvelope = New DevExpress.XtraBars.BarButtonItem()
Me.btnEditEnvelope = New DevExpress.XtraBars.BarButtonItem() Me.btnEditEnvelope = New DevExpress.XtraBars.BarButtonItem()
Me.btnDeleteEnvelope = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
@@ -36,9 +38,9 @@ Partial Class frmMain
'RibbonControl 'RibbonControl
' '
Me.RibbonControl.ExpandCollapseItem.Id = 0 Me.RibbonControl.ExpandCollapseItem.Id = 0
Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.btnCreateEnvelope, Me.btnEditEnvelope}) Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.btnCreateEnvelope, Me.btnEditEnvelope, Me.btnDeleteEnvelope})
Me.RibbonControl.Location = New System.Drawing.Point(0, 0) Me.RibbonControl.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl.MaxItemId = 3 Me.RibbonControl.MaxItemId = 5
Me.RibbonControl.Name = "RibbonControl" Me.RibbonControl.Name = "RibbonControl"
Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl.Size = New System.Drawing.Size(1088, 158) Me.RibbonControl.Size = New System.Drawing.Size(1088, 158)
@@ -58,6 +60,13 @@ Partial Class frmMain
Me.btnEditEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("btnEditEnvelope.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.btnEditEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("btnEditEnvelope.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.btnEditEnvelope.Name = "btnEditEnvelope" Me.btnEditEnvelope.Name = "btnEditEnvelope"
' '
'btnDeleteEnvelope
'
Me.btnDeleteEnvelope.Caption = "Umschlag löschen"
Me.btnDeleteEnvelope.Id = 4
Me.btnDeleteEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("btnDeleteEnvelope.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.btnDeleteEnvelope.Name = "btnDeleteEnvelope"
'
'RibbonPage1 'RibbonPage1
' '
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1}) Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1})
@@ -68,6 +77,7 @@ Partial Class frmMain
' '
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnCreateEnvelope) Me.RibbonPageGroup1.ItemLinks.Add(Me.btnCreateEnvelope)
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnEditEnvelope) Me.RibbonPageGroup1.ItemLinks.Add(Me.btnEditEnvelope)
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnDeleteEnvelope)
Me.RibbonPageGroup1.Name = "RibbonPageGroup1" Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
Me.RibbonPageGroup1.Text = "RibbonPageGroup1" Me.RibbonPageGroup1.Text = "RibbonPageGroup1"
' '
@@ -94,6 +104,10 @@ Partial Class frmMain
Me.ViewEnvelopes.GridControl = Me.GridEnvelopes Me.ViewEnvelopes.GridControl = Me.GridEnvelopes
Me.ViewEnvelopes.Name = "ViewEnvelopes" Me.ViewEnvelopes.Name = "ViewEnvelopes"
' '
'SplashScreenManager1
'
SplashScreenManager1.ClosingDelay = 500
'
'frmMain 'frmMain
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -122,4 +136,5 @@ Partial Class frmMain
Friend WithEvents GridEnvelopes As DevExpress.XtraGrid.GridControl Friend WithEvents GridEnvelopes As DevExpress.XtraGrid.GridControl
Friend WithEvents ViewEnvelopes As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents ViewEnvelopes As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents btnEditEnvelope As DevExpress.XtraBars.BarButtonItem Friend WithEvents btnEditEnvelope As DevExpress.XtraBars.BarButtonItem
Friend WithEvents btnDeleteEnvelope As DevExpress.XtraBars.BarButtonItem
End Class End Class

View File

@@ -153,6 +153,25 @@
LDRMNCwxMnYxNWMwLDAuNSwwLjUsMSwxLDFoMjJjMC41LDAsMS0wLjUsMS0xVjEyTDE2LDR6IE0yNiwx LDRMNCwxMnYxNWMwLDAuNSwwLjUsMSwxLDFoMjJjMC41LDAsMS0wLjUsMS0xVjEyTDE2LDR6IE0yNiwx
My4xbC0xMCw2LjdMNiwxMy4xdjBsMTAtNi43TDI2LDEzLjEgICBMMjYsMTMuMXoiIGNsYXNzPSJZZWxs My4xbC0xMCw2LjdMNiwxMy4xdjBsMTAtNi43TDI2LDEzLjEgICBMMjYsMTMuMXoiIGNsYXNzPSJZZWxs
b3ciIC8+DQogIDwvZz4NCjwvc3ZnPgs= b3ciIC8+DQogIDwvZz4NCjwvc3ZnPgs=
</value>
</data>
<data name="btnDeleteEnvelope.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAKoCAAAC77u/
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z
ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5CbGFja3tmaWxsOiM3MjcyNzI7fQoJLkdyZWVue2ZpbGw6IzAz
OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9Cgkuc3Qwe29wYWNpdHk6MC43NTt9Cgkuc3Qxe29wYWNp
dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IlRyYXNoIj4NCiAgICA8cGF0aCBkPSJNOCwyN2MwLDAu
NSwwLjUsMSwxLDFoMTRjMC41LDAsMS0wLjUsMS0xVjEySDhWMjd6IiBjbGFzcz0iQmxhY2siIC8+DQog
ICAgPHBhdGggZD0iTTI1LDZoLTdWNWMwLTAuNS0wLjUtMS0xLTFoLTJjLTAuNSwwLTEsMC41LTEsMXYx
SDdDNi41LDYsNiw2LjUsNiw3djNoMjBWN0MyNiw2LjUsMjUuNSw2LDI1LDZ6IiBjbGFzcz0iQmxhY2si
IC8+DQogIDwvZz4NCjwvc3ZnPgs=
</value> </value>
</data> </data>
</root> </root>

View File

@@ -5,6 +5,7 @@ Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Base Imports DigitalData.Modules.Base
Imports DigitalData.GUIs.Common Imports DigitalData.GUIs.Common
Imports EnvelopeGenerator.Common Imports EnvelopeGenerator.Common
Imports DevExpress.XtraSplashScreen
Public Class frmMain Public Class frmMain
Private LogConfig As LogConfig Private LogConfig As LogConfig
@@ -74,8 +75,16 @@ Public Class frmMain
End Function End Function
Private Sub btnCreateEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick Private Sub btnCreateEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick
Dim oForm As New frmEnvelopeEditor() With {.State = State} Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
oForm.ShowDialog() Try
Dim oForm As New frmEnvelopeEditor() With {.State = State}
oForm.ShowDialog()
GridEnvelopes.DataSource = Controller.ListEnvelopes()
Catch ex As Exception
Logger.Error(ex)
Finally
SplashScreenManager.CloseOverlayForm(oHandle)
End Try
End Sub End Sub
Private Sub btnEditEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditEnvelope.ItemClick Private Sub btnEditEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditEnvelope.ItemClick
@@ -92,6 +101,20 @@ Public Class frmMain
GridEnvelopes.DataSource = Controller.ListEnvelopes() GridEnvelopes.DataSource = Controller.ListEnvelopes()
End Sub End Sub
Private Sub DeleteEnvelope(pRowHandle As Integer)
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(pRowHandle)
If MsgBox("Wollen Sie diesen Umschlag wirklich löschen?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.No Then
Exit Sub
End If
If Controller.DeleteEnvelope(oEnvelope) Then
GridEnvelopes.DataSource = Controller.ListEnvelopes()
Else
MsgBox("Umschlag konnte nicht gelöscht werden!", MsgBoxStyle.Critical, Text)
End If
End Sub
Private Sub ViewEnvelopes_DoubleClick(sender As Object, e As EventArgs) Handles ViewEnvelopes.DoubleClick Private Sub ViewEnvelopes_DoubleClick(sender As Object, e As EventArgs) Handles ViewEnvelopes.DoubleClick
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows() Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
If oSelectedRows.Count > 0 Then If oSelectedRows.Count > 0 Then
@@ -99,4 +122,10 @@ Public Class frmMain
End If End If
End Sub End Sub
Private Sub btnDeleteEnvelope_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDeleteEnvelope.ItemClick
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
If oSelectedRows.Count > 0 Then
DeleteEnvelope(oSelectedRows.First)
End If
End Sub
End Class End Class