19.07.2023
This commit is contained in:
@@ -1,21 +1,51 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports DevExpress.Utils.CommonDialogs
|
||||
Imports DevExpress.XtraBars.Docking2010.Views.NativeMdi
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports GdPicture14.Annotations
|
||||
|
||||
Public Class FieldEditorController
|
||||
Inherits BaseClass
|
||||
|
||||
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)
|
||||
Database = pState.Database
|
||||
Document = pDocument
|
||||
End Sub
|
||||
|
||||
Public Function SaveElements(pElements As IEnumerable(Of EnvelopeDocumentElement)) As Boolean
|
||||
Return pElements.
|
||||
Public Sub AddOrUpdateElement(pAnnotation As AnnotationStickyNote, pReceiverId As Integer)
|
||||
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).
|
||||
All(Function(pResult) pResult = True)
|
||||
End Function
|
||||
@@ -32,10 +62,10 @@ Public Class FieldEditorController
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("GUID", SqlDbType.NVarChar).Value = pElement.Id
|
||||
oCommand.Parameters.Add("POSITION_X", SqlDbType.Int).Value = pElement.X
|
||||
oCommand.Parameters.Add("POSITION_Y", SqlDbType.Int).Value = pElement.Y
|
||||
oCommand.Parameters.Add("WIDTH", SqlDbType.Int).Value = pElement.Width
|
||||
oCommand.Parameters.Add("HEIGHT", SqlDbType.Int).Value = pElement.Height
|
||||
oCommand.Parameters.Add("POSITION_X", SqlDbType.Float).Value = pElement.X
|
||||
oCommand.Parameters.Add("POSITION_Y", SqlDbType.Float).Value = pElement.Y
|
||||
oCommand.Parameters.Add("WIDTH", SqlDbType.Float).Value = pElement.Width
|
||||
oCommand.Parameters.Add("HEIGHT", SqlDbType.Float).Value = pElement.Height
|
||||
|
||||
Return Database.ExecuteNonQuery(oCommand)
|
||||
|
||||
@@ -51,7 +81,8 @@ Public Class FieldEditorController
|
||||
,[REQUIRED]
|
||||
,[READ_ONLY]
|
||||
,[STATUS]
|
||||
,[PAGE])
|
||||
,[PAGE]
|
||||
,[ANNOTATION_INDEX])
|
||||
VALUES
|
||||
(@DOCUMENT_ID
|
||||
,@RECEIVER_ID
|
||||
@@ -63,21 +94,22 @@ Public Class FieldEditorController
|
||||
,@REQUIRED
|
||||
,@READ_ONLY
|
||||
,@STATUS
|
||||
,@PAGE)"
|
||||
,@PAGE
|
||||
,@INDEX)"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("DOCUMENT_ID", SqlDbType.NVarChar).Value = pElement.DocumentId
|
||||
oCommand.Parameters.Add("RECEIVER_ID", SqlDbType.NVarChar).Value = pElement.ReceiverId
|
||||
oCommand.Parameters.Add("ELEMENT_TYPE", SqlDbType.NVarChar).Value = pElement.ElementType
|
||||
oCommand.Parameters.Add("POSITION_X", SqlDbType.Int).Value = pElement.X
|
||||
oCommand.Parameters.Add("POSITION_Y", SqlDbType.Int).Value = pElement.Y
|
||||
oCommand.Parameters.Add("WIDTH", SqlDbType.Int).Value = pElement.Width
|
||||
oCommand.Parameters.Add("HEIGHT", SqlDbType.Int).Value = pElement.Height
|
||||
oCommand.Parameters.Add("POSITION_X", SqlDbType.Float).Value = pElement.X
|
||||
oCommand.Parameters.Add("POSITION_Y", SqlDbType.Float).Value = pElement.Y
|
||||
oCommand.Parameters.Add("WIDTH", SqlDbType.Float).Value = pElement.Width
|
||||
oCommand.Parameters.Add("HEIGHT", SqlDbType.Float).Value = pElement.Height
|
||||
oCommand.Parameters.Add("REQUIRED", SqlDbType.Bit).Value = pElement.Required
|
||||
oCommand.Parameters.Add("READ_ONLY", SqlDbType.Bit).Value = pElement.ReadOnly
|
||||
oCommand.Parameters.Add("STATUS", SqlDbType.NVarChar).Value = pElement.Status.ToString
|
||||
oCommand.Parameters.Add("PAGE", SqlDbType.Int).Value = pElement.Page
|
||||
|
||||
oCommand.Parameters.Add("INDEX", SqlDbType.Int).Value = pElement.AnnotationIndex
|
||||
|
||||
If Database.ExecuteNonQuery(oCommand) Then
|
||||
pElement.Id = GetElementId(pElement)
|
||||
|
||||
Reference in New Issue
Block a user