Refactor Receiver handling to use ReceiverVM
Updated ReceiverModel and EnvelopeEditorController to utilize ReceiverVM instead of Receiver in multiple function signatures. This change enhances the structure and flexibility of receiver data handling. Adjusted related methods in frmEnvelopeEditor to align with the new view model approach.
This commit is contained in:
parent
0a876fe486
commit
bbe93dad45
@ -37,7 +37,7 @@ Public Class ReceiverModel
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Function Insert(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
||||
Public Function Insert(pReceiver As ReceiverVM, pTransaction As SqlTransaction) As Boolean
|
||||
Dim oSignature As String = pReceiver.GetSignature()
|
||||
Dim oCheck = $"SELECT COUNT(GUID) FROM [dbo].[TBSIG_RECEIVER] WHERE SIGNATURE = '{oSignature}'"
|
||||
Dim oExists = Database.GetScalarValue(oCheck)
|
||||
@ -157,7 +157,7 @@ Public Class ReceiverModel
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function ListReceivers(pReceiversFromGrid As List(Of Receiver)) As IEnumerable(Of Receiver)
|
||||
Public Function ListReceivers(pReceiversFromGrid As List(Of ReceiverVM)) As IEnumerable(Of Receiver)
|
||||
Try
|
||||
If pReceiversFromGrid.Count = 0 Then
|
||||
Return New List(Of Receiver)
|
||||
|
||||
@ -90,7 +90,7 @@ Public Class EnvelopeEditorController
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function SaveReceivers(pEnvelope As Envelope, pReceiversFromGrid As List(Of Receiver)) As Boolean
|
||||
Public Function SaveReceivers(pEnvelope As Envelope, pReceiversFromGrid As List(Of ReceiverVM)) As Boolean
|
||||
Dim oExistingReceivers As List(Of Receiver) = ReceiverModel.ListReceivers(pReceiversFromGrid).ToList()
|
||||
Dim oExistingAddresses = oExistingReceivers.Select(Function(r) r.EmailAddress)
|
||||
Logger.Debug($"oExistingReceivers.count: {oExistingReceivers.Count}")
|
||||
@ -277,7 +277,7 @@ Public Class EnvelopeEditorController
|
||||
Return ReceiverModel.ListAllEnvelopeReceiverAddresses(pUserId)
|
||||
End Function
|
||||
|
||||
Public Function CreateNewReceivers(pNewReceivers As List(Of Receiver)) As Boolean
|
||||
Public Function CreateNewReceivers(pNewReceivers As List(Of ReceiverVM)) As Boolean
|
||||
If pNewReceivers.Count = 0 Then
|
||||
Return True
|
||||
End If
|
||||
@ -380,7 +380,7 @@ Public Class EnvelopeEditorController
|
||||
Return ElementModel.ElementsExist(Envelope.Id, pReceiverId)
|
||||
End Function
|
||||
|
||||
Private Sub InsertReceivers(pReceivers As List(Of Receiver), pTransaction As SqlTransaction)
|
||||
Private Sub InsertReceivers(pReceivers As List(Of ReceiverVM), pTransaction As SqlTransaction)
|
||||
Dim status = pReceivers.
|
||||
Select(Function(r) InsertReceiver(r, pTransaction)).
|
||||
All(Function(pResult) pResult = True)
|
||||
@ -401,7 +401,7 @@ Public Class EnvelopeEditorController
|
||||
|
||||
End Function
|
||||
|
||||
Private Function InsertReceiver(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
||||
Private Function InsertReceiver(pReceiver As ReceiverVM, pTransaction As SqlTransaction) As Boolean
|
||||
Return ReceiverModel.Insert(pReceiver, pTransaction)
|
||||
End Function
|
||||
|
||||
|
||||
@ -335,7 +335,7 @@ Partial Public Class frmEnvelopeEditor
|
||||
|
||||
|
||||
|
||||
If Controller.SaveReceivers(oEnvelope, Receivers.Select(Function(vm) vm.Receiver).ToList()) = False Then
|
||||
If Controller.SaveReceivers(oEnvelope, Receivers.ToList()) = False Then
|
||||
MsgBox(Resources.Envelope.Error_when_saving_the_recipients, MsgBoxStyle.Critical, Text)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user