02.08.2023
This commit is contained in:
parent
13cf091d8e
commit
c8b2f21fea
@ -16,6 +16,7 @@ Public Class EnvelopeEditorController
|
||||
Private EnvelopeModel As EnvelopeModel
|
||||
Private DocumentModel As DocumentModel
|
||||
Private ReceiverModel As ReceiverModel
|
||||
Private ElementModel As ElementModel
|
||||
|
||||
Public ReadOnly Envelope As Envelope = Nothing
|
||||
|
||||
@ -47,6 +48,7 @@ Public Class EnvelopeEditorController
|
||||
EnvelopeModel = New EnvelopeModel(pState)
|
||||
DocumentModel = New DocumentModel(pState)
|
||||
ReceiverModel = New ReceiverModel(pState)
|
||||
ElementModel = New ElementModel(pState)
|
||||
End Sub
|
||||
|
||||
#Region "Public"
|
||||
@ -218,7 +220,7 @@ Public Class EnvelopeEditorController
|
||||
Throw New ArgumentNullException("EnvelopeId")
|
||||
End If
|
||||
|
||||
If UpdateReceivers(pEnvelope.Receivers, pTransaction) = False Then
|
||||
If InsertReceivers(pEnvelope.Receivers, pTransaction) = False Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
@ -233,10 +235,22 @@ Public Class EnvelopeEditorController
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function UpdateReceivers(pReceivers As List(Of EnvelopeReceiver), pTransaction As SqlTransaction) As Boolean
|
||||
Private Function DeleteReceiver(pReceiver As EnvelopeReceiver) As Boolean
|
||||
Try
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ElementsExist(pDocumentId As Integer, pReceiverId As Integer) As Boolean
|
||||
Return ElementModel.ElementsExist(pDocumentId, pReceiverId)
|
||||
End Function
|
||||
|
||||
Private Function InsertReceivers(pReceivers As List(Of EnvelopeReceiver), pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
Return pReceivers.
|
||||
Select(Function(r) UpdateReceiver(r, pTransaction)).
|
||||
Select(Function(r) InsertReceiver(r, pTransaction)).
|
||||
All(Function(pResult) pResult = True)
|
||||
|
||||
Catch ex As Exception
|
||||
@ -256,15 +270,15 @@ Public Class EnvelopeEditorController
|
||||
|
||||
End Function
|
||||
|
||||
Private Function UpdateReceiver(pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
Private Function InsertReceiver(pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
If ReceiverModel.TestReceiverExists(pReceiver) Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
If pReceiver.HasId Then
|
||||
Return ReceiverModel.Update(pReceiver, pTransaction)
|
||||
Else
|
||||
If pReceiver.HasId = False Then
|
||||
Return ReceiverModel.Insert(pReceiver, pTransaction)
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
@ -22,11 +22,12 @@ Public Class FieldEditorController
|
||||
ElementModel = New ElementModel(pState)
|
||||
End Sub
|
||||
|
||||
Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote, pReceiverId As Integer)
|
||||
Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote)
|
||||
Dim oTag As String() = pAnnotation.Tag.Split("|"c)
|
||||
Dim oPage = Integer.Parse(oTag(0))
|
||||
Dim oIndex = Integer.Parse(oTag(1))
|
||||
Dim oELement = Elements.Where(Function(e) e.AnnotationIndex = oIndex And e.Page = oPage).SingleOrDefault()
|
||||
Dim oReceiverId = Integer.Parse(oTag(0))
|
||||
Dim oPage = Integer.Parse(oTag(1))
|
||||
Dim oIndex = 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
|
||||
oELement.Height = pAnnotation.Height
|
||||
@ -41,7 +42,7 @@ Public Class FieldEditorController
|
||||
.X = pAnnotation.Left,
|
||||
.Y = pAnnotation.Top,
|
||||
.DocumentId = Document.Id,
|
||||
.ReceiverId = pReceiverId,
|
||||
.ReceiverId = oReceiverId,
|
||||
.AnnotationIndex = oIndex,
|
||||
.Page = oPage
|
||||
})
|
||||
|
||||
@ -28,6 +28,21 @@
|
||||
oErrors.Add(My.Resources.Envelope.Missing_Receivers)
|
||||
End If
|
||||
|
||||
For Each Receiver In Receivers
|
||||
If IsValidEmailAddress(Receiver.Email) = False Then
|
||||
oErrors.Add(String.Format(My.Resources.Envelope.Invalid_Email_Address, Receiver.Name))
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oErrors
|
||||
End Function
|
||||
|
||||
Private Function IsValidEmailAddress(pEmailAddress As String) As Boolean
|
||||
Try
|
||||
Dim oAddress = New System.Net.Mail.MailAddress(pEmailAddress)
|
||||
Return oAddress.Address = pEmailAddress
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
Public Class EnvelopeReceiver
|
||||
Public Property Id As Integer
|
||||
Public Property UserId As Integer
|
||||
|
||||
Public Property Name As String
|
||||
Public Property Company As String = ""
|
||||
Public Property JobTitle As String = ""
|
||||
|
||||
@ -17,13 +17,29 @@ Public Class ElementModel
|
||||
.Y = pRow.ItemEx("POSITION_Y", 0.0),
|
||||
.Width = pRow.ItemEx("WIDTH", 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
|
||||
|
||||
Public Function ElementsExist(pEnvelopeId As Integer, pReceiverId As Integer) As Boolean
|
||||
Try
|
||||
Dim oSql = $"SELECT COUNT(*) FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] T
|
||||
JOIN TBSIG_ENVELOPE_DOCUMENT T2 ON T.DOCUMENT_ID = T2.GUID
|
||||
WHERE T.RECEIVER_ID = {pReceiverId} AND T2.ENVELOPE_ID = {pEnvelopeId}"
|
||||
Dim oElementCount As Integer = Database.GetScalarValue(oSql)
|
||||
|
||||
Return oElementCount > 0
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function List(pDocumentId As Integer) As List(Of EnvelopeDocumentElement)
|
||||
Try
|
||||
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId}"
|
||||
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId} ORDER BY PAGE ASC, ANNOTATION_INDEX ASC"
|
||||
Dim oTable = Database.GetDatatable(oSql)
|
||||
|
||||
Return oTable?.Rows.Cast(Of DataRow).
|
||||
|
||||
@ -31,24 +31,15 @@ Public Class ReceiverModel
|
||||
Public Function Insert(pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
Dim oSql As String = "INSERT INTO [dbo].[TBSIG_RECEIVER]
|
||||
([NAME]
|
||||
,[EMAIL_ADDRESS]
|
||||
,[SIGNATURE]
|
||||
,[COMPANY_NAME]
|
||||
,[JOB_TITLE])
|
||||
([EMAIL_ADDRESS]
|
||||
,[SIGNATURE])
|
||||
VALUES
|
||||
(@NAME
|
||||
,@EMAIL
|
||||
,@SIGNATURE
|
||||
,@COMPANY
|
||||
,@JOB)"
|
||||
(@EMAIL
|
||||
,@SIGNATURE)"
|
||||
|
||||
Dim oCommand = New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("NAME", SqlDbType.NVarChar).Value = pReceiver.Name
|
||||
oCommand.Parameters.Add("EMAIL", SqlDbType.NVarChar).Value = pReceiver.Email
|
||||
oCommand.Parameters.Add("SIGNATURE", SqlDbType.NVarChar).Value = pReceiver.Signature
|
||||
oCommand.Parameters.Add("COMPANY", SqlDbType.NVarChar).Value = pReceiver.Company
|
||||
oCommand.Parameters.Add("JOB", SqlDbType.NVarChar).Value = pReceiver.JobTitle
|
||||
|
||||
Dim oResult = Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
If oResult = True Then
|
||||
@ -67,17 +58,18 @@ Public Class ReceiverModel
|
||||
Public Function Update(pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
' TODO: Update ENVELOPE_RECEIVER instead
|
||||
Dim oSql As String = "UPDATE [dbo].[TBSIG_RECEIVER]
|
||||
Dim oSql As String = "UPDATE [dbo].[TBSIG_USER_RECEIVER]
|
||||
SET [NAME] = @NAME
|
||||
,[COMPANY_NAME] = @COMPANY
|
||||
,[JOB_TITLE] = @JOB
|
||||
WHERE GUID = @GUID"
|
||||
WHERE RECEIVER_ID = @RECEIVER_ID"
|
||||
|
||||
Dim oCommand = New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("NAME", SqlDbType.NVarChar).Value = pReceiver.Name
|
||||
oCommand.Parameters.Add("COMPANY", SqlDbType.NVarChar).Value = pReceiver.Company
|
||||
oCommand.Parameters.Add("JOB", SqlDbType.NVarChar).Value = pReceiver.JobTitle
|
||||
oCommand.Parameters.Add("GUID", SqlDbType.Int).Value = pReceiver.Id
|
||||
oCommand.Parameters.Add("RECEIVER_ID", SqlDbType.Int).Value = pReceiver.Id
|
||||
oCommand.Parameters.Add("USER_ID", SqlDbType.Int).Value = pReceiver.Id
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
Catch ex As Exception
|
||||
@ -101,12 +93,18 @@ Public Class ReceiverModel
|
||||
,[RECEIVER_ID]
|
||||
,[PRIVATE_MESSAGE]
|
||||
,[ACCESS_CODE]
|
||||
,[NAME]
|
||||
,[JOB_TITLE]
|
||||
,[COMPANY_NAME]
|
||||
,[SEQUENCE])
|
||||
VALUES
|
||||
(@ENVELOPE_ID
|
||||
,@RECEIVER_ID
|
||||
,@MESSAGE
|
||||
,@ACCESS_CODE
|
||||
,@NAME
|
||||
,@JOB
|
||||
,@COMPANY
|
||||
,@SEQUENCE)"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
@ -114,6 +112,9 @@ Public Class ReceiverModel
|
||||
oCommand.Parameters.Add("RECEIVER_ID", SqlDbType.NVarChar).Value = pReceiver.Id
|
||||
oCommand.Parameters.Add("MESSAGE", SqlDbType.NVarChar).Value = pReceiver.PrivateMessage
|
||||
oCommand.Parameters.Add("ACCESS_CODE", SqlDbType.NVarChar).Value = pReceiver.AccessCode
|
||||
oCommand.Parameters.Add("NAME", SqlDbType.NVarChar).Value = pReceiver.Name
|
||||
oCommand.Parameters.Add("JOB", SqlDbType.NVarChar).Value = pReceiver.JobTitle
|
||||
oCommand.Parameters.Add("COMPANY", SqlDbType.NVarChar).Value = pReceiver.Company
|
||||
oCommand.Parameters.Add("SEQUENCE", SqlDbType.NVarChar).Value = pReceiver.Sequence
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
@ -134,6 +135,18 @@ Public Class ReceiverModel
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Delete(pReceiverId As Integer, pDocumentId As Integer) As Boolean
|
||||
Try
|
||||
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER WHERE RECEIVER_ID = {pReceiverId} AND DOCUMENT_ID = {pDocumentId}"
|
||||
Return Database.ExecuteNonQuery(oSql)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetReceiverId(pEmailAddress As String, pTransaction As SqlTransaction) As Integer
|
||||
Try
|
||||
Return Database.GetScalarValue($"SELECT GUID FROM TBSIG_RECEIVER WHERE EMAIL_ADDRESS = '{pEmailAddress}'", pTransaction)
|
||||
|
||||
@ -64,6 +64,15 @@ Namespace My.Resources
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Zeichenfolge, die Empfänger {0} hat keine gültige Email Addresse. ähnelt.
|
||||
'''</summary>
|
||||
Friend Shared ReadOnly Property Invalid_Email_Address() As String
|
||||
Get
|
||||
Return ResourceManager.GetString("Invalid Email Address", resourceCulture)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Zeichenfolge, die Missing Documents ähnelt.
|
||||
'''</summary>
|
||||
|
||||
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Invalid Email Address" xml:space="preserve">
|
||||
<value>Empfänger {0} hat keine gültige Email Addresse.</value>
|
||||
</data>
|
||||
<data name="Missing Documents" xml:space="preserve">
|
||||
<value>Missing Documents</value>
|
||||
</data>
|
||||
|
||||
58
EnvelopeGenerator.Form/frmEnvelopeEditor.Designer.vb
generated
58
EnvelopeGenerator.Form/frmEnvelopeEditor.Designer.vb
generated
@ -29,10 +29,10 @@ Partial Public Class frmEnvelopeEditor
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmEnvelopeEditor))
|
||||
Dim TableColumnDefinition1 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition()
|
||||
Dim TableRowDefinition1 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
|
||||
Dim TableRowDefinition2 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
|
||||
Dim TileViewItemElement1 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement()
|
||||
Dim TableColumnDefinition2 As DevExpress.XtraEditors.TableLayout.TableColumnDefinition = New DevExpress.XtraEditors.TableLayout.TableColumnDefinition()
|
||||
Dim TableRowDefinition3 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
|
||||
Dim TableRowDefinition4 As DevExpress.XtraEditors.TableLayout.TableRowDefinition = New DevExpress.XtraEditors.TableLayout.TableRowDefinition()
|
||||
Dim TileViewItemElement2 As DevExpress.XtraGrid.Views.Tile.TileViewItemElement = New DevExpress.XtraGrid.Views.Tile.TileViewItemElement()
|
||||
Me.colFilename = New DevExpress.XtraGrid.Columns.TileViewColumn()
|
||||
Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl()
|
||||
Me.btnSave = New DevExpress.XtraBars.BarButtonItem()
|
||||
@ -67,6 +67,8 @@ Partial Public Class frmEnvelopeEditor
|
||||
Me.FrmEditorBindingSource = New System.Windows.Forms.BindingSource(Me.components)
|
||||
Me.EnvelopeDocumentBindingSource = New System.Windows.Forms.BindingSource(Me.components)
|
||||
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.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.SplitContainerControl1.Panel1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
@ -112,9 +114,9 @@ Partial Public Class frmEnvelopeEditor
|
||||
'RibbonControl1
|
||||
'
|
||||
Me.RibbonControl1.ExpandCollapseItem.Id = 0
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSave, Me.btnCancel, Me.btnNewFile, Me.btnDeleteFile, Me.BarButtonItem1, Me.btnEditFields})
|
||||
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.btnSave, Me.btnCancel, Me.btnNewFile, Me.btnDeleteFile, Me.BarButtonItem1, Me.btnEditFields, Me.btnDeleteReceiver})
|
||||
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.RibbonControl1.MaxItemId = 8
|
||||
Me.RibbonControl1.MaxItemId = 9
|
||||
Me.RibbonControl1.Name = "RibbonControl1"
|
||||
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
|
||||
Me.RibbonControl1.Size = New System.Drawing.Size(1164, 158)
|
||||
@ -163,7 +165,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
'
|
||||
'RibbonPage1
|
||||
'
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3, Me.RibbonPageGroup4})
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3, Me.RibbonPageGroup4, Me.RibbonPageGroup5})
|
||||
Me.RibbonPage1.Name = "RibbonPage1"
|
||||
Me.RibbonPage1.Text = "RibbonPage1"
|
||||
'
|
||||
@ -231,18 +233,18 @@ Partial Public Class frmEnvelopeEditor
|
||||
Me.ViewDocuments.GridControl = Me.GridDocuments
|
||||
Me.ViewDocuments.Name = "ViewDocuments"
|
||||
Me.ViewDocuments.OptionsTiles.ItemSize = New System.Drawing.Size(248, 202)
|
||||
Me.ViewDocuments.TileColumns.Add(TableColumnDefinition1)
|
||||
TableRowDefinition1.Length.Value = 152.0R
|
||||
TableRowDefinition2.Length.Value = 34.0R
|
||||
Me.ViewDocuments.TileRows.Add(TableRowDefinition1)
|
||||
Me.ViewDocuments.TileRows.Add(TableRowDefinition2)
|
||||
TileViewItemElement1.Column = Me.colFilename
|
||||
TileViewItemElement1.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter
|
||||
TileViewItemElement1.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.Squeeze
|
||||
TileViewItemElement1.RowIndex = 1
|
||||
TileViewItemElement1.Text = "colFilename"
|
||||
TileViewItemElement1.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter
|
||||
Me.ViewDocuments.TileTemplate.Add(TileViewItemElement1)
|
||||
Me.ViewDocuments.TileColumns.Add(TableColumnDefinition2)
|
||||
TableRowDefinition3.Length.Value = 152.0R
|
||||
TableRowDefinition4.Length.Value = 34.0R
|
||||
Me.ViewDocuments.TileRows.Add(TableRowDefinition3)
|
||||
Me.ViewDocuments.TileRows.Add(TableRowDefinition4)
|
||||
TileViewItemElement2.Column = Me.colFilename
|
||||
TileViewItemElement2.ImageOptions.ImageAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter
|
||||
TileViewItemElement2.ImageOptions.ImageScaleMode = DevExpress.XtraEditors.TileItemImageScaleMode.Squeeze
|
||||
TileViewItemElement2.RowIndex = 1
|
||||
TileViewItemElement2.Text = "colFilename"
|
||||
TileViewItemElement2.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.MiddleCenter
|
||||
Me.ViewDocuments.TileTemplate.Add(TileViewItemElement2)
|
||||
'
|
||||
'SplitContainerControl2
|
||||
'
|
||||
@ -365,9 +367,9 @@ Partial Public Class frmEnvelopeEditor
|
||||
Me.ViewReceivers.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colName, Me.colEmail})
|
||||
Me.ViewReceivers.GridControl = Me.GridReceivers
|
||||
Me.ViewReceivers.Name = "ViewReceivers"
|
||||
Me.ViewReceivers.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.[True]
|
||||
Me.ViewReceivers.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom
|
||||
Me.ViewReceivers.OptionsView.ShowGroupPanel = False
|
||||
Me.ViewReceivers.OptionsView.ShowIndicator = False
|
||||
'
|
||||
'colName
|
||||
'
|
||||
@ -387,8 +389,6 @@ Partial Public Class frmEnvelopeEditor
|
||||
'RepositoryItemEmailEdit
|
||||
'
|
||||
Me.RepositoryItemEmailEdit.AutoHeight = False
|
||||
Me.RepositoryItemEmailEdit.MaskSettings.Set("MaskManagerType", GetType(DevExpress.Data.Mask.RegExpMaskManager))
|
||||
Me.RepositoryItemEmailEdit.MaskSettings.Set("mask", "\w+@\w+\.\w+")
|
||||
Me.RepositoryItemEmailEdit.Name = "RepositoryItemEmailEdit"
|
||||
'
|
||||
'FrmEditorBindingSource
|
||||
@ -405,6 +405,18 @@ Partial Public Class frmEnvelopeEditor
|
||||
Me.OpenFileDialog1.FileName = "OpenFileDialog1"
|
||||
Me.OpenFileDialog1.Filter = "PDF Files|*.pdf"
|
||||
'
|
||||
'RibbonPageGroup5
|
||||
'
|
||||
Me.RibbonPageGroup5.ItemLinks.Add(Me.btnDeleteReceiver)
|
||||
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
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
@ -486,6 +498,8 @@ Partial Public Class frmEnvelopeEditor
|
||||
Friend WithEvents RepositoryItemEmailEdit As Repository.RepositoryItemTextEdit
|
||||
Friend WithEvents EnvelopeDocumentBindingSource As BindingSource
|
||||
Friend WithEvents FrmEditorBindingSource As BindingSource
|
||||
Friend WithEvents btnDeleteReceiver As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents RibbonPageGroup5 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
@ -117,4 +117,19 @@ Partial Public Class frmEnvelopeEditor
|
||||
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 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 MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.No Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@ -58,11 +58,8 @@ Partial Public Class frmFieldEditor
|
||||
If Controller.LoadElements() = False Then
|
||||
MsgBox("Elemente konnten nicht geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
Else
|
||||
|
||||
For Each oElement In Controller.Elements
|
||||
LoadAnnotation(oElement)
|
||||
Next
|
||||
|
||||
LoadAnnotations(SelectedReceiver.Id)
|
||||
GDViewer.DisplayFirstPage()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -74,8 +71,15 @@ Partial Public Class frmFieldEditor
|
||||
End Function
|
||||
|
||||
Private Sub BarItem_Click(sender As Object, e As ItemClickEventArgs)
|
||||
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
|
||||
SetReceiver(oReceiver)
|
||||
If Controller.SaveElements() Then
|
||||
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
|
||||
SetReceiver(oReceiver)
|
||||
ClearAnnotations()
|
||||
LoadAnnotations(oReceiver.Id)
|
||||
GDViewer.DisplayFirstPage()
|
||||
Else
|
||||
MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SetReceiver(pReceiver As EnvelopeReceiver)
|
||||
@ -95,10 +99,10 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Viewer_AnnotationAddedByUser(AnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(AnnotationIdx)
|
||||
Private Sub Viewer_AnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx)
|
||||
Dim oPage = GDViewer.CurrentPage
|
||||
Dim oTag = $"{oPage}|{AnnotationIdx}"
|
||||
Dim oTag = GetAnnotationTag(SelectedReceiver.Id, oPage, pAnnotationIdx)
|
||||
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
@ -115,7 +119,7 @@ Partial Public Class frmFieldEditor
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Viewer_BeforeAnnotationAddedByUser(AnnotationIdx As Integer)
|
||||
Private Sub Viewer_BeforeAnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
'NOOP
|
||||
End Sub
|
||||
|
||||
@ -124,22 +128,21 @@ Partial Public Class frmFieldEditor
|
||||
Dim oCurrentPage = GDViewer.CurrentPage
|
||||
|
||||
'TODO: Save Annotations in Background
|
||||
|
||||
For index = 1 To oPageCount
|
||||
GDViewer.DisplayPage(index)
|
||||
For oPage = 1 To oPageCount
|
||||
GDViewer.DisplayPage(oPage)
|
||||
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
|
||||
|
||||
For index1 = 0 To oAnnotationCount - 1
|
||||
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(index1)
|
||||
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, SelectedReceiver.Id)
|
||||
Controller.AddOrUpdateElement(oStickyNote)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
If Not Controller.SaveElements() Then
|
||||
MsgBox("Element konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
|
||||
GDViewer.DisplayPage(oCurrentPage)
|
||||
@ -171,9 +174,10 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement)
|
||||
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement, pReceiverId As Integer)
|
||||
Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR")
|
||||
|
||||
Dim oIndex = Manager.GetAnnotationIdx(oAnnotation)
|
||||
Dim oPage = pElement.Page
|
||||
|
||||
If Manager.GetStat() = GdPictureStatus.OK Then
|
||||
oAnnotation.Width = CSng(pElement.Width)
|
||||
@ -183,14 +187,40 @@ Partial Public Class frmFieldEditor
|
||||
oAnnotation.Fill = True
|
||||
oAnnotation.FillColor = Color.DarkRed
|
||||
oAnnotation.Text = "SIGNATUR"
|
||||
|
||||
' TODO: Set tag with annotation index and page
|
||||
'oAnnotation.Tag =
|
||||
oAnnotation.Tag = GetAnnotationTag(pReceiverId, oPage, oIndex)
|
||||
|
||||
If Manager.SaveAnnotationsToPage() = GdPictureStatus.OK Then
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ClearAnnotations()
|
||||
Dim oPageCount = GDViewer.PageCount
|
||||
For oPage = 1 To oPageCount
|
||||
GDViewer.DisplayPage(oPage)
|
||||
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
|
||||
|
||||
For oAnnotationIndex = 0 To oAnnotationCount - 1
|
||||
GDViewer.DeleteAnnotation(oAnnotationIndex)
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub LoadAnnotations(pReceiverId As Integer)
|
||||
Dim oPageCount = GDViewer.PageCount
|
||||
For oPage = 1 To oPageCount
|
||||
GDViewer.DisplayPage(oPage)
|
||||
Dim oCurrentPage = oPage
|
||||
Dim oElements = Controller.Elements.Where(Function(element) element.Page = oCurrentPage And element.ReceiverId = pReceiverId).ToList()
|
||||
For Each oElement In oElements
|
||||
LoadAnnotation(oElement, pReceiverId)
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function GetAnnotationTag(pReceiver As Integer, pPage As Integer, pIndex As Integer) As String
|
||||
Return $"{pReceiver}|{pPage}|{pIndex}"
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
@ -88,6 +88,7 @@ Public Class frmMain
|
||||
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(pRowHandle)
|
||||
Dim oForm As New frmEnvelopeEditor() With {.State = State, .Envelope = oEnvelope}
|
||||
oForm.ShowDialog()
|
||||
GridEnvelopes.DataSource = Controller.ListEnvelopes()
|
||||
End Sub
|
||||
|
||||
Private Sub ViewEnvelopes_DoubleClick(sender As Object, e As EventArgs) Handles ViewEnvelopes.DoubleClick
|
||||
@ -96,4 +97,8 @@ Public Class frmMain
|
||||
LoadEnvelope(oSelectedRows.First)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RibbonControl_Click(sender As Object, e As EventArgs) Handles RibbonControl.Click
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user