31.07.2023
This commit is contained in:
parent
b24fbf58fc
commit
13cf091d8e
@ -1,5 +1,6 @@
|
||||
Imports System.Data.Common
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports System.Runtime.Remoting.Messaging
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
@ -12,9 +13,9 @@ Public Class EnvelopeEditorController
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly State As State = Nothing
|
||||
|
||||
Private ReadOnly EnvelopeModel As EnvelopeModel
|
||||
Private ReadOnly DocumentModel As DocumentModel
|
||||
Private ReadOnly ReceiverModel As ReceiverModel
|
||||
Private EnvelopeModel As EnvelopeModel
|
||||
Private DocumentModel As DocumentModel
|
||||
Private ReceiverModel As ReceiverModel
|
||||
|
||||
Public ReadOnly Envelope As Envelope = Nothing
|
||||
|
||||
@ -24,7 +25,7 @@ Public Class EnvelopeEditorController
|
||||
Database = pState.Database
|
||||
State = pState
|
||||
|
||||
EnvelopeModel = New EnvelopeModel(pState)
|
||||
InitializeModels(pState)
|
||||
|
||||
Envelope = CreateEnvelope()
|
||||
End Sub
|
||||
@ -35,15 +36,19 @@ Public Class EnvelopeEditorController
|
||||
Database = pState.Database
|
||||
State = pState
|
||||
|
||||
EnvelopeModel = New EnvelopeModel(pState)
|
||||
DocumentModel = New DocumentModel(pState)
|
||||
ReceiverModel = New ReceiverModel(pState)
|
||||
InitializeModels(pState)
|
||||
|
||||
Envelope = pEnvelope
|
||||
Envelope.Documents = DocumentModel.List(pEnvelope.Id)
|
||||
Envelope.Receivers = ReceiverModel.List(pEnvelope.Id)
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeModels(pState As State)
|
||||
EnvelopeModel = New EnvelopeModel(pState)
|
||||
DocumentModel = New DocumentModel(pState)
|
||||
ReceiverModel = New ReceiverModel(pState)
|
||||
End Sub
|
||||
|
||||
#Region "Public"
|
||||
Public Function CreateEnvelope() As Envelope
|
||||
Dim oEnvelope As New Envelope() With {.UserId = State.UserId}
|
||||
@ -60,6 +65,11 @@ Public Class EnvelopeEditorController
|
||||
|
||||
Try
|
||||
pEnvelope.Status = Constants.EnvelopeStatus.Saved
|
||||
|
||||
If SaveEnvelopeDocumentsToFilesystem(pEnvelope) = False Then
|
||||
Throw New ApplicationException
|
||||
End If
|
||||
|
||||
If EnvelopeModel.Update(pEnvelope, oTransaction) = False Then
|
||||
Throw New ApplicationException
|
||||
End If
|
||||
@ -94,14 +104,75 @@ Public Class EnvelopeEditorController
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function CreateDocument(pDocumentFilePath As String) As EnvelopeDocument
|
||||
Try
|
||||
Dim oFileInfo = New FileInfo(pDocumentFilePath)
|
||||
Dim oTempDirectoryPath = Path.GetTempPath()
|
||||
Dim oTempFilePath = Path.Combine(oTempDirectoryPath, oFileInfo.Name)
|
||||
File.Copy(oFileInfo.FullName, oTempFilePath)
|
||||
|
||||
Dim oDocument = New EnvelopeDocument() With {
|
||||
.FileInfo = New FileInfo(oTempFilePath)
|
||||
}
|
||||
|
||||
Return oDocument
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function DeleteDocument(pDocument As EnvelopeDocument) As Boolean
|
||||
Dim oSql = "DELETE FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE FILENAME = @FILENAME AND ENVELOPE_ID = @ENVELOPE_ID"
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
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)
|
||||
End Function
|
||||
|
||||
Public Function SaveEnvelopeDocumentsToFilesystem(pEnvelope As Envelope) As Boolean
|
||||
Try
|
||||
For Each oDocument In pEnvelope.Documents.Where(Function(d) d.IsTempFile)
|
||||
|
||||
Dim oEnvelopePath = GetEnvelopePath(pEnvelope)
|
||||
|
||||
If oEnvelopePath Is Nothing Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oDocumentFilePath = Path.Combine(oEnvelopePath, oDocument.Filename)
|
||||
File.Copy(oDocument.Filepath, oDocumentFilePath)
|
||||
File.Delete(oDocument.Filepath)
|
||||
|
||||
oDocument.IsTempFile = False
|
||||
oDocument.FileInfo = New FileInfo(oDocumentFilePath)
|
||||
Next
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetEnvelopePath(pEnvelope As Envelope) As String
|
||||
Try
|
||||
Dim oEnvelopePath As String = Path.Combine(State.DbConfig.DocumentPath, pEnvelope.Uuid)
|
||||
|
||||
If Not Directory.Exists(oEnvelopePath) Then
|
||||
Directory.CreateDirectory(oEnvelopePath)
|
||||
End If
|
||||
|
||||
Return oEnvelopePath
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
Private Function SaveEnvelopeDocuments(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
|
||||
@ -175,85 +246,25 @@ Public Class EnvelopeEditorController
|
||||
End Function
|
||||
|
||||
Private Function AssignReceivers(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
|
||||
If Database.ExecuteNonQuery($"DELETE FROM [dbo].[TBSIG_ENVELOPE_RECEIVER] WHERE [ENVELOPE_ID] = {pEnvelope.Id}") = False Then
|
||||
If ReceiverModel.Unassign(pEnvelope, pTransaction) = False Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return pEnvelope.Receivers.
|
||||
Select(Function(r) AssignReceiver(pEnvelope, r, pTransaction)).
|
||||
Select(Function(r) ReceiverModel.Assign(pEnvelope, r, pTransaction)).
|
||||
All(Function(pResult) pResult = True)
|
||||
|
||||
End Function
|
||||
|
||||
Private Function AssignReceiver(pEnvelope As Envelope, pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_RECEIVER]
|
||||
([ENVELOPE_ID]
|
||||
,[RECEIVER_ID]
|
||||
,[PRIVATE_MESSAGE]
|
||||
,[ACCESS_CODE]
|
||||
,[SEQUENCE])
|
||||
VALUES
|
||||
(@ENVELOPE_ID
|
||||
,@RECEIVER_ID
|
||||
,@MESSAGE
|
||||
,@ACCESS_CODE
|
||||
,@SEQUENCE)"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.NVarChar).Value = pEnvelope.Id
|
||||
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("SEQUENCE", SqlDbType.NVarChar).Value = pReceiver.Sequence
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
End Function
|
||||
|
||||
Private Function UpdateReceiver(pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
If pReceiver.Id = 0 Then
|
||||
Dim oSql As String = "INSERT INTO [dbo].[TBSIG_RECEIVER]
|
||||
([NAME]
|
||||
,[EMAIL_ADDRESS]
|
||||
,[SIGNATURE]
|
||||
,[COMPANY_NAME]
|
||||
,[JOB_TITLE])
|
||||
VALUES
|
||||
(@NAME
|
||||
,@EMAIL
|
||||
,@SIGNATURE
|
||||
,@COMPANY
|
||||
,@JOB)"
|
||||
|
||||
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
|
||||
pReceiver.Id = GetReceiverId(pReceiver.Email, pTransaction)
|
||||
Else
|
||||
Return False
|
||||
If ReceiverModel.TestReceiverExists(pReceiver) Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
Return True
|
||||
|
||||
If pReceiver.HasId Then
|
||||
Return ReceiverModel.Update(pReceiver, pTransaction)
|
||||
Else
|
||||
Dim oSql As String = "UPDATE [dbo].[TBSIG_RECEIVER]
|
||||
SET [NAME] = @NAME
|
||||
,[COMPANY_NAME] = @COMPANY
|
||||
,[JOB_TITLE] = @JOB
|
||||
WHERE GUID = @GUID"
|
||||
|
||||
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
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
Return ReceiverModel.Insert(pReceiver, pTransaction)
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
@ -8,14 +8,18 @@ Imports GdPicture14.Annotations
|
||||
Public Class FieldEditorController
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly ElementModel As ElementModel
|
||||
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly Document As EnvelopeDocument
|
||||
Public ReadOnly Property Elements As New List(Of EnvelopeDocumentElement)
|
||||
Public Property Elements As New List(Of EnvelopeDocumentElement)
|
||||
|
||||
Public Sub New(pState As State, pDocument As EnvelopeDocument)
|
||||
MyBase.New(pState.LogConfig)
|
||||
Database = pState.Database
|
||||
Document = pDocument
|
||||
|
||||
ElementModel = New ElementModel(pState)
|
||||
End Sub
|
||||
|
||||
Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote, pReceiverId As Integer)
|
||||
@ -44,6 +48,15 @@ Public Class FieldEditorController
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Function LoadElements() As Boolean
|
||||
Elements = ElementModel.List(Document.Id)
|
||||
|
||||
If Elements Is Nothing Then
|
||||
Return False
|
||||
Else Return True
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function SaveElements() As Boolean
|
||||
Return Elements.
|
||||
Select(AddressOf SaveElement).
|
||||
|
||||
@ -5,6 +5,8 @@ Public Class EnvelopeDocument
|
||||
|
||||
Public Property FileInfo As FileInfo
|
||||
|
||||
Public Property IsTempFile As Boolean = True
|
||||
|
||||
Public Property EnvelopeId As Integer = 0
|
||||
|
||||
Public ReadOnly Property Filename As String
|
||||
|
||||
@ -12,6 +12,11 @@ Public Class EnvelopeReceiver
|
||||
Return StringEx.GetChecksum(Email.ToUpper)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property HasId As Boolean
|
||||
Get
|
||||
Return Id > 0
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Property Sequence As Integer = 0
|
||||
Public Property PrivateMessage As String = ""
|
||||
|
||||
@ -52,9 +52,13 @@
|
||||
<Reference Include="DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraPrinting.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraTreeList.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DigitalData.Controls.DocumentViewer">
|
||||
<HintPath>..\..\DDMonorepo\Controls.DocumentViewer\bin\Debug\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.GUIs.Common">
|
||||
<HintPath>..\..\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
@ -130,6 +134,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Models\BaseModel.vb" />
|
||||
<Compile Include="Models\DocumentModel.vb" />
|
||||
<Compile Include="Models\ElementModel.vb" />
|
||||
<Compile Include="Models\EnvelopeModel.vb" />
|
||||
<Compile Include="Models\ReceiverModel.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
|
||||
@ -10,7 +10,8 @@ Public Class DocumentModel
|
||||
Return New EnvelopeDocument() With {
|
||||
.Id = pRow.ItemEx("GUID", 0),
|
||||
.EnvelopeId = pRow.ItemEx("ENVELOPE_ID", 0),
|
||||
.FileInfo = New IO.FileInfo(pRow.ItemEx("FILEPATH", ""))
|
||||
.FileInfo = New IO.FileInfo(pRow.ItemEx("FILEPATH", "")),
|
||||
.IsTempFile = False
|
||||
}
|
||||
End Function
|
||||
|
||||
|
||||
39
EnvelopeGenerator.Form/Models/ElementModel.vb
Normal file
39
EnvelopeGenerator.Form/Models/ElementModel.vb
Normal file
@ -0,0 +1,39 @@
|
||||
Imports DigitalData.Modules.Base
|
||||
|
||||
Public Class ElementModel
|
||||
Inherits BaseModel
|
||||
|
||||
Public Sub New(pState As State)
|
||||
MyBase.New(pState)
|
||||
End Sub
|
||||
|
||||
Private Function ToElement(pRow As DataRow) As EnvelopeDocumentElement
|
||||
Return New EnvelopeDocumentElement() With {
|
||||
.Id = pRow.ItemEx("GUID", 0),
|
||||
.DocumentId = pRow.ItemEx("DOCUMENT_ID", 0),
|
||||
.ReceiverId = pRow.ItemEx("RECEIVER_ID", 0),
|
||||
.ElementType = [Enum].Parse(GetType(Constants.ElementType), pRow.ItemEx("ELEMENT_TYPE", Constants.ElementType.Signature.ToString)),
|
||||
.X = pRow.ItemEx("POSITION_X", 0.0),
|
||||
.Y = pRow.ItemEx("POSITION_Y", 0.0),
|
||||
.Width = pRow.ItemEx("WIDTH", 0.0),
|
||||
.Height = pRow.ItemEx("HEIGHT", 0.0),
|
||||
.Page = pRow.ItemEx("PAGE", 0)
|
||||
}
|
||||
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 oTable = Database.GetDatatable(oSql)
|
||||
|
||||
Return oTable?.Rows.Cast(Of DataRow).
|
||||
Select(AddressOf ToElement).
|
||||
ToList()
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@ -1,4 +1,6 @@
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports System.Data.Common
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Base
|
||||
Public Class ReceiverModel
|
||||
Inherits BaseModel
|
||||
|
||||
@ -15,6 +17,108 @@ Public Class ReceiverModel
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Function TestReceiverExists(pReceiver As EnvelopeReceiver) As Boolean
|
||||
Try
|
||||
Dim oGuid = Database.GetScalarValue($"SELECT COALESCE(GUID, 0) FROM TBSIG_RECEIVER WHERE EMAIL_ADDRESS = '{pReceiver.Email}'")
|
||||
pReceiver.Id = oGuid
|
||||
Return oGuid > 0
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
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])
|
||||
VALUES
|
||||
(@NAME
|
||||
,@EMAIL
|
||||
,@SIGNATURE
|
||||
,@COMPANY
|
||||
,@JOB)"
|
||||
|
||||
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
|
||||
pReceiver.Id = GetReceiverId(pReceiver.Email, pTransaction)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
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]
|
||||
SET [NAME] = @NAME
|
||||
,[COMPANY_NAME] = @COMPANY
|
||||
,[JOB_TITLE] = @JOB
|
||||
WHERE GUID = @GUID"
|
||||
|
||||
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
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Unassign(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
Return Database.ExecuteNonQuery($"DELETE FROM [dbo].[TBSIG_ENVELOPE_RECEIVER] WHERE [ENVELOPE_ID] = {pEnvelope.Id}", pTransaction)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Assign(pEnvelope As Envelope, pReceiver As EnvelopeReceiver, pTransaction As SqlTransaction) As Boolean
|
||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_RECEIVER]
|
||||
([ENVELOPE_ID]
|
||||
,[RECEIVER_ID]
|
||||
,[PRIVATE_MESSAGE]
|
||||
,[ACCESS_CODE]
|
||||
,[SEQUENCE])
|
||||
VALUES
|
||||
(@ENVELOPE_ID
|
||||
,@RECEIVER_ID
|
||||
,@MESSAGE
|
||||
,@ACCESS_CODE
|
||||
,@SEQUENCE)"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.NVarChar).Value = pEnvelope.Id
|
||||
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("SEQUENCE", SqlDbType.NVarChar).Value = pReceiver.Sequence
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
End Function
|
||||
|
||||
Public Function List(pEnvelopeId As Integer) As IEnumerable(Of EnvelopeReceiver)
|
||||
Try
|
||||
Dim oSql = $"SELECT * FROM [dbo].[VWSIG_ENVELOPE_RECEIVERS] WHERE ENVELOPE_ID = {pEnvelopeId}"
|
||||
@ -29,4 +133,14 @@ Public Class ReceiverModel
|
||||
Return Nothing
|
||||
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)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -158,6 +158,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
'
|
||||
Me.btnEditFields.Caption = "Edit Sign Fields"
|
||||
Me.btnEditFields.Id = 7
|
||||
Me.btnEditFields.ImageOptions.SvgImage = CType(resources.GetObject("btnEditFields.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnEditFields.Name = "btnEditFields"
|
||||
'
|
||||
'RibbonPage1
|
||||
|
||||
@ -213,6 +213,24 @@
|
||||
dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IlNlbmQiPg0KICAgIDxwb2x5Z29uIHBvaW50cz0iMiwy
|
||||
MCA4LDIyLjQgMjQsMTAgMTIsMjQgMTIsMzAgMTYuMywyNS43IDIyLDI4IDMwLDIgICIgY2xhc3M9IkJs
|
||||
dWUiIC8+DQogIDwvZz4NCjwvc3ZnPgs=
|
||||
</value>
|
||||
</data>
|
||||
<data name="btnEditFields.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAGgCAAAC77u/
|
||||
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
|
||||
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
|
||||
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
|
||||
Y2U9InByZXNlcnZlIiBpZD0iRWRpdF9Db21tZW50IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3
|
||||
IDAgMCAzMiAzMiI+DQogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CgkuQmx1ZXtmaWxsOiMxMTc3RDc7
|
||||
fQoJLlllbGxvd3tmaWxsOiNGRkIxMTU7fQo8L3N0eWxlPg0KICA8cGF0aCBkPSJNMywyMmgzdjZsNi02
|
||||
aDMuMkwyNiwxMS4yVjdjMC0wLjYtMC40LTEtMS0xSDNDMi40LDYsMiw2LjQsMiw3djE0QzIsMjEuNiwy
|
||||
LjQsMjIsMywyMnoiIGNsYXNzPSJZZWxsb3ciIC8+DQogIDxwYXRoIGQ9Ik0yOSwxOWwtOCw4bC00LTRs
|
||||
OC04TDI5LDE5eiBNMzAsMThsMS43LTEuN2MwLjQtMC40LDAuNC0xLDAtMS4zbC0yLjctMi43Yy0wLjQt
|
||||
MC40LTEtMC40LTEuMywwTDI2LDE0TDMwLDE4eiAgIE0xNiwyNHY0aDRMMTYsMjR6IiBjbGFzcz0iQmx1
|
||||
ZSIgLz4NCjwvc3ZnPgs=
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="EnvelopeReceiverBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
||||
@ -18,8 +18,13 @@ Partial Public Class frmEnvelopeEditor
|
||||
|
||||
Private Sub btnNewFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnNewFile.ItemClick
|
||||
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
|
||||
Dim oFileInfo = New FileInfo(OpenFileDialog1.FileName)
|
||||
Documents.Add(New EnvelopeDocument() With {.FileInfo = oFileInfo})
|
||||
Dim oDocument = Controller.CreateDocument(OpenFileDialog1.FileName)
|
||||
|
||||
If oDocument IsNot Nothing Then
|
||||
Documents.Add(oDocument)
|
||||
Else
|
||||
MsgBox("Dokument konnte nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@ -55,7 +60,9 @@ Partial Public Class frmEnvelopeEditor
|
||||
|
||||
Private Sub btnSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick
|
||||
Try
|
||||
SaveEnvelope()
|
||||
If SaveEnvelope() Then
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Text
|
||||
Imports DevExpress.Utils.Svg
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
@ -19,8 +20,6 @@ Partial Public Class frmFieldEditor
|
||||
Public Property SelectedReceiver As EnvelopeReceiver = Nothing
|
||||
Public Property State As State
|
||||
|
||||
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
@ -55,6 +54,16 @@ Partial Public Class frmFieldEditor
|
||||
PopupMenu1.AddItems(oItems)
|
||||
|
||||
Controller = New FieldEditorController(State, Document)
|
||||
|
||||
If Controller.LoadElements() = False Then
|
||||
MsgBox("Elemente konnten nicht geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
Else
|
||||
|
||||
For Each oElement In Controller.Elements
|
||||
LoadAnnotation(oElement)
|
||||
Next
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem
|
||||
@ -162,25 +171,23 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub LoadAnnotation()
|
||||
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement)
|
||||
Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR")
|
||||
|
||||
|
||||
If Manager.GetStat() = GdPictureStatus.OK Then
|
||||
oAnnotation.Width = 2
|
||||
oAnnotation.Height = 2
|
||||
oAnnotation.Left = 1
|
||||
oAnnotation.Top = 1
|
||||
oAnnotation.Width = CSng(pElement.Width)
|
||||
oAnnotation.Height = CSng(pElement.Height)
|
||||
oAnnotation.Left = CSng(pElement.X)
|
||||
oAnnotation.Top = CSng(pElement.Y)
|
||||
oAnnotation.Fill = True
|
||||
oAnnotation.FillColor = Color.DarkRed
|
||||
oAnnotation.Text = "SIGNATUR JUNGE"
|
||||
oAnnotation.Text = "SIGNATUR"
|
||||
|
||||
' TODO: Set tag with annotation index and page
|
||||
'oAnnotation.Tag =
|
||||
|
||||
If Manager.SaveAnnotationsToPage() = GdPictureStatus.OK Then
|
||||
'oManager.BurnAnnotationsToPage(True)
|
||||
|
||||
'GDViewer.ReloadAnnotations()
|
||||
'GDViewer.Redraw()
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
18
EnvelopeGenerator.Form/frmMain.Designer.vb
generated
18
EnvelopeGenerator.Form/frmMain.Designer.vb
generated
@ -22,12 +22,12 @@ Partial Class frmMain
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))
|
||||
Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl()
|
||||
Me.btnCreateEnvelope = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.btnEditEnvelope = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
|
||||
Me.GridEnvelopes = New DevExpress.XtraGrid.GridControl()
|
||||
Me.ViewEnvelopes = New DevExpress.XtraGrid.Views.Grid.GridView()
|
||||
Me.btnEditEnvelope = New DevExpress.XtraBars.BarButtonItem()
|
||||
CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.GridEnvelopes, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.ViewEnvelopes, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
@ -48,9 +48,16 @@ Partial Class frmMain
|
||||
'
|
||||
Me.btnCreateEnvelope.Caption = "Neuer Umschlag"
|
||||
Me.btnCreateEnvelope.Id = 1
|
||||
Me.btnCreateEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnCreateEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("btnCreateEnvelope.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnCreateEnvelope.Name = "btnCreateEnvelope"
|
||||
'
|
||||
'btnEditEnvelope
|
||||
'
|
||||
Me.btnEditEnvelope.Caption = "Lade Umschlag"
|
||||
Me.btnEditEnvelope.Id = 2
|
||||
Me.btnEditEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("btnEditEnvelope.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnEditEnvelope.Name = "btnEditEnvelope"
|
||||
'
|
||||
'RibbonPage1
|
||||
'
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1})
|
||||
@ -87,13 +94,6 @@ Partial Class frmMain
|
||||
Me.ViewEnvelopes.GridControl = Me.GridEnvelopes
|
||||
Me.ViewEnvelopes.Name = "ViewEnvelopes"
|
||||
'
|
||||
'btnEditEnvelope
|
||||
'
|
||||
Me.btnEditEnvelope.Caption = "Lade Umschlag"
|
||||
Me.btnEditEnvelope.Id = 2
|
||||
Me.btnEditEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem2.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
|
||||
Me.btnEditEnvelope.Name = "btnEditEnvelope"
|
||||
'
|
||||
'frmMain
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
|
||||
@ -118,7 +118,7 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="DevExpress.Data.v21.2" name="DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<data name="BarButtonItem1.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="btnCreateEnvelope.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
@ -137,7 +137,7 @@
|
||||
ICA8L2c+DQo8L3N2Zz4L
|
||||
</value>
|
||||
</data>
|
||||
<data name="BarButtonItem2.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="btnEditEnvelope.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
|
||||
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
|
||||
|
||||
@ -3,6 +3,7 @@ Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.GUIs.Common
|
||||
|
||||
Public Class frmMain
|
||||
Private LogConfig As LogConfig
|
||||
@ -11,6 +12,8 @@ Public Class frmMain
|
||||
Private ConfigManager As ConfigManager(Of Config)
|
||||
Private DbConfig As DbConfig
|
||||
|
||||
Private GridBuilder As GridBuilder
|
||||
|
||||
Private State As State
|
||||
Private Controller As EnvelopeListController
|
||||
|
||||
@ -41,8 +44,14 @@ Public Class frmMain
|
||||
|
||||
Controller = New EnvelopeListController(State)
|
||||
|
||||
GridBuilder = New GridBuilder(ViewEnvelopes)
|
||||
GridBuilder.SetDefaults(ViewEnvelopes)
|
||||
GridBuilder.SetReadOnlyOptions(ViewEnvelopes)
|
||||
|
||||
GridEnvelopes.DataSource = Controller.ListEnvelopes()
|
||||
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
@ -71,9 +80,20 @@ Public Class frmMain
|
||||
Private Sub btnEditEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditEnvelope.ItemClick
|
||||
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
|
||||
If oSelectedRows.Count > 0 Then
|
||||
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(oSelectedRows(0))
|
||||
LoadEnvelope(oSelectedRows.First)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub LoadEnvelope(pRowHandle As Integer)
|
||||
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(pRowHandle)
|
||||
Dim oForm As New frmEnvelopeEditor() With {.State = State, .Envelope = oEnvelope}
|
||||
oForm.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub ViewEnvelopes_DoubleClick(sender As Object, e As EventArgs) Handles ViewEnvelopes.DoubleClick
|
||||
Dim oSelectedRows = ViewEnvelopes.GetSelectedRows()
|
||||
If oSelectedRows.Count > 0 Then
|
||||
LoadEnvelope(oSelectedRows.First)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user