19.07.2023

This commit is contained in:
Jonathan Jenne 2023-07-31 09:52:49 +02:00
parent 9a3c3c2706
commit b24fbf58fc
18 changed files with 379 additions and 104 deletions

View File

@ -11,21 +11,42 @@ Public Class EnvelopeEditorController
Private ReadOnly Database As MSSQLServer Private ReadOnly Database As MSSQLServer
Private ReadOnly State As State = Nothing Private ReadOnly State As State = Nothing
Private ReadOnly EnvelopeModel As EnvelopeModel Private ReadOnly EnvelopeModel As EnvelopeModel
Private ReadOnly DocumentModel As DocumentModel
Private ReadOnly ReceiverModel As ReceiverModel
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.LogConfig)
Database = pState.Database Database = pState.Database
State = pState State = pState
EnvelopeModel = New EnvelopeModel(pState) EnvelopeModel = New EnvelopeModel(pState)
Envelope = CreateEnvelope() Envelope = CreateEnvelope()
End Sub End Sub
Public Sub New(pState As State, pEnvelope As Envelope)
MyBase.New(pState.LogConfig)
Database = pState.Database
State = pState
EnvelopeModel = New EnvelopeModel(pState)
DocumentModel = New DocumentModel(pState)
ReceiverModel = New ReceiverModel(pState)
Envelope = pEnvelope
Envelope.Documents = DocumentModel.List(pEnvelope.Id)
Envelope.Receivers = ReceiverModel.List(pEnvelope.Id)
End Sub
#Region "Public" #Region "Public"
Public Function CreateEnvelope() As Envelope Public Function CreateEnvelope() As Envelope
Dim oEnvelope As New Envelope(State.UserId) Dim oEnvelope As New Envelope() With {.UserId = State.UserId}
If EnvelopeModel.Insert(oEnvelope) Then If EnvelopeModel.Insert(oEnvelope) Then
Return oEnvelope Return oEnvelope
Else Else

View File

@ -0,0 +1,21 @@
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Database
Public Class EnvelopeListController
Inherits BaseClass
Private ReadOnly Database As MSSQLServer
Private ReadOnly State As State
Private ReadOnly EnvelopeModel As EnvelopeModel
Public Sub New(pState As State)
MyBase.New(pState.LogConfig)
Database = pState.Database
State = pState
EnvelopeModel = New EnvelopeModel(pState)
End Sub
Public Function ListEnvelopes() As IEnumerable(Of Envelope)
Return EnvelopeModel.List()
End Function
End Class

View File

