2025-04-10 17:46:33 +02:00

59 lines
2.3 KiB
VB.net

Public Class frmGhostMode
Private Sub frmGhostMode_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim oSQL = "SELECT T.USERNAME,T.NAME, T.[PRENAME],T.EMAIL FROM TBDD_USER T ORDER BY USERNAME"
Dim DT_USER = DB_DD_ECM.GetDatatable(oSQL)
Try
If Not IsNothing(DT_USER) Then
GridControl1.DataSource = DT_USER
MyLogger.Info($"Received [{DT_USER.Rows.Count}] Ghost-Users to select!")
End If
Catch ex As Exception
MsgBox("Error Load_Users:" & vbNewLine & ex.Message)
End Try
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
Set_GhostUser()
End Sub
Private Sub GridView1_DoubleClick(sender As Object, e As EventArgs) Handles GridView1.DoubleClick
Set_GhostUser()
End Sub
Sub Set_GhostUser()
Dim oFocusedUserName
Try
oFocusedUserName = GridView1.GetFocusedRowCellValue(GridView1.Columns("UserName"))
If IsNothing(oFocusedUserName) Then
oFocusedUserName = GridView1.GetFocusedRowCellValue(GridView1.Columns("USERNAME"))
End If
If IsNothing(oFocusedUserName) Then
oFocusedUserName = GridView1.GetFocusedRowCellValue(GridView1.Columns("USER_NAME"))
End If
If IsNothing(oFocusedUserName) Then
oFocusedUserName = GridView1.GetFocusedRowCellValue(GridView1.Columns("USER"))
End If
Catch ex As Exception
oFocusedUserName = GridView1.GetFocusedRowCellValue(GridView1.Columns("UserName"))
If IsNothing(oFocusedUserName) Then
MsgBox(ex.Message, MsgBoxStyle.Critical)
Exit Sub
End If
End Try
If oFocusedUserName <> String.Empty Then
Dim result As MsgBoxResult = MsgBox("Do You really want to activate the Ghost-Mode?", MsgBoxStyle.YesNo, "")
'wenn Speichern ja
If result = MsgBoxResult.Yes Then
USER_GHOST_MODE_USRNAME = oFocusedUserName
USER_GHOST_MODE_ACTIVE = True
Me.Close()
End If
Else
MsgBox("Please choose an user for ghostmode!", MsgBoxStyle.Information)
End If
End Sub
End Class