refactor(CommonServices): updated to use ReveiverVM
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports System.Net.Mail
|
||||
Imports DevExpress.DataProcessing
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports EnvelopeGenerator.CommonServices.EnvelopeGenerator.Domain.Entities
|
||||
Imports EnvelopeGenerator.Domain.Constants
|
||||
Imports EnvelopeGenerator.Domain.Entities
|
||||
|
||||
@@ -12,7 +13,7 @@ Public Class ReceiverModel
|
||||
MyBase.New(pState)
|
||||
End Sub
|
||||
|
||||
Private Function ToReceiver(pRow As DataRow, pColorIndex As Integer) As Receiver
|
||||
Private Function ToReceiver(pRow As DataRow, pColorIndex As Integer) As ReceiverVM
|
||||
Dim EmailAdress As String = pRow.ItemEx("EMAIL_ADDRESS", "")
|
||||
Dim EnvelopeId As Integer = pRow.ItemEx("ENVELOPE_ID", 0)
|
||||
Dim SignedDate As DateTime = DateTime.MinValue
|
||||
@@ -25,7 +26,7 @@ Public Class ReceiverModel
|
||||
End If
|
||||
End If
|
||||
|
||||
Return New Receiver() With {
|
||||
Return New ReceiverVM() With {
|
||||
.Id = pRow.ItemEx("GUID", 0),
|
||||
.EmailAddress = pRow.ItemEx("EMAIL_ADDRESS", ""),
|
||||
.Name = pRow.ItemEx("NAME", ""),
|
||||
@@ -66,28 +67,6 @@ Public Class ReceiverModel
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function Update(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
||||
Try
|
||||
Dim oSql As String = $"UPDATE [dbo].[TBSIG_USER_RECEIVER]
|
||||
SET [NAME] = '{pReceiver.Name}'
|
||||
,[COMPANY_NAME] = '{pReceiver.Company}'
|
||||
,[JOB_TITLE] = '{pReceiver.JobTitle}'
|
||||
WHERE RECEIVER_ID = {pReceiver.Id}"
|
||||
|
||||
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("RECEIVER_ID", SqlDbType.Int).Value = pReceiver.Id
|
||||
'oCommand.Parameters.Add("USER_ID", 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)
|
||||
@@ -97,7 +76,7 @@ Public Class ReceiverModel
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Assign(pEnvelope As Envelope, pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
||||
Public Function Assign(pEnvelope As Envelope, pReceiver As ReceiverVM, pTransaction As SqlTransaction) As Boolean
|
||||
Dim oSql = $"INSERT INTO [dbo].[TBSIG_ENVELOPE_RECEIVER]
|
||||
([ENVELOPE_ID]
|
||||
,[RECEIVER_ID]
|
||||
@@ -132,7 +111,7 @@ Public Class ReceiverModel
|
||||
Return Database.ExecuteNonQuery(oCommand, pTransaction)
|
||||
End Function
|
||||
|
||||
Public Function ListEnvelopeReceivers(pEnvelopeId As Integer) As IEnumerable(Of Receiver)
|
||||
Public Function ListEnvelopeReceivers(pEnvelopeId As Integer) As IEnumerable(Of ReceiverVM)
|
||||
Try
|
||||
Dim oSql = $"SELECT * FROM [dbo].[VWSIG_ENVELOPE_RECEIVERS] WHERE ENVELOPE_ID = {pEnvelopeId}"
|
||||
Dim oTable = Database.GetDatatable(oSql)
|
||||
|
||||
Reference in New Issue
Block a user