@ -1,21 +1,51 @@
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports DevExpress.Utils.CommonDialogs Imports DevExpress.Utils.CommonDialogs
Imports DevExpress.XtraBars.Docking2010.Views.NativeMdi
Imports DigitalData.Modules.Base Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Database Imports DigitalData.Modules.Database
Imports GdPicture14.Annotations
Public Class FieldEditorController Public Class FieldEditorController
Inherits BaseClass Inherits BaseClass
Private ReadOnly Database As MSSQLServer Private ReadOnly Database As MSSQLServer
Private Envelope As Envelope = Nothing Private ReadOnly Document As EnvelopeDocument
Public ReadOnly Property Elements As New List(Of EnvelopeDocumentElement)
Public Sub New(pState As State) Public Sub New(pState As State, pDocument As EnvelopeDocument)
MyBase.New(pState.LogConfig) MyBase.New(pState.LogConfig)
Database = pState.Database Database = pState.Database
Document = pDocument
End Sub End Sub
Public Function SaveElements(pElements As IEnumerable(Of EnvelopeDocumentElement)) As Boolean Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote, pReceiverId As Integer)
Return pElements. 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()
If oELement IsNot Nothing Then
oELement.Height = pAnnotation.Height
oELement.Width = pAnnotation.Width
oELement.X = pAnnotation.Left
oELement.Y = pAnnotation.Top
Else
Elements.Add(New EnvelopeDocumentElement() With {
.ElementType = Constants.ElementType.Signature.ToString,
.Height = pAnnotation.Height,
.Width = pAnnotation.Width,
.X = pAnnotation.Left,
.Y = pAnnotation.Top,
.DocumentId = Document.Id,
.ReceiverId = pReceiverId,
.AnnotationIndex = oIndex,
.Page = oPage
})
End If
End Sub
Public Function SaveElements() As Boolean
Return Elements.
Select(AddressOf SaveElement). Select(AddressOf SaveElement).
All(Function(pResult) pResult = True) All(Function(pResult) pResult = True)
End Function End Function
@ -32,10 +62,10 @@ Public Class FieldEditorController
Dim oCommand As New SqlCommand(oSql) Dim oCommand As New SqlCommand(oSql)
oCommand.Parameters.Add("GUID", SqlDbType.NVarChar).Value = pElement.Id oCommand.Parameters.Add("GUID", SqlDbType.NVarChar).Value = pElement.Id
oCommand.Parameters.Add("POSITION_X", SqlDbType.Int).Value = pElement.X oCommand.Parameters.Add("POSITION_X", SqlDbType.Float).Value = pElement.X
oCommand.Parameters.Add("POSITION_Y", SqlDbType.Int).Value = pElement.Y oCommand.Parameters.Add("POSITION_Y", SqlDbType.Float).Value = pElement.Y
oCommand.Parameters.Add("WIDTH", SqlDbType.Int).Value = pElement.Width oCommand.Parameters.Add("WIDTH", SqlDbType.Float).Value = pElement.Width
oCommand.Parameters.Add("HEIGHT", SqlDbType.Int).Value = pElement.Height oCommand.Parameters.Add("HEIGHT", SqlDbType.Float).Value = pElement.Height
Return Database.ExecuteNonQuery(oCommand) Return Database.ExecuteNonQuery(oCommand)
@ -51,7 +81,8 @@ Public Class FieldEditorController
,[REQUIRED] ,[REQUIRED]
,[READ_ONLY] ,[READ_ONLY]
,[STATUS] ,[STATUS]
,[PAGE]) ,[PAGE]
,[ANNOTATION_INDEX])
VALUES VALUES
(@DOCUMENT_ID (@DOCUMENT_ID
,@RECEIVER_ID ,@RECEIVER_ID
@ -63,21 +94,22 @@ Public Class FieldEditorController
,@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
oCommand.Parameters.Add("RECEIVER_ID", SqlDbType.NVarChar).Value = pElement.ReceiverId oCommand.Parameters.Add("RECEIVER_ID", SqlDbType.NVarChar).Value = pElement.ReceiverId
oCommand.Parameters.Add("ELEMENT_TYPE", SqlDbType.NVarChar).Value = pElement.ElementType oCommand.Parameters.Add("ELEMENT_TYPE", SqlDbType.NVarChar).Value = pElement.ElementType
oCommand.Parameters.Add("POSITION_X", SqlDbType.Int).Value = pElement.X oCommand.Parameters.Add("POSITION_X", SqlDbType.Float).Value = pElement.X
oCommand.Parameters.Add("POSITION_Y", SqlDbType.Int).Value = pElement.Y oCommand.Parameters.Add("POSITION_Y", SqlDbType.Float).Value = pElement.Y
oCommand.Parameters.Add("WIDTH", SqlDbType.Int).Value = pElement.Width oCommand.Parameters.Add("WIDTH", SqlDbType.Float).Value = pElement.Width
oCommand.Parameters.Add("HEIGHT", SqlDbType.Int).Value = pElement.Height oCommand.Parameters.Add("HEIGHT", SqlDbType.Float).Value = pElement.Height
oCommand.Parameters.Add("REQUIRED", SqlDbType.Bit).Value = pElement.Required oCommand.Parameters.Add("REQUIRED", SqlDbType.Bit).Value = pElement.Required
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)

View File

@ -0,0 +1,4 @@
Public Class ElementMetadata
Public Property Index As Integer
Public Property Page As Integer
End Class

View File

@ -9,10 +9,6 @@
Public Property Documents As New List(Of EnvelopeDocument) Public Property Documents As New List(Of EnvelopeDocument)
Public Property Receivers As New List(Of EnvelopeReceiver) Public Property Receivers As New List(Of EnvelopeReceiver)
Public Sub New(pUserId As Integer)
UserId = pUserId
End Sub
Public Function Validate() As List(Of String) Public Function Validate() As List(Of String)
Dim oErrors As New List(Of String) Dim oErrors As New List(Of String)

View File

@ -1,9 +1,9 @@
Public Class EnvelopeDocumentElement Public Class EnvelopeDocumentElement
Public Property Id As Integer = 0 Public Property Id As Integer = 0
Public Property X As Integer Public Property X As Double
Public Property Y As Integer Public Property Y As Double
Public Property Width As Integer Public Property Width As Double
Public Property Height As Integer Public Property Height As Double
Public Property ElementType As String Public Property ElementType As String
Public Property DocumentId As Integer Public Property DocumentId As Integer
Public Property ReceiverId As Integer Public Property ReceiverId As Integer
@ -11,4 +11,5 @@
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
End Class End Class

View File

@ -101,8 +101,10 @@
<Compile Include="Config.vb" /> <Compile Include="Config.vb" />
<Compile Include="Constants.vb" /> <Compile Include="Constants.vb" />
<Compile Include="Controllers\EnvelopeEditorController.vb" /> <Compile Include="Controllers\EnvelopeEditorController.vb" />
<Compile Include="Controllers\EnvelopeListController.vb" />
<Compile Include="Controllers\FieldEditorController.vb" /> <Compile Include="Controllers\FieldEditorController.vb" />
<Compile Include="DbConfig.vb" /> <Compile Include="DbConfig.vb" />
<Compile Include="Entities\ElementMetadata.vb" />
<Compile Include="Entities\Envelope.vb" /> <Compile Include="Entities\Envelope.vb" />
<Compile Include="Entities\EnvelopeDocument.vb" /> <Compile Include="Entities\EnvelopeDocument.vb" />
<Compile Include="Entities\EnvelopeDocumentElement.vb" /> <Compile Include="Entities\EnvelopeDocumentElement.vb" />
@ -126,7 +128,10 @@
<Compile Include="frmMain.vb"> <Compile Include="frmMain.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Models\BaseModel.vb" />
<Compile Include="Models\DocumentModel.vb" />
<Compile Include="Models\EnvelopeModel.vb" /> <Compile Include="Models\EnvelopeModel.vb" />
<Compile Include="Models\ReceiverModel.vb" />
<Compile Include="My Project\Application.Designer.vb"> <Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon> <DependentUpon>Application.myapp</DependentUpon>
@ -183,7 +188,11 @@
<LastGenOutput>Application.Designer.vb</LastGenOutput> <LastGenOutput>Application.Designer.vb</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Content Include="MailLicense.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<License>
<Id>4dc5ef40-f1a9-468b-994c-b7ed600ad878</Id>
<ProductName>Mail.dll</ProductName>
<SubscriptionUntil>2022-07-29</SubscriptionUntil>
<RegisteredTo>Digital Data GmbH</RegisteredTo>
<LicenseType>single developer</LicenseType>
<BuyerName>Digital Data GmbH</BuyerName>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>75MRtl4ipYelIZYlpT8O7QDX9Zc=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>Raxfkz6DfQVs/sMvH+F2nH0eHXD8FoUFSdP3t7AgBUdpABJQx86srlyuMSEhXPlc1THCqPouEVob4RsWnd9OXvTiPPSOUSK9zuNG6uz93KLAhpSD5PraAgBCF4jwZArlAp7aCNfZpHqQ3w6TRHS+CfravUU0AHHG3MZ1ZcRkGuo=</SignatureValue>
</Signature>
</License>

View File

@ -0,0 +1,14 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Public MustInherit Class BaseModel
Protected Database As MSSQLServer
Protected Logger As Logger
Protected State As State
Public Sub New(pState As State)
Logger = pState.LogConfig.GetLogger()
Database = pState.Database
State = pState
End Sub
End Class

View File

@ -0,0 +1,31 @@
Imports DigitalData.Modules.Base
Public Class DocumentModel
Inherits BaseModel
Public Sub New(pState As State)
MyBase.New(pState)
End Sub
Private Function ToDocument(pRow As DataRow) As EnvelopeDocument
Return New EnvelopeDocument() With {
.Id = pRow.ItemEx("GUID", 0),
.EnvelopeId = pRow.ItemEx("ENVELOPE_ID", 0),
.FileInfo = New IO.FileInfo(pRow.ItemEx("FILEPATH", ""))
}
End Function
Public Function List(pEnvelopeId As Integer) As IEnumerable(Of EnvelopeDocument)
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE ENVELOPE_ID = {pEnvelopeId}"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToDocument).
ToList()
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class

View File

@ -1,19 +1,41 @@
Imports System.Data.Common Imports System.Data.SqlClient
Imports System.Data.SqlClient
Imports System.Runtime.Remoting.Messaging
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports EnvelopeGenerator.Form.My.Resources Imports DigitalData.Modules.Base
Public Class EnvelopeModel Public Class EnvelopeModel
Private Database As MSSQLServer Inherits BaseModel
Private Logger As Logger
Public Sub New(pState As State) Public Sub New(pState As State)
Logger = pState.LogConfig.GetLogger() MyBase.New(pState)
Database = pState.Database
End Sub End Sub
Private Function ToEnvelope(pRow As DataRow) As Envelope
Dim oEnvelope = New Envelope() With {
.Id = pRow.ItemEx("GUID", 0),
.Uuid = pRow.ItemEx("ENVELOPE_UUID", ""),
.Subject = pRow.ItemEx("SUBJECT", ""),
.Message = pRow.ItemEx("MESSAGE", ""),
.UserId = State.UserId,
.Status = ObjectEx.ToEnum(Of Constants.EnvelopeStatus)(pRow.ItemEx("STATUS", "Created"))
}
Return oEnvelope
End Function
Public Function List() As IEnumerable(Of Envelope)
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE] WHERE USER_ID = {State.UserId}"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToEnvelope).
ToList()
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function Insert(pEnvelope As Envelope) As Boolean Public Function Insert(pEnvelope As Envelope) As Boolean
Try Try
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE] (SUBJECT, MESSAGE, ENVELOPE_UUID, STATUS, USER_ID) VALUES (@SUBJECT, @MESSAGE, @UUID, @STATUS, @USER_ID)" Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE] (SUBJECT, MESSAGE, ENVELOPE_UUID, STATUS, USER_ID) VALUES (@SUBJECT, @MESSAGE, @UUID, @STATUS, @USER_ID)"

