This commit is contained in:
2023-03-22 15:46:32 +01:00
parent 60c739833f
commit 9a9fe72b4f
13 changed files with 1818 additions and 396 deletions

View File

@@ -97,8 +97,7 @@ Public Class frmDocRecordLink
End Try
Load_DocGrid_Layout()
tsslbl.Text = "Waiting for record-Selection....."
tsslbl.BackColor = Color.Transparent
bsiInfo.Caption = "Waiting for record-Selection....."
End Sub
Private Function GetENTITIES() As DataTable
Try
@@ -112,7 +111,72 @@ Public Class frmDocRecordLink
End Try
End Function
Private Sub btnLink_Click(sender As Object, e As EventArgs) Handles btnLink.Click
Private Sub grvwGrid_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles grvwGrid.FocusedRowChanged
Try
If Not IsNothing(dgEntityRecords.DataSource) Then
Dim RecordId As Integer = grvwGrid.GetFocusedRowCellValue(grvwGrid.Columns("Record-ID"))
bsiInfo.Caption = "Record (" & RecordId.ToString & ") selected!"
End If
Catch ex As Exception
MsgBox("Could not get the RecordID: " & ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub
Sub Save_DocGrid_Layout()
Try
Dim XMLPath = Get_DocGrid_Layout_Filename()
grvwGrid.SaveLayoutToXml(XMLPath)
bsiInfo.Caption = "Grid-Layout saved - " + Now.ToShortTimeString
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Save_DocGrid_Layout", ex.Message, ex.StackTrace)
End Try
End Sub
Sub Load_DocGrid_Layout()
Try
Dim XMLPath = Get_DocGrid_Layout_Filename()
If File.Exists(XMLPath) Then
grvwGrid.RestoreLayoutFromXml(XMLPath)
grvwGrid.GuessAutoFilterRowValuesFromFilter()
bsiInfo.Caption = "Grid-Layout loaded - " + Now.ToShortTimeString
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Load_DocGrid_Layout", ex.Message, ex.StackTrace)
End Try
End Sub
Private Function Get_DocGrid_Layout_Filename()
Dim Filename As String = String.Format("GridViewDocRecordLink-{0}-UserLayout.xml", CURRENT_ENTITY_ID)
Return System.IO.Path.Combine(Application.UserAppDataPath(), Filename)
End Function
Private Sub frmDocRecordLink_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If ENTITY_LOAD_ACTIVE = False Then Save_DocGrid_Layout()
End Sub
Private Sub btnloadData2Entity_Click(sender As Object, e As EventArgs) Handles btnloadData2Entity.Click
Dim entity As ClassEntity = DirectCast(cmbConstructorForms.SelectedItem, ClassEntity)
Me.Cursor = Cursors.WaitCursor
If cmbConstructorForms.SelectedIndex <> -1 Then
ENTITY_LOAD_ACTIVE = True
Save_DocGrid_Layout()
Dim ResultSQL, ResultViewName As String
LOGGER.Debug("GridType = Grid", False)
ResultViewName = $"VWPMO_ENTITY_TABLE{entity.id}"
ResultSQL = $"SELECT T.* FROM {ResultViewName} T"
txtEntity.Text = cmbConstructorForms.Text
LOGGER.Debug("ResultSQL: " & ResultSQL, False)
Me.Cursor = Cursors.WaitCursor
Dim DT_RESULT = clsDatabase.Return_Datatable(ResultSQL, True)
If Not IsNothing(DT_RESULT) Then
Refresh_Grid_Data(False, DT_RESULT, entity.id)
End If
End If
Me.Cursor = Cursors.Default
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
If clsWindream.Create_Session = False Then
MsgBox("No session to windream created! Check Your connection!", MsgBoxStyle.Critical)
Exit Sub
@@ -145,8 +209,7 @@ Public Class frmDocRecordLink
If USER_LANGUAGE <> "de-DE" Then
msg = "The record was successfully linked"
End If
tsslbl.Text = msg
tsslbl.BackColor = Color.Yellow
bsiInfo.Caption = msg
ClassHelper.InsertEssential_Log(CURRENT_DOC_ID, "DOC-ID", "FILE LINK CREATED FOR RECORD: " & SELECTED_RECORDID.ToString)
End If
Dim sql = String.Format("SELECT * FROM TBPMO_WD_OBJECTTYPE WHERE OBJECT_TYPE = '{0}'", _objecttype)
@@ -184,64 +247,7 @@ Public Class frmDocRecordLink
grvwGrid.ClearSelection()
End Sub
Private Sub grvwGrid_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles grvwGrid.FocusedRowChanged
Try
If Not IsNothing(dgEntityRecords.DataSource) Then
Dim RecordId As Integer = grvwGrid.GetFocusedRowCellValue(grvwGrid.Columns("Record-ID"))
tsslbl.Text = "Record (" & RecordId.ToString & ") selected!"
End If
Catch ex As Exception
MsgBox("Could not get the RecordID: " & ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub
Sub Save_DocGrid_Layout()
Try
Dim XMLPath = Get_DocGrid_Layout_Filename()
grvwGrid.SaveLayoutToXml(XMLPath)
' Update_Status_Label(True, "Grid Layout Loaded")
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Save_DocGrid_Layout", ex.Message, ex.StackTrace)
End Try
End Sub
Sub Load_DocGrid_Layout()
Try
Dim XMLPath = Get_DocGrid_Layout_Filename()
If File.Exists(XMLPath) Then
grvwGrid.RestoreLayoutFromXml(XMLPath)
grvwGrid.GuessAutoFilterRowValuesFromFilter()
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Load_DocGrid_Layout", ex.Message, ex.StackTrace)
End Try
End Sub
Private Function Get_DocGrid_Layout_Filename()
Dim Filename As String = String.Format("GridViewDocRecordLink-{0}-UserLayout.xml", CURRENT_ENTITY_ID)
Return System.IO.Path.Combine(Application.UserAppDataPath(), Filename)
End Function
Private Sub frmDocRecordLink_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If ENTITY_LOAD_ACTIVE = False Then Save_DocGrid_Layout()
End Sub
Private Sub btnloadData2Entity_Click(sender As Object, e As EventArgs) Handles btnloadData2Entity.Click
Dim entity As ClassEntity = DirectCast(cmbConstructorForms.SelectedItem, ClassEntity)
If cmbConstructorForms.SelectedIndex <> -1 Then
ENTITY_LOAD_ACTIVE = True
Save_DocGrid_Layout()
Dim ResultSQL, ResultViewName As String
LOGGER.Debug("GridType = Grid", False)
ResultViewName = $"VWPMO_ENTITY_TABLE{entity.id}"
ResultSQL = $"SELECT T.* FROM {ResultViewName} T"
txtEntity.Text = cmbConstructorForms.Text
LOGGER.Debug("ResultSQL: " & ResultSQL, False)
Me.Cursor = Cursors.WaitCursor
Dim DT_RESULT = clsDatabase.Return_Datatable(ResultSQL, True)
If Not IsNothing(DT_RESULT) Then
Refresh_Grid_Data(False, DT_RESULT, entity.id)
End If
Me.Cursor = Cursors.Default
End If
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
Save_DocGrid_Layout()
End Sub
End Class