Handling InsertReceivers und kleinigkeiten frm Main

This commit is contained in:
Developer01 2025-09-16 09:00:43 +02:00
parent 85e0bc3400
commit 69afea012b
2 changed files with 28 additions and 2 deletions

View File

@ -152,6 +152,9 @@ Public Class ElementModel
pElement.Id = GetElementId(pElement) pElement.Id = GetElementId(pElement)
Return True Return True
Else Else
Dim filledSql As String = GetFilledSql(oCommand)
Logger.Warn(filledSql)
Return False Return False
End If End If
@ -161,6 +164,26 @@ Public Class ElementModel
End Try End Try
End Function End Function
Function GetFilledSql(command As SqlCommand) As String
Dim oSql As String = command.CommandText
For Each oParam As SqlParameter In command.Parameters
Dim oValue As String
If oParam.Value Is Nothing OrElse oParam.Value Is DBNull.Value Then
oValue = "NULL"
ElseIf TypeOf oParam.Value Is String OrElse TypeOf oParam.Value Is Date Then
oValue = $"'{oParam.Value.ToString().Replace("'", "''")}'"
ElseIf TypeOf oParam.Value Is Boolean Then
oValue = If(CBool(oParam.Value), "1", "0")
Else
oValue = oParam.Value.ToString()
End If
oSql = oSql.Replace("@" & oParam.ParameterName, oValue)
Next
Return oSql
End Function
Public Function Update(pElement As DocumentReceiverElement) As Boolean Public Function Update(pElement As DocumentReceiverElement) As Boolean
Try Try
Dim oSql = "UPDATE [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] Dim oSql = "UPDATE [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]

View File

@ -271,7 +271,7 @@ Public Class frmMain
If ViewEnvelopes.FocusedRowHandle < 0 Then If ViewEnvelopes.FocusedRowHandle < 0 Then
Exit Sub Exit Sub
End If End If
sd
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle) Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
txtEnvelopeIdLabel.Caption = String.Format(txtEnvelopeIdLabel.Tag, oEnvelope.Id) txtEnvelopeIdLabel.Caption = String.Format(txtEnvelopeIdLabel.Tag, oEnvelope.Id)
@ -795,6 +795,10 @@ Public Class frmMain
End Sub End Sub
Private Sub bbtnitm2Faktor_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitm2Faktor.ItemClick Private Sub bbtnitm2Faktor_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitm2Faktor.ItemClick
Show_MF_Info
End Sub
Private Sub Show_MF_Info()
If ViewEnvelopes.FocusedRowHandle < 0 Then If ViewEnvelopes.FocusedRowHandle < 0 Then
Exit Sub Exit Sub
End If End If
@ -821,7 +825,6 @@ Public Class frmMain
MsgBox(Resources.Envelope.Please_select_a_recipient_from_the_Recipients_tab, MsgBoxStyle.Information, Text) MsgBox(Resources.Envelope.Please_select_a_recipient_from_the_Recipients_tab, MsgBoxStyle.Information, Text)
End If End If
End Sub End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If txtEnvID.Text = String.Empty Then If txtEnvID.Text = String.Empty Then
Exit Sub Exit Sub