MS
This commit is contained in:
@@ -12,10 +12,10 @@ Public Class frmDocRecordLink
|
||||
End Function
|
||||
End Class
|
||||
Private Function GET_CURRENT_ENTITY_DATA()
|
||||
Dim oDatatabel As DataTable = CURRENT_DT_ENTITY_RECORDS.Copy
|
||||
Return oDatatabel
|
||||
Dim oDatatable As DataTable = CURRENT_DT_ENTITY_RECORDS.Copy
|
||||
Return oDatatable
|
||||
End Function
|
||||
Sub Refresh_Grid_Data(current As Boolean, ENTITY_DATATABLE As DataTable, ENTITY_ID As Integer)
|
||||
Sub Refresh_Grid_Data(current As Boolean, ENTITY_DATATABLE As DataTable)
|
||||
Dim DT_RECORDS As DataTable
|
||||
If current = True Then
|
||||
DT_RECORDS = GET_CURRENT_ENTITY_DATA()
|
||||
@@ -34,7 +34,7 @@ Public Class frmDocRecordLink
|
||||
Try
|
||||
For Each row As DataRow In CURRENT_DT_SELECTED_FILES.Rows
|
||||
Dim DOC_ID = row.Item("DOC_ID")
|
||||
Dim sel = String.Format("select T.RECORD_ID FROM TBPMO_DOC_RECORD_LINK T, TBPMO_RECORD T1 WHERE T.RECORD_ID = T1.GUID AND T1.FORM_ID = {0} AND T.DOC_ID = {1}", ENTITY_ID, DOC_ID)
|
||||
Dim sel = String.Format("select T.RECORD_ID FROM TBPMO_DOC_RECORD_LINK T, TBPMO_RECORD T1 WHERE T.RECORD_ID = T1.GUID AND T1.FORM_ID = {0} AND T.DOC_ID = {1}", CURRENT_LINK_ENTITY_ID, DOC_ID)
|
||||
Dim DTRECS_LINKED As DataTable = clsDatabase.Return_Datatable(sel)
|
||||
For Each recrow As DataRow In DTRECS_LINKED.Rows
|
||||
For Each rowrecsdisplay As DataRow In DT_RECORDS.Rows
|
||||
@@ -58,7 +58,7 @@ Public Class frmDocRecordLink
|
||||
grvwGrid.BestFitColumns()
|
||||
End Sub
|
||||
Private Sub frmDocRecordLink_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Me.txtEntity.Text = CURRENT_ENTITYSTRING
|
||||
ENTITY_LOAD_ACTIVE = True
|
||||
If ClassWindreamDocGrid.DT_RESULTFILES.Rows.Count = 1 Then
|
||||
txtFileInfo.Text = ClassWindreamDocGrid.DT_RESULTFILES.Rows(0).Item("DOC_PATH")
|
||||
Else
|
||||
@@ -68,21 +68,40 @@ Public Class frmDocRecordLink
|
||||
If IsNothing(CURRENT_DT_ENTITY_RECORDS) Then
|
||||
Me.Close()
|
||||
End If
|
||||
Refresh_Grid_Data(True, Nothing, CURRENT_ENTITY_ID)
|
||||
If CURRENT_LINK_ENTITY_ID = 0 Then
|
||||
Refresh_Grid_Data(True, Nothing)
|
||||
CURRENT_LINK_ENTITY_ID = CURRENT_ENTITY_ID
|
||||
Else
|
||||
Dim DT_RESULT As DataTable
|
||||
If CURRENT_LINK_ENTITY_ID = CURRENT_ENTITY_ID Then
|
||||
DT_RESULT = CURRENT_DT_ENTITY_RECORDS
|
||||
Else
|
||||
DT_RESULT = ReturnDataforEntity(CURRENT_LINK_ENTITY_ID)
|
||||
End If
|
||||
|
||||
If Not IsNothing(DT_RESULT) Then
|
||||
Refresh_Grid_Data(False, DT_RESULT)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim DT_ENTITIES As DataTable = GetENTITIES()
|
||||
Dim selected As Integer = 0
|
||||
Dim oSelectedIndex As Integer = 0
|
||||
|
||||
If DT_ENTITIES.Rows.Count = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oCount = 0
|
||||
For Each row As DataRow In DT_ENTITIES.Rows
|
||||
Dim entity As New ClassEntity
|
||||
entity.title = row.Item("FORM_TITLE")
|
||||
entity.id = row.Item("FORM_ID")
|
||||
cmbConstructorForms.Items.Add(entity)
|
||||
|
||||
If CURRENT_LINK_ENTITY_ID = entity.id Then
|
||||
txtcurrSichtData.Text = entity.title
|
||||
oSelectedIndex = oCount
|
||||
End If
|
||||
oCount += 1
|
||||
Next
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
Me.Text = CURRENT_DT_SELECTED_FILES.Rows.Count.ToString & " Datei(en) mit Datensatz verknüpfen:"
|
||||
@@ -90,7 +109,7 @@ Public Class frmDocRecordLink
|
||||
Me.Text = "Link " & CURRENT_DT_SELECTED_FILES.Rows.Count.ToString & " files with record:"
|
||||
End If
|
||||
' Den index der aktuell geöffneten ConstructorForm setzen
|
||||
cmbConstructorForms.SelectedIndex = selected
|
||||
cmbConstructorForms.SelectedIndex = oSelectedIndex
|
||||
|
||||
Catch ex As Exception
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in frmDocRecordLink_Load", ex.Message, ex.StackTrace)
|
||||
@@ -148,7 +167,7 @@ Public Class frmDocRecordLink
|
||||
End Try
|
||||
End Sub
|
||||
Private Function Get_DocGrid_Layout_Filename()
|
||||
Dim Filename As String = String.Format("GridViewDocRecordLink-{0}-UserLayout.xml", CURRENT_ENTITY_ID)
|
||||
Dim Filename As String = String.Format("GridViewDocRecordLink-{0}-UserLayout.xml", CURRENT_LINK_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
|
||||
@@ -161,20 +180,25 @@ Public Class frmDocRecordLink
|
||||
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)
|
||||
Dim DT_RESULT = ReturnDataforEntity(entity.id)
|
||||
If Not IsNothing(DT_RESULT) Then
|
||||
Refresh_Grid_Data(False, DT_RESULT, entity.id)
|
||||
CURRENT_LINK_ENTITY_ID = entity.id
|
||||
txtcurrSichtData.Text = entity.title
|
||||
Refresh_Grid_Data(False, DT_RESULT)
|
||||
End If
|
||||
End If
|
||||
Load_DocGrid_Layout()
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
Private Function ReturnDataforEntity(oEntityID As Integer) As DataTable
|
||||
Dim ResultSQL, ResultViewName As String
|
||||
LOGGER.Debug("GridType = Grid", False)
|
||||
ResultViewName = $"VWPMO_ENTITY_TABLE{oEntityID}"
|
||||
|
||||
ResultSQL = $"SELECT T.* FROM {ResultViewName} T"
|
||||
LOGGER.Debug("ResultSQL: " & ResultSQL, False)
|
||||
Return clsDatabase.Return_Datatable(ResultSQL, True)
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
If clsWindream.Create_Session = False Then
|
||||
@@ -183,7 +207,7 @@ Public Class frmDocRecordLink
|
||||
End If
|
||||
|
||||
Dim selectedRows As Integer() = grvwGrid.GetSelectedRows()
|
||||
Dim i As Integer = 0
|
||||
Dim oLinkCount As Integer = 0
|
||||
For Each rowhandle As Integer In selectedRows
|
||||
Dim SELECTED_RECORDID = grvwGrid.GetRowCellValue(rowhandle, "Record-ID")
|
||||
If IsNothing(SELECTED_RECORDID) Then
|
||||
@@ -211,6 +235,7 @@ Public Class frmDocRecordLink
|
||||
End If
|
||||
bsiInfo.Caption = msg
|
||||
ClassHelper.InsertEssential_Log(CURRENT_DOC_ID, "DOC-ID", "FILE LINK CREATED FOR RECORD: " & SELECTED_RECORDID.ToString)
|
||||
oLinkCount += 1
|
||||
End If
|
||||
Dim sql = String.Format("SELECT * FROM TBPMO_WD_OBJECTTYPE WHERE OBJECT_TYPE = '{0}'", _objecttype)
|
||||
Dim DT_OBJTYPE As DataTable = ClassDatabase.Return_Datatable(sql, True)
|
||||
@@ -240,6 +265,8 @@ Public Class frmDocRecordLink
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
bsiInfo.Caption = $"[{oLinkCount}] records successfully linked - {Now.ToShortTimeString}"
|
||||
|
||||
Catch ex As Exception
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Linking Record to file", ex.Message, ex.StackTrace)
|
||||
End Try
|
||||
@@ -250,4 +277,34 @@ Public Class frmDocRecordLink
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
Save_DocGrid_Layout()
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
|
||||
Reset_View_layout()
|
||||
End Sub
|
||||
Sub Reset_View_layout()
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Try
|
||||
Dim XMLPath = Get_DocGrid_Layout_Filename()
|
||||
If File.Exists(XMLPath) Then
|
||||
|
||||
File.Delete(XMLPath)
|
||||
Refresh_Grid_Data(True, Nothing)
|
||||
Else
|
||||
MsgBox("Resetting the layout was not successful - File not existing!", MsgBoxStyle.Information)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Reset_View_layout: ", ex.Message)
|
||||
End Try
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub grvwGrid_StyleChanged(sender As Object, e As EventArgs) Handles grvwGrid.ColumnPositionChanged, grvwGrid.ColumnWidthChanged
|
||||
If ENTITY_LOAD_ACTIVE = False Then
|
||||
Save_DocGrid_Layout()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub frmDocRecordLink_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
ENTITY_LOAD_ACTIVE = False
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user