TaskFlow/app/DD_PM_WINDREAM/frmGhostMode.vb

61 lines
2.7 KiB
VB.net

Public Class frmGhostMode
Private Sub frmGhostMode_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim oSQL = "SELECT CONFIG_VALUE FROM TBIDB_BASE WHERE CONFIG_NAME = 'GHOST_SELECT'"
oSQL = Database_IDB.GetScalarValue(oSQL) ',CONNECTION_STRING_IDB, "frmGhostMode_Load")
Dim DT_USER = Database_ECM.GetDatatable(oSQL) ', "frmGhostMode_LoadDT")
If IsNothing(DT_USER) Then
oSQL = "SELECT [SQL_COMMAND] FROM TBDD_SQL_COMMANDS where TITLE = 'GHOST_SELECT'"
If Not IsNothing(oSQL) Then
oSQL = Database_IDB.GetScalarValue(oSQL) ', CONNECTION_STRING_ECM)
DT_USER = Database_ECM.GetDatatable(oSQL) '(oSQL, "frmGhostMode_LoadDT2")
Else
MsgBox("No SQL for Ghostmode via DD_ECM. Check Your configuration.", MsgBoxStyle.Exclamation)
Exit Sub
End If
End If
Try
If Not IsNothing(DT_USER) Then
GridControl1.DataSource = DT_USER
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
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