02.08.2023
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user