Entfernen unnötige try-catch-Anweisungen.
This commit is contained in:
parent
419f421d52
commit
dbb745338c
@ -39,25 +39,7 @@ Public Class ReceiverModel
|
|||||||
}
|
}
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function ToReceiver(pTable As DataTable) As Receiver
|
|
||||||
Return pTable?.Rows.Cast(Of DataRow).
|
|
||||||
Select(AddressOf ToReceiver).
|
|
||||||
Single()
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function TestReceiverExists(pReceiver As Receiver) As Boolean
|
|
||||||
Try
|
|
||||||
Dim oGuid = Database.GetScalarValue($"SELECT COALESCE(GUID, 0) FROM TBSIG_RECEIVER WHERE EMAIL_ADDRESS = '{pReceiver.EmailAddress}'")
|
|
||||||
pReceiver.Id = oGuid
|
|
||||||
Return oGuid > 0
|
|
||||||
Catch ex As Exception
|
|
||||||
Logger.Error(ex)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Function Insert(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
Public Function Insert(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
||||||
Try
|
|
||||||
Dim oSignature As String = pReceiver.GetSignature()
|
Dim oSignature As String = pReceiver.GetSignature()
|
||||||
Dim oCheck = $"SELECT COUNT(GUID) FROM [dbo].[TBSIG_RECEIVER] WHERE SIGNATURE = '{oSignature}'"
|
Dim oCheck = $"SELECT COUNT(GUID) FROM [dbo].[TBSIG_RECEIVER] WHERE SIGNATURE = '{oSignature}'"
|
||||||
Dim oExists = Database.GetScalarValue(oCheck)
|
Dim oExists = Database.GetScalarValue(oCheck)
|
||||||
@ -82,10 +64,6 @@ Public Class ReceiverModel
|
|||||||
Logger.Warn($"Receiver [{pReceiver.EmailAddress}] already existing! SignatureID: {oSignature} Check SQL {oCheck}")
|
Logger.Warn($"Receiver [{pReceiver.EmailAddress}] already existing! SignatureID: {oSignature} Check SQL {oCheck}")
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
|
||||||
Logger.Error(ex)
|
|
||||||
Return False
|
|
||||||
End Try
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function Update(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
Public Function Update(pReceiver As Receiver, pTransaction As SqlTransaction) As Boolean
|
||||||
|
|||||||
@ -286,9 +286,7 @@ Public Class EnvelopeEditorController
|
|||||||
Dim oTransaction = oConnection.BeginTransaction()
|
Dim oTransaction = oConnection.BeginTransaction()
|
||||||
|
|
||||||
Try
|
Try
|
||||||
If InsertReceivers(pNewReceivers, oTransaction) = False Then
|
InsertReceivers(pNewReceivers, oTransaction)
|
||||||
Throw New ApplicationException("Could not insert receivers!")
|
|
||||||
End If
|
|
||||||
|
|
||||||
oTransaction.Commit()
|
oTransaction.Commit()
|
||||||
|
|
||||||
@ -382,17 +380,15 @@ Public Class EnvelopeEditorController
|
|||||||
Return ElementModel.ElementsExist(Envelope.Id, pReceiverId)
|
Return ElementModel.ElementsExist(Envelope.Id, pReceiverId)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function InsertReceivers(pReceivers As List(Of Receiver), pTransaction As SqlTransaction) As Boolean
|
Private Sub InsertReceivers(pReceivers As List(Of Receiver), pTransaction As SqlTransaction)
|
||||||
Try
|
Dim status = pReceivers.
|
||||||
Return pReceivers.
|
|
||||||
Select(Function(r) InsertReceiver(r, pTransaction)).
|
Select(Function(r) InsertReceiver(r, pTransaction)).
|
||||||
All(Function(pResult) pResult = True)
|
All(Function(pResult) pResult = True)
|
||||||
|
|
||||||
Catch ex As Exception
|
If Not status Then
|
||||||
Logger.Error(ex)
|
Throw New ApplicationException("Could not insert receivers!")
|
||||||
Return False
|
End If
|
||||||
End Try
|
End Sub
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function AssignReceivers(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
|
Private Function AssignReceivers(pEnvelope As Envelope, pTransaction As SqlTransaction) As Boolean
|
||||||
If ReceiverModel.Unassign(pEnvelope, pTransaction) = False Then
|
If ReceiverModel.Unassign(pEnvelope, pTransaction) = False Then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user