SQL-Abfragen in Models verschoben
User Model neu
This commit is contained in:
parent
462bf4a61f
commit
73149e2101
@ -14,4 +14,8 @@
|
||||
Created = 0
|
||||
End Enum
|
||||
|
||||
Public Enum HistoryStatus
|
||||
Created = 0
|
||||
End Enum
|
||||
|
||||
End Class
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
Public Class Envelope
|
||||
Public Property Id As Integer = 0
|
||||
Public Property UserId As Integer
|
||||
Public Property Status As Constants.EnvelopeStatus
|
||||
Public Property Uuid As String = Guid.NewGuid.ToString()
|
||||
Public Property Subject As String
|
||||
Public Property Message As String
|
||||
Public Property UserId As Integer
|
||||
Public Property Uuid As String = Guid.NewGuid.ToString()
|
||||
Public Property Status As Constants.EnvelopeStatus
|
||||
Public Property AddedWhen As DateTime
|
||||
Public Property User As New User()
|
||||
|
||||
Public Property Documents As New List(Of EnvelopeDocument)
|
||||
Public Property Receivers As New List(Of EnvelopeReceiver)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Public Class EnvelopeHistoryEntry
|
||||
Public EnvelopeId As Integer
|
||||
Public Status As Constants.EnvelopeStatus
|
||||
Public Status As Constants.HistoryStatus
|
||||
Public UserEmailAddress As String
|
||||
Public ActionTitle As String
|
||||
Public ActionDescription As String
|
||||
|
||||
9
EnvelopeGenerator.Common/Entities/User.vb
Normal file
9
EnvelopeGenerator.Common/Entities/User.vb
Normal file
@ -0,0 +1,9 @@
|
||||
Public Class User
|
||||
Public Property Id As Integer = 0
|
||||
Public Property Prename As String
|
||||
Public Property Name As String
|
||||
Public Property Username As String
|
||||
Public Property Email As String
|
||||
Public Property Language As String
|
||||
|
||||
End Class
|
||||
@ -101,12 +101,14 @@
|
||||
<Compile Include="Entities\EnvelopeHistoryEntry.vb" />
|
||||
<Compile Include="Entities\EnvelopeReceiver.vb" />
|
||||
<Compile Include="Entities\State.vb" />
|
||||
<Compile Include="Entities\User.vb" />
|
||||
<Compile Include="Models\BaseModel.vb" />
|
||||
<Compile Include="Models\DocumentModel.vb" />
|
||||
<Compile Include="Models\ElementModel.vb" />
|
||||
<Compile Include="Models\EnvelopeModel.vb" />
|
||||
<Compile Include="Models\HistoryModel.vb" />
|
||||
<Compile Include="Models\ReceiverModel.vb" />
|
||||
<Compile Include="Models\UserModel.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Transactions
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports EnvelopeGenerator.Common.My.Resources
|
||||
|
||||
Public Class DocumentModel
|
||||
Inherits BaseModel
|
||||
|
||||
@ -30,4 +34,44 @@ Public Class DocumentModel
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Insert(pEnvelope As Envelope, pDocument As EnvelopeDocument, pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_DOCUMENT]
|
||||
([FILENAME]
|
||||
,[FILEPATH]
|
||||
,[ENVELOPE_ID])
|
||||
VALUES
|
||||
(@FILENAME
|
||||
,@FILEPATH
|
||||
,@ENVELOPE_ID)"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("FILENAME", SqlDbType.NVarChar).Value = pDocument.Filename
|
||||
oCommand.Parameters.Add("FILEPATH", SqlDbType.NVarChar).Value = pDocument.Filepath
|
||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pEnvelope.Id
|
||||
|
||||
If Database.ExecuteNonQuery(oCommand, pTransaction) Then
|
||||
pDocument.EnvelopeId = pEnvelope.Id
|
||||
pDocument.Id = GetDocumentId(pDocument.Filename, pEnvelope, pTransaction)
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetDocumentId(pFilename As String, pEnvelope As Envelope, pTransaction As SqlTransaction) As Integer
|
||||
Try
|
||||
Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_ENVELOPE_DOCUMENT WHERE FILENAME = '{pFilename}' AND ENVELOPE_ID = {pEnvelope.Id}", pTransaction)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Base
|
||||
|
||||
Public Class ElementModel
|
||||
@ -53,4 +54,104 @@ Public Class ElementModel
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Insert(pElement As EnvelopeDocumentElement) As Boolean
|
||||
Try
|
||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]
|
||||
([DOCUMENT_ID]
|
||||
,[RECEIVER_ID]
|
||||
,[ELEMENT_TYPE]
|
||||
,[POSITION_X]
|
||||
,[POSITION_Y]
|
||||
,[WIDTH]
|
||||
,[HEIGHT]
|
||||
,[REQUIRED]
|
||||
,[READ_ONLY]
|
||||
,[STATUS]
|
||||
,[PAGE]
|
||||
,[ANNOTATION_INDEX])
|
||||
VALUES
|
||||
(@DOCUMENT_ID
|
||||
,@RECEIVER_ID
|
||||
,@ELEMENT_TYPE
|
||||
,@POSITION_X
|
||||
,@POSITION_Y
|
||||
,@WIDTH
|
||||
,@HEIGHT
|
||||
,@REQUIRED
|
||||
,@READ_ONLY
|
||||
,@STATUS
|
||||
,@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.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)
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Update(pElement As EnvelopeDocumentElement) As Boolean
|
||||
Try
|
||||
Dim oSql = "UPDATE [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]
|
||||
SET [POSITION_X] = @POSITION_X
|
||||
,[POSITION_Y] = @POSITION_Y
|
||||
,[WIDTH] = @WIDTH
|
||||
,[HEIGHT] = @HEIGHT
|
||||
WHERE GUID = @GUID"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("GUID", SqlDbType.NVarChar).Value = pElement.Id
|
||||
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)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetElementId(pElement As EnvelopeDocumentElement) As Integer
|
||||
Try
|
||||
Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT
|
||||
WHERE DOCUMENT_ID = {pElement.DocumentId} AND RECEIVER_ID = {pElement.ReceiverId}")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function DeleteElement(pElement As EnvelopeDocumentElement) As Boolean
|
||||
Try
|
||||
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT WHERE GUID = {pElement.Id}"
|
||||
Return Database.ExecuteNonQuery(oSql)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports System.Data
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class EnvelopeModel
|
||||
Inherits BaseModel
|
||||
@ -17,7 +16,8 @@ Public Class EnvelopeModel
|
||||
.Subject = pRow.ItemEx("SUBJECT", ""),
|
||||
.Message = pRow.ItemEx("MESSAGE", ""),
|
||||
.UserId = State.UserId,
|
||||
.Status = ObjectEx.ToEnum(Of Constants.EnvelopeStatus)(pRow.ItemEx("STATUS", "Created"))
|
||||
.Status = ObjectEx.ToEnum(Of Constants.EnvelopeStatus)(pRow.ItemEx("STATUS", "Created")),
|
||||
.User = New User()
|
||||
}
|
||||
|
||||
Return oEnvelope
|
||||
@ -49,6 +49,7 @@ Public Class EnvelopeModel
|
||||
|
||||
If Database.ExecuteNonQuery(oCommand) Then
|
||||
pEnvelope.Id = GetEnvelopeId(pEnvelope)
|
||||
SetEnvelopeDate(pEnvelope) 'TODO JJ fragen
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
@ -99,4 +100,14 @@ Public Class EnvelopeModel
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub SetEnvelopeDate(pEnvelope As Envelope)
|
||||
Try
|
||||
Dim addedWhen As DateTime = Database.GetScalarValue($"SELECT ADDED_WHEN FROM TBSIG_ENVELOPE WHERE GUID = {pEnvelope.Id}")
|
||||
pEnvelope.AddedWhen = addedWhen
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Data.SqlClient
|
||||
|
||||
Public Class HistoryModel
|
||||
Inherits BaseModel
|
||||
|
||||
39
EnvelopeGenerator.Common/Models/UserModel.vb
Normal file
39
EnvelopeGenerator.Common/Models/UserModel.vb
Normal file
@ -0,0 +1,39 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common.My.Resources
|
||||
|
||||
Public Class UserModel
|
||||
Inherits BaseModel
|
||||
|
||||
Public Sub New(pState As State)
|
||||
MyBase.New(pState)
|
||||
End Sub
|
||||
|
||||
Private Function ToUser(pRow As DataRow) As User
|
||||
Dim oUser = New User() With {
|
||||
.Id = pRow.ItemEx("GUID", 0),
|
||||
.Prename = pRow.ItemEx("PRENAME", ""),
|
||||
.Name = pRow.ItemEx("NAME", ""),
|
||||
.Username = pRow.ItemEx("USERNAME", ""),
|
||||
.Email = pRow.ItemEx("EMAIL", ""),
|
||||
.Language = pRow.ItemEx("LANGUAGE", "")
|
||||
}
|
||||
|
||||
Return oUser
|
||||
End Function
|
||||
|
||||
Public Function SelectUser() As User
|
||||
Try
|
||||
Dim oSql = $"SELECT * FROM [dbo].[TBDD_USER] WHERE USER_ID = {State.UserId}"
|
||||
Dim oTable = Database.GetDatatable(oSql)
|
||||
|
||||
Return oTable?.Rows.Cast(Of DataRow).
|
||||
Select(AddressOf ToUser)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@ -1,12 +1,10 @@
|
||||
Imports System.Data.Common
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports System.Runtime.Remoting.Messaging
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common
|
||||
Imports EnvelopeGenerator.Form.My.Resources
|
||||
Imports EnvelopeGenerator.Common.Constants
|
||||
|
||||
Public Class EnvelopeEditorController
|
||||
Inherits BaseClass
|
||||
@ -18,6 +16,8 @@ Public Class EnvelopeEditorController
|
||||
Private DocumentModel As DocumentModel
|
||||
Private ReceiverModel As ReceiverModel
|
||||
Private ElementModel As ElementModel
|
||||
Private HistoryModel As HistoryModel
|
||||
Private UserModel As UserModel
|
||||
|
||||
Public ReadOnly Envelope As Envelope = Nothing
|
||||
|
||||
@ -50,12 +50,26 @@ Public Class EnvelopeEditorController
|
||||
DocumentModel = New DocumentModel(pState)
|
||||
ReceiverModel = New ReceiverModel(pState)
|
||||
ElementModel = New ElementModel(pState)
|
||||
HistoryModel = New HistoryModel(pState)
|
||||
UserModel = New UserModel(pState)
|
||||
End Sub
|
||||
|
||||
#Region "Public"
|
||||
Public Function CreateEnvelope() As Envelope
|
||||
Dim oEnvelope As New Envelope() With {.UserId = State.UserId}
|
||||
Dim oEnvelope As New Envelope() With {
|
||||
.UserId = State.UserId,
|
||||
.User = UserModel.SelectUser()
|
||||
}
|
||||
If EnvelopeModel.Insert(oEnvelope) Then
|
||||
|
||||
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
|
||||
.EnvelopeId = oEnvelope.Id,
|
||||
.Status = HistoryStatus.Created,
|
||||
.ActionTitle = "Envelope erzeugt",
|
||||
.ActionDescription = "Envelope wurde erzeugt",
|
||||
}
|
||||
'TODO .UserEmailAddress = oEnvelope.User.Email ' TODO - fehlt noch
|
||||
|
||||
Return oEnvelope
|
||||
Else
|
||||
Return Nothing
|
||||
@ -182,7 +196,7 @@ Public Class EnvelopeEditorController
|
||||
Try
|
||||
Return pEnvelope.Documents.
|
||||
Where(Function(d) d.Id = 0).
|
||||
Select(Function(d) InsertDocument(pEnvelope, d, pTransaction)).
|
||||
Select(Function(d) DocumentModel.Insert(pEnvelope, d, pTransaction)).
|
||||
All(Function(pResult) pResult = True)
|
||||
|
||||
Catch ex As Exception
|
||||
@ -191,30 +205,6 @@ Public Class EnvelopeEditorController
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function InsertDocument(pEnvelope As Envelope, pDocument As EnvelopeDocument, pTransaction As SqlTransaction) As Boolean
|
||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_DOCUMENT]
|
||||
([FILENAME]
|
||||
,[FILEPATH]
|
||||
,[ENVELOPE_ID])
|
||||
VALUES
|
||||
(@FILENAME
|
||||
,@FILEPATH
|
||||
,@ENVELOPE_ID)"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("FILENAME", SqlDbType.NVarChar).Value = pDocument.Filename
|
||||
oCommand.Parameters.Add("FILEPATH", SqlDbType.NVarChar).Value = pDocument.Filepath
|
||||
oCommand.Parameters.Add("ENVELOPE_ID", SqlDbType.Int).Value = pEnvelope.Id
|
||||
|
||||
If Database.ExecuteNonQuery(oCommand, pTransaction) Then
|
||||
pDocument.EnvelopeId = pEnvelope.Id
|
||||
pDocument.Id = GetDocumentId(pDocument.Filename, pEnvelope, pTransaction)
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function SaveEnvelopeReceivers(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
If pEnvelope.Id = Nothing Then
|
||||
@ -283,23 +273,4 @@ Public Class EnvelopeEditorController
|
||||
End If
|
||||
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
|
||||
|
||||
Private Function GetDocumentId(pFilename As String, pEnvelope As Envelope, pTransaction As SqlTransaction) As Integer
|
||||
Try
|
||||
Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_ENVELOPE_DOCUMENT WHERE FILENAME = '{pFilename}' AND ENVELOPE_ID = {pEnvelope.Id}", pTransaction)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports DevExpress.Utils.CommonDialogs
|
||||
Imports DevExpress.XtraBars.Docking2010.Views.NativeMdi
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports EnvelopeGenerator.Common
|
||||
Imports GdPicture14.Annotations
|
||||
@ -68,70 +65,10 @@ Public Class FieldEditorController
|
||||
Public Function SaveElement(pElement As EnvelopeDocumentElement) As Boolean
|
||||
Try
|
||||
If pElement.Id > 0 Then
|
||||
Dim oSql = "UPDATE [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]
|
||||
SET [POSITION_X] = @POSITION_X
|
||||
,[POSITION_Y] = @POSITION_Y
|
||||
,[WIDTH] = @WIDTH
|
||||
,[HEIGHT] = @HEIGHT
|
||||
WHERE GUID = @GUID"
|
||||
|
||||
Dim oCommand As New SqlCommand(oSql)
|
||||
oCommand.Parameters.Add("GUID", SqlDbType.NVarChar).Value = pElement.Id
|
||||
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)
|
||||
Return ElementModel.Update(pElement)
|
||||
|
||||
Else
|
||||
Dim oSql = "INSERT INTO [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]
|
||||
([DOCUMENT_ID]
|
||||
,[RECEIVER_ID]
|
||||
,[ELEMENT_TYPE]
|
||||
,[POSITION_X]
|
||||
,[POSITION_Y]
|
||||
,[WIDTH]
|
||||
,[HEIGHT]
|
||||
,[REQUIRED]
|
||||
,[READ_ONLY]
|
||||
,[STATUS]
|
||||
,[PAGE]
|
||||
,[ANNOTATION_INDEX])
|
||||
VALUES
|
||||
(@DOCUMENT_ID
|
||||
,@RECEIVER_ID
|
||||
,@ELEMENT_TYPE
|
||||
,@POSITION_X
|
||||
,@POSITION_Y
|
||||
,@WIDTH
|
||||
,@HEIGHT
|
||||
,@REQUIRED
|
||||
,@READ_ONLY
|
||||
,@STATUS
|
||||
,@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.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)
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Return ElementModel.Insert(pElement)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
@ -139,24 +76,4 @@ Public Class FieldEditorController
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function DeleteElement(pElement As EnvelopeDocumentElement) As Boolean
|
||||
Try
|
||||
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT WHERE GUID = {pElement.Id}"
|
||||
Return Database.ExecuteNonQuery(oSql)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetElementId(pElement As EnvelopeDocumentElement) As Integer
|
||||
Try
|
||||
Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT
|
||||
WHERE DOCUMENT_ID = {pElement.DocumentId} AND RECEIVER_ID = {pElement.ReceiverId}")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common
|
||||
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Text
|
||||
Imports DevExpress.Utils.Svg
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common
|
||||
Imports GdPicture14
|
||||
|
||||
@ -73,7 +73,7 @@ Public Class frmMain
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick
|
||||
Private Sub btnCreateEnvelope_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateEnvelope.ItemClick
|
||||
Dim oForm As New frmEnvelopeEditor() With {.State = State}
|
||||
oForm.ShowDialog()
|
||||
End Sub
|
||||
@ -99,7 +99,4 @@ Public Class frmMain
|
||||
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