View File

@ -0,0 +1,32 @@
Imports DigitalData.Modules.Base
Public Class ReceiverModel
Inherits BaseModel
Public Sub New(pState As State)
MyBase.New(pState)
End Sub
Private Function ToReceiver(pRow As DataRow) As EnvelopeReceiver
Return New EnvelopeReceiver() With {
.Id = pRow.ItemEx("GUID", 0),
.Email = pRow.ItemEx("EMAIL_ADDRESS", ""),
.Name = pRow.ItemEx("NAME", ""),
.Sequence = pRow.ItemEx("SEQUENCE", 0)
}
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}"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToReceiver).
ToList()
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class

View File

@ -40,7 +40,7 @@ Partial Public Class frmEnvelopeEditor
Me.btnNewFile = New DevExpress.XtraBars.BarButtonItem() Me.btnNewFile = New DevExpress.XtraBars.BarButtonItem()
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.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem() Me.btnEditFields = 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()
@ -112,7 +112,7 @@ Partial Public Class frmEnvelopeEditor
'RibbonControl1 'RibbonControl1
' '
Me.RibbonControl1.ExpandCollapseItem.Id = 0 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.BarButtonItem2}) 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.Location = New System.Drawing.Point(0, 0) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl1.MaxItemId = 8 Me.RibbonControl1.MaxItemId = 8
Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Name = "RibbonControl1"
@ -154,11 +154,11 @@ Partial Public Class frmEnvelopeEditor
Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.BarButtonItem1.Name = "BarButtonItem1" Me.BarButtonItem1.Name = "BarButtonItem1"
' '
'BarButtonItem2 'btnEditFields
' '
Me.BarButtonItem2.Caption = "Edit Sign Fields" Me.btnEditFields.Caption = "Edit Sign Fields"
Me.BarButtonItem2.Id = 7 Me.btnEditFields.Id = 7
Me.BarButtonItem2.Name = "BarButtonItem2" Me.btnEditFields.Name = "btnEditFields"
' '
'RibbonPage1 'RibbonPage1
' '
@ -189,7 +189,7 @@ Partial Public Class frmEnvelopeEditor
' '
'RibbonPageGroup4 'RibbonPageGroup4
' '
Me.RibbonPageGroup4.ItemLinks.Add(Me.BarButtonItem2) Me.RibbonPageGroup4.ItemLinks.Add(Me.btnEditFields)
Me.RibbonPageGroup4.Name = "RibbonPageGroup4" Me.RibbonPageGroup4.Name = "RibbonPageGroup4"
Me.RibbonPageGroup4.Text = "RibbonPageGroup4" Me.RibbonPageGroup4.Text = "RibbonPageGroup4"
' '
@ -475,7 +475,7 @@ Partial Public Class frmEnvelopeEditor
Friend WithEvents OpenFileDialog1 As OpenFileDialog Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem Friend WithEvents btnEditFields As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents PanelControl1 As PanelControl Friend WithEvents PanelControl1 As PanelControl
Friend WithEvents PanelControl2 As PanelControl Friend WithEvents PanelControl2 As PanelControl

