MS Rework
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Imports System.Text
|
||||
Imports DD_LIB_Standards
|
||||
Public Class frmDocRecordLink
|
||||
Private SELECTED_RECORDID
|
||||
|
||||
Private Sub frmDocRecordLink_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If ClassWindreamDocGrid.DT_RESULTFILES.Rows.Count = 1 Then
|
||||
txtFileInfo.Text = ClassWindreamDocGrid.DT_RESULTFILES.Rows(0).Item("DOC_PATH")
|
||||
@@ -10,16 +10,41 @@ Public Class frmDocRecordLink
|
||||
txtFileInfo.Text = String.Format("{0} files selected for linking to record", ClassWindreamDocGrid.DT_RESULTFILES.Rows.Count)
|
||||
End If
|
||||
Try
|
||||
If IsNothing(CURRENT_ENTITY_DT) Then
|
||||
If IsNothing(CURRENT_DT_ENTITY_RECORDS) Then
|
||||
Me.Close()
|
||||
End If
|
||||
dgEntityRecords.DataSource = CURRENT_ENTITY_DT
|
||||
Dim DT_RECORDS As DataTable = CURRENT_DT_ENTITY_RECORDS
|
||||
|
||||
DT_RECORDS.Columns.Add("already linked", Type.GetType("System.Boolean")).SetOrdinal(0)
|
||||
DT_RECORDS.Columns("already linked").DefaultValue = False
|
||||
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}", CURRENT_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
|
||||
If rowrecsdisplay.Item("Record-ID") = recrow.Item("RECORD_ID") Then
|
||||
rowrecsdisplay.Item("file linked") = True
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
Catch ex As Exception
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in displaying already linked", ex.Message, ex.StackTrace)
|
||||
End Try
|
||||
|
||||
dgEntityRecords.DataSource = DT_RECORDS
|
||||
grvwGrid.Columns.Item("already linked").Fixed = True
|
||||
grvwGrid.PopulateColumns()
|
||||
|
||||
|
||||
|
||||
dgEntityRecords.RefreshDataSource()
|
||||
Catch ex As Exception
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in frmDocRecordLink_Load", ex.Message, ex.StackTrace)
|
||||
End Try
|
||||
SELECTED_RECORDID = Nothing
|
||||
|
||||
Load_DocGrid_Layout()
|
||||
tsslbl.Text = "Waiting for record-Selection....."
|
||||
tsslbl.BackColor = Color.Transparent
|
||||
@@ -27,13 +52,17 @@ Public Class frmDocRecordLink
|
||||
|
||||
Private Sub btnLink_Click(sender As Object, e As EventArgs) Handles btnLink.Click
|
||||
If clsWindream.Create_Session = False Then
|
||||
MsgBox("No Seesion to windream created! Check Your connection!", MsgBoxStyle.Critical)
|
||||
MsgBox("No session to windream created! Check Your connection!", MsgBoxStyle.Critical)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not IsNothing(SELECTED_RECORDID) Then
|
||||
tsslbl.Text = ""
|
||||
tsslbl.BackColor = Color.Transparent
|
||||
Dim selectedRows As Integer() = grvwGrid.GetSelectedRows()
|
||||
Dim i As Integer = 0
|
||||
For Each rowhandle As Integer In selectedRows
|
||||
Dim SELECTED_RECORDID = grvwGrid.GetRowCellValue(rowhandle, "Record-ID")
|
||||
If IsNothing(SELECTED_RECORDID) Then
|
||||
Continue For
|
||||
End If
|
||||
Try
|
||||
For Each row As DataRow In CURRENT_DT_SELECTED_FILES.Rows
|
||||
CURRENT_DOC_ID = row.Item("DOC_ID")
|
||||
@@ -86,23 +115,20 @@ Public Class frmDocRecordLink
|
||||
Catch ex As Exception
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Linking Record to file", ex.Message, ex.StackTrace)
|
||||
End Try
|
||||
Else
|
||||
MsgBox("Please choose a record!", MsgBoxStyle.Exclamation)
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
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"))
|
||||
SELECTED_RECORDID = RecordId
|
||||
tsslbl.Text = "Record (" & RecordId.ToString & ") selected!"
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Could not get the RecordID: " & ex.Message, MsgBoxStyle.Exclamation)
|
||||
SELECTED_RECORDID = Nothing
|
||||
End Try
|
||||
'Try
|
||||
' If Not IsNothing(dgEntityRecords.DataSource) Then
|
||||
' Dim RecordId As Integer = grvwGrid.GetFocusedRowCellValue(grvwGrid.Columns("Record-ID"))
|
||||
' SELECTED_RECORDID = RecordId
|
||||
' tsslbl.Text = "Record (" & RecordId.ToString & ") selected!"
|
||||
' End If
|
||||
'Catch ex As Exception
|
||||
' MsgBox("Could not get the RecordID: " & ex.Message, MsgBoxStyle.Exclamation)
|
||||
' SELECTED_RECORDID = Nothing
|
||||
'End Try
|
||||
|
||||
End Sub
|
||||
Sub Save_DocGrid_Layout()
|
||||
|
||||
Reference in New Issue
Block a user