Logging bei LoadnewDocument, Errorhandling, Button Reject, Focus nach Lookup

This commit is contained in:
2024-07-03 15:37:31 +02:00
parent d902548ec5
commit cd75a665e6
42 changed files with 4380 additions and 764 deletions

View File

@@ -0,0 +1,90 @@
Imports DigitalData.GUIs.Common
Public Class frmAdmin_notResponsibleConfig
Dim oProfilID As Integer = 0
Dim oCaption As String = ""
Dim oQuestion As String = ""
Dim oNotResponsible_SQL As String
Public Sub New(pProfilID As Integer)
MyBase.New()
oProfilID = pProfilID
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub txtCaption_NotResponsible_TextChanged(sender As Object, e As EventArgs) Handles txtCaption_NotResponsible.TextChanged
If txtCaption_NotResponsible.Text <> String.Empty Then
SimpleButton1.Text = txtCaption_NotResponsible.Text
End If
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
Dim oUpd = $"UPDATE TBPM_PROFILE SET NOT_RESP_SQL = '{oNotResponsible_SQL.Replace("'", "''")}', CHANGED_WHO = '{User.UserName}' WHERE GUID = {oProfilID}"
If DatabaseECM.ExecuteNonQuery(oUpd) = True Then
oUpd = $"EXEC PRDD_GUI_LANGUAGE_PHRASE 'PM','PROFILE_NOT_RESPONSIBLE_QUEST{oProfilID}','{USER_LANGUAGE}','PROFILE_NOT_RESPONSIBLE_QUEST','{txtPROFILE_NOT_RESPONSIBLE_QUEST.Text}','','{USER_USERNAME}','{oProfilID}',0"
If DatabaseECM.ExecuteNonQuery(oUpd) Then
oUpd = $"EXEC PRDD_GUI_LANGUAGE_PHRASE 'PM','PROFILE_REJECTION_CAPT{oProfilID}','{USER_LANGUAGE}','PROFILE_REJECTION_CAPT','{txtCaption_NotResponsible.Text}','','{USER_USERNAME}','{oProfilID}',0"
bstitmInfo.Caption = "Data saved successfully - " + Now.ToString
End If
Else
bstitmInfo.Caption = "Attention: Error storing data - Check Your log"
End If
End Sub
Private Sub frmAdmin_notResponsibleConfig_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
Dim oSQL = $"SELECT NOT_RESP_SQL FROM TBPM_PROFILE WHERE GUID = {oProfilID}"
Dim oDT = DatabaseECM.GetDatatable(oSQL)
oCaption = oDT.Rows(0).Item(0)
oNotResponsible_SQL = oDT.Rows(0).Item(0)
For Each oRow As DataRow In CURRENT_DT_PROFILE_LANGUAGE.Rows
If oRow.Item("TITLE") = $"PROFILE_NOT_RESPONSIBLE_CAPT{oProfilID}" Then
oCaption = oRow.Item("STRING1")
ElseIf oRow.Item("TITLE") = $"PROFILE_NOT_RESPONSIBLE_QUEST{oProfilID}" And oRow.Item("LANGUAGE") = USER_LANGUAGE Then
oQuestion = oRow.Item("STRING1")
End If
Next
txtPROFILE_NOT_RESPONSIBLE_QUEST.Text = oQuestion
txtCaption_NotResponsible.Text = oCaption
Catch ex As Exception
MsgBox("Error in Loading Form: " & vbNewLine & vbNewLine & ex.Message)
End Try
End Sub
Private Sub btnNotResponsibleSQL_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnNotResponsibleSQL.ItemClick
Try
CURRENT_ProfilGUID = oProfilID
CURRENT_DESIGN_TYPE = "SQL_NOT_RESPONSIBLE"
Dim oldSQL = oNotResponsible_SQL
Dim oForm As New frmSQLEditor(LOGCONFIG, DatabaseECM) With {
.SQLCommand = oNotResponsible_SQL,
.SQLConnection = 1,
.PlaceholdersManualPrefix = "CTRL",
.PlaceholdersManualTitle = "Controls",
.PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name)
}
oForm.ShowDialog()
If oForm.DialogResult = DialogResult.OK Then
If oldSQL <> oForm.SQLCommand Then
Dim oResult As MsgBoxResult = MsgBox("Do You want to save the changed NotResponsible-SQL?", MsgBoxStyle.YesNo, ADDITIONAL_TITLE)
'wenn Speichern ja
If oResult = DialogResult.Yes Then
Dim oUpdate As String = $"Update TBPM_PROFILE SET CHANGED_WHO = '{USER_USERNAME}', NOT_RESP_SQL = '{oForm.SQLCommand.Replace("'", "''")}' WHERE GUID = {CURRENT_ProfilGUID}"
If DatabaseFallback.ExecuteNonQueryECM(oUpdate) = True Then
oNotResponsible_SQL = oForm.SQLCommand
bstitmInfo.Caption = $"SQL saved - {Now.ToLongTimeString}"
CHANGES_FORM_DESIGN = True
End If
End If
End If
End If
Catch ex As Exception
MsgBox("Error in Saving Profile SQL: " & vbNewLine & vbNewLine & ex.Message)
End Try
End Sub
End Class