View File

@ -3,6 +3,7 @@ Imports System.IO
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Partial Public Class frmEnvelopeEditor Partial Public Class frmEnvelopeEditor
Public Property Envelope As Envelope
Public Property Documents As New BindingList(Of EnvelopeDocument) Public Property Documents As New BindingList(Of EnvelopeDocument)
Public Property Receivers As New BindingList(Of EnvelopeReceiver) Public Property Receivers As New BindingList(Of EnvelopeReceiver)
@ -24,7 +25,16 @@ Partial Public Class frmEnvelopeEditor
Private Sub frmEditor_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub frmEditor_Load(sender As Object, e As EventArgs) Handles Me.Load
Logger = State.LogConfig.GetLogger() Logger = State.LogConfig.GetLogger()
If Envelope Is Nothing Then
Controller = New EnvelopeEditorController(State) Controller = New EnvelopeEditorController(State)
Else
Controller = New EnvelopeEditorController(State, Envelope)
Documents = New BindingList(Of EnvelopeDocument)(Controller.Envelope.Documents)
Receivers = New BindingList(Of EnvelopeReceiver)(Controller.Envelope.Receivers)
txtMessage.EditValue = Controller.Envelope.Message
txtSubject.EditValue = Controller.Envelope.Subject
End If
GridDocuments.DataSource = Documents GridDocuments.DataSource = Documents
GridReceivers.DataSource = Receivers GridReceivers.DataSource = Receivers
@ -51,11 +61,12 @@ Partial Public Class frmEnvelopeEditor
End Try End Try
End Sub End Sub
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick Private Sub btnEditFields_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditFields.ItemClick
If ViewDocuments.GetSelectedRows().Count > 0 Then If ViewDocuments.GetSelectedRows().Count > 0 Then
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument) Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
Dim oGDPictureKey As String = "21182889975216572111813147150675976632" 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.
@ -74,6 +85,9 @@ Partial Public Class frmEnvelopeEditor
Dim oSubject = txtSubject.EditValue?.ToString Dim oSubject = txtSubject.EditValue?.ToString
Dim oMessage = txtMessage.EditValue?.ToString Dim oMessage = txtMessage.EditValue?.ToString
' Ensure all receivers are saved
ViewReceivers.CloseEditor()
Dim oEnvelope = Controller.Envelope Dim oEnvelope = Controller.Envelope
oEnvelope.Subject = oSubject oEnvelope.Subject = oSubject
oEnvelope.Message = oMessage oEnvelope.Message = oMessage
@ -93,5 +107,7 @@ 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
End Class End Class

View File

@ -19,7 +19,7 @@ Partial Public Class frmFieldEditor
Public Property SelectedReceiver As EnvelopeReceiver = Nothing Public Property SelectedReceiver As EnvelopeReceiver = Nothing
Public Property State As State Public Property State As State
Public Property Fields As New List(Of EnvelopeDocumentElement)
Public Sub New() Public Sub New()
InitializeComponent() InitializeComponent()
@ -54,7 +54,7 @@ Partial Public Class frmFieldEditor
Dim oItems = Receivers.Select(AddressOf CreateBarItem).ToArray() Dim oItems = Receivers.Select(AddressOf CreateBarItem).ToArray()
PopupMenu1.AddItems(oItems) PopupMenu1.AddItems(oItems)
Controller = New FieldEditorController(State) Controller = New FieldEditorController(State, Document)
End Sub End Sub
Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem
@ -88,11 +88,14 @@ Partial Public Class frmFieldEditor
Private Sub Viewer_AnnotationAddedByUser(AnnotationIdx As Integer) Private Sub Viewer_AnnotationAddedByUser(AnnotationIdx As Integer)
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(AnnotationIdx) Dim oAnnotation = GDViewer.GetAnnotationFromIdx(AnnotationIdx)
Dim oPage = GDViewer.CurrentPage
Dim oTag = $"{oPage}|{AnnotationIdx}"
If TypeOf oAnnotation Is AnnotationStickyNote Then If TypeOf oAnnotation Is AnnotationStickyNote Then
Dim oStickyNote As AnnotationStickyNote = oAnnotation Dim oStickyNote As AnnotationStickyNote = oAnnotation
oStickyNote.Width = 1 oStickyNote.Width = 1
oStickyNote.Height = 1 oStickyNote.Height = 1
oStickyNote.Tag = oTag
ApplyAnnotationStyle(oAnnotation) ApplyAnnotationStyle(oAnnotation)
End If End If
@ -102,54 +105,38 @@ Partial Public Class frmFieldEditor
oAnnotation.CanResize = False oAnnotation.CanResize = False
End Sub End Sub
Private Sub Viewer_BeforeAnnotationAddedByUser(AnnotationIdx As Integer) Private Sub Viewer_BeforeAnnotationAddedByUser(AnnotationIdx As Integer)
'NOOP 'NOOP
End Sub End Sub
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick Private Sub btnSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick
Dim oPageCount = GDViewer.PageCount
Dim oCurrentPage = GDViewer.CurrentPage
'TODO: Save Annotations in Background
For index = 1 To oPageCount
GDViewer.DisplayPage(index)
Dim oAnnotationCount = GDViewer.GetAnnotationCount() Dim oAnnotationCount = GDViewer.GetAnnotationCount()
Dim oElements As New List(Of EnvelopeDocumentElement)
' TODO: Annotationen mit den ElementObjekten verknüpfen, um doppelte Sätze zu verhindern
For index = 0 To oAnnotationCount - 1
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(index)
For index1 = 0 To oAnnotationCount - 1
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(index1)
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, SelectedReceiver.Id)
Dim oWidth = InchToPixel(oStickyNote.Width)
Dim oHeight = InchToPixel(oStickyNote.Height)
Dim oTop = InchToPixel(oStickyNote.Top)
Dim oLeft = InchToPixel(oStickyNote.Left)
Dim oElement As New EnvelopeDocumentElement() With {
.ElementType = Constants.ElementType.Signature.ToString,
.Height = oHeight,
.Width = oWidth,
.X = oLeft,
.Y = oTop,
.DocumentId = Document.Id,
.ReceiverId = SelectedReceiver.Id
}
oElements.Add(oElement)
End If End If
Next Next
Next
If Not Controller.SaveElements(oElements) Then If Not Controller.SaveElements() Then
MsgBox("Element konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text) MsgBox("Element konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
End If End If
GDViewer.DisplayPage(oCurrentPage)
End Sub End Sub
Private Function InchToPixel(pInch As Single) As Single
Return pInch * 96
End Function
Private Function PixelToInch(pPixel As Single) As Single
Return pPixel / 96
End Function
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

View File

@ -21,30 +21,35 @@ Partial Class frmMain
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))
Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.RibbonControl = New DevExpress.XtraBars.Ribbon.RibbonControl()
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() Me.btnCreateEnvelope = 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()
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.RibbonControl, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridEnvelopes, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.ViewEnvelopes, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout() Me.SuspendLayout()
' '
'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.BarButtonItem1}) Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.btnCreateEnvelope, Me.btnEditEnvelope})
Me.RibbonControl.Location = New System.Drawing.Point(0, 0) Me.RibbonControl.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl.MaxItemId = 2 Me.RibbonControl.MaxItemId = 3
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)
Me.RibbonControl.StatusBar = Me.RibbonStatusBar Me.RibbonControl.StatusBar = Me.RibbonStatusBar
' '
'BarButtonItem1 'btnCreateEnvelope
' '
Me.BarButtonItem1.Caption = "Neuer Umschlag" Me.btnCreateEnvelope.Caption = "Neuer Umschlag"
Me.BarButtonItem1.Id = 1 Me.btnCreateEnvelope.Id = 1
Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.btnCreateEnvelope.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.BarButtonItem1.Name = "BarButtonItem1" Me.btnCreateEnvelope.Name = "btnCreateEnvelope"
' '
'RibbonPage1 'RibbonPage1
' '
@ -54,7 +59,8 @@ Partial Class frmMain
' '
'RibbonPageGroup1 'RibbonPageGroup1
' '
Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem1) Me.RibbonPageGroup1.ItemLinks.Add(Me.btnCreateEnvelope)
Me.RibbonPageGroup1.ItemLinks.Add(Me.btnEditEnvelope)
Me.RibbonPageGroup1.Name = "RibbonPageGroup1" Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
Me.RibbonPageGroup1.Text = "RibbonPageGroup1" Me.RibbonPageGroup1.Text = "RibbonPageGroup1"
' '
@ -65,11 +71,35 @@ Partial Class frmMain
Me.RibbonStatusBar.Ribbon = Me.RibbonControl Me.RibbonStatusBar.Ribbon = Me.RibbonControl
Me.RibbonStatusBar.Size = New System.Drawing.Size(1088, 24) Me.RibbonStatusBar.Size = New System.Drawing.Size(1088, 24)
' '
'GridEnvelopes
'
Me.GridEnvelopes.Dock = System.Windows.Forms.DockStyle.Fill
Me.GridEnvelopes.Location = New System.Drawing.Point(0, 158)
Me.GridEnvelopes.MainView = Me.ViewEnvelopes
Me.GridEnvelopes.MenuManager = Me.RibbonControl
Me.GridEnvelopes.Name = "GridEnvelopes"
Me.GridEnvelopes.Size = New System.Drawing.Size(1088, 499)
Me.GridEnvelopes.TabIndex = 2
Me.GridEnvelopes.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ViewEnvelopes})
'
'ViewEnvelopes
'
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 'frmMain
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1088, 681) Me.ClientSize = New System.Drawing.Size(1088, 681)
Me.Controls.Add(Me.GridEnvelopes)
Me.Controls.Add(Me.RibbonStatusBar) Me.Controls.Add(Me.RibbonStatusBar)
Me.Controls.Add(Me.RibbonControl) Me.Controls.Add(Me.RibbonControl)
Me.Name = "frmMain" Me.Name = "frmMain"
@ -77,6 +107,8 @@ Partial Class frmMain
Me.StatusBar = Me.RibbonStatusBar Me.StatusBar = Me.RibbonStatusBar
Me.Text = "frmMain" Me.Text = "frmMain"
CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridEnvelopes, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.ViewEnvelopes, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
@ -86,6 +118,8 @@ Partial Class frmMain
Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage
Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents RibbonStatusBar As DevExpress.XtraBars.Ribbon.RibbonStatusBar Friend WithEvents RibbonStatusBar As DevExpress.XtraBars.Ribbon.RibbonStatusBar
Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem Friend WithEvents btnCreateEnvelope As DevExpress.XtraBars.BarButtonItem
Friend WithEvents GridEnvelopes As DevExpress.XtraGrid.GridControl
Friend WithEvents ViewEnvelopes As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents btnEditEnvelope As DevExpress.XtraBars.BarButtonItem
End Class End Class

View File

@ -135,6 +135,24 @@
Y2xhc3M9IlllbGxvdyIgLz4NCiAgICA8cGF0aCBkPSJNMTYsMTguM0w0LDExLjRWMjNjMCwwLjUsMC41 Y2xhc3M9IlllbGxvdyIgLz4NCiAgICA8cGF0aCBkPSJNMTYsMTguM0w0LDExLjRWMjNjMCwwLjUsMC41
LDEsMSwxaDIyYzAuNSwwLDEtMC41LDEtMVYxMS40TDE2LDE4LjN6IiBjbGFzcz0iWWVsbG93IiAvPg0K LDEsMSwxaDIyYzAuNSwwLDEtMC41LDEtMVYxMS40TDE2LDE4LjN6IiBjbGFzcz0iWWVsbG93IiAvPg0K
ICA8L2c+DQo8L3N2Zz4L 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">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjIxLjIsIFZlcnNpb249MjEuMi40
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAHECAAAC77u/
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh
Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg
MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsdWV7ZmlsbDojMTE3N0Q3O30KCS5Z
ZWxsb3d7ZmlsbDojRkZCMTE1O30KCS5CbGFja3tmaWxsOiM3MjcyNzI7fQoJLkdyZWVue2ZpbGw6IzAz
OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9Cgkuc3Qwe29wYWNpdHk6MC43NTt9Cgkuc3Qxe29wYWNp
dHk6MC41O30KPC9zdHlsZT4NCiAgPGcgaWQ9IkVudmVsb3BlT3BlbiI+DQogICAgPHBhdGggZD0iTTE2
LDRMNCwxMnYxNWMwLDAuNSwwLjUsMSwxLDFoMjJjMC41LDAsMS0wLjUsMS0xVjEyTDE2LDR6IE0yNiwx
My4xbC0xMCw2LjdMNiwxMy4xdjBsMTAtNi43TDI2LDEzLjEgICBMMjYsMTMuMXoiIGNsYXNzPSJZZWxs
b3ciIC8+DQogIDwvZz4NCjwvc3ZnPgs=
</value> </value>
</data> </data>
</root> </root>

View File

@ -11,7 +11,8 @@ Public Class frmMain
Private ConfigManager As ConfigManager(Of Config) Private ConfigManager As ConfigManager(Of Config)
Private DbConfig As DbConfig Private DbConfig As DbConfig
Private UserId As Integer = 0 Private State As State
Private Controller As EnvelopeListController
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oLogPath = IO.Path.Combine(Application.LocalUserAppDataPath, "Log") Dim oLogPath = IO.Path.Combine(Application.LocalUserAppDataPath, "Log")
@ -22,14 +23,26 @@ Public Class frmMain
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath) ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath)
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString) Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
Database = New MSSQLServer(LogConfig, oConnectionString) Database = New MSSQLServer(LogConfig, oConnectionString)
Dim oUserId = 0
If Database.DBInitialized = True Then If Database.DBInitialized = True Then
DbConfig = GetDatabaseConfig() DbConfig = GetDatabaseConfig()
Dim oUserId = Database.GetScalarValue($"SELECT GUID FROM TBDD_USER WHERE USERNAME = '{Environment.UserName}'") oUserId = Database.GetScalarValue($"SELECT GUID FROM TBDD_USER WHERE USERNAME = '{Environment.UserName}'")
UserId = CInt(oUserId)
End If End If
State = New State With {
.UserId = CInt(oUserId),
.Config = ConfigManager.Config,
.DbConfig = DbConfig,
.LogConfig = LogConfig,
.Database = Database
}
Controller = New EnvelopeListController(State)
GridEnvelopes.DataSource = Controller.ListEnvelopes()
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
End Try End Try
@ -50,16 +63,17 @@ Public Class frmMain
End Try End Try
End Function End Function
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick
Dim oForm As New frmEnvelopeEditor() With { Dim oForm As New frmEnvelopeEditor() With {.State = State}
.State = New State With {
.UserId = UserId,
.Config = ConfigManager.Config,
.DbConfig = DbConfig,
.LogConfig = LogConfig,
.Database = Database
}
}
oForm.ShowDialog() oForm.ShowDialog()
End Sub End Sub
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))
Dim oForm As New frmEnvelopeEditor() With {.State = State, .Envelope = oEnvelope}
oForm.ShowDialog()
End If
End Sub
End Class End Class