MS Anpassungen Structure Nodes etc
This commit is contained in:
135
app/DD-Record-Organizer/frmDocRecordLink.vb
Normal file
135
app/DD-Record-Organizer/frmDocRecordLink.vb
Normal file
@@ -0,0 +1,135 @@
|
||||
Imports System.IO
|
||||
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")
|
||||
Else
|
||||
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
|
||||
Me.Close()
|
||||
End If
|
||||
dgEntityRecords.DataSource = CURRENT_ENTITY_DT
|
||||
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
|
||||
End Sub
|
||||
|
||||
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)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not IsNothing(SELECTED_RECORDID) Then
|
||||
tsslbl.Text = ""
|
||||
tsslbl.BackColor = Color.Transparent
|
||||
Try
|
||||
For Each row As DataRow In CURRENT_DT_SELECTED_FILES.Rows
|
||||
CURRENT_DOC_ID = row.Item("DOC_ID")
|
||||
Dim DOC_PATH = row.Item("FILEPATH")
|
||||
Dim _objecttype = row.Item("OBJECTTYPE")
|
||||
clsWindream.MY_WDOBJECTTYPE = _objecttype
|
||||
Dim sql_Exec = String.Format("EXEC PRPMO_CHECK_DOC_RECORD_LINK {0},{1},'{2}','{3}'", SELECTED_RECORDID, CURRENT_DOC_ID, "MANUAL RECORD-LINK", USER_USERNAME)
|
||||
'Dim ins = String.Format("INSERT INTO TBPMO_DOC_RECORD_LINK (RECORD_ID,DOC_ID,COMMENT,ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", SELECTED_RECORDID, CURRENT_DOC_ID, "MANUAL RECORD-LINK", USER_USERNAME)
|
||||
If ClassDatabase.Execute_non_Query(sql_Exec) = False Then
|
||||
MsgBox("Unexpected Error in Inserting Record-Doc Link. Please check logfile!", MsgBoxStyle.Critical)
|
||||
Else
|
||||
If LICENSE_PROXY = True And DD_LIB_Standards.clsDatabase.DB_PROXY_INITIALIZED Then
|
||||
Dim proc = String.Format("EXEC PRPROXY_DOC_CHECK_DOC_REC_LINK {0},{1}", CURRENT_DOC_ID, SELECTED_RECORDID)
|
||||
ClassDatabase.Execute_non_Query(proc, True)
|
||||
End If
|
||||
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)
|
||||
If DT_OBJTYPE.Rows.Count = 1 Then
|
||||
Dim Entity_Index = DT_OBJTYPE.Rows(0).Item("IDXNAME_ENTITYID")
|
||||
Dim Record_Index = DT_OBJTYPE.Rows(0).Item("IDXNAME_RECORDID")
|
||||
Dim ENT_ID = ClassDatabase.Execute_Scalar(String.Format("SELECT FORM_ID FROM TBPMO_RECORD WHERE GUID = {0}", SELECTED_RECORDID))
|
||||
If ENT_ID > 1 Then
|
||||
If clsWD_SET.IndexFile(DOC_PATH, Entity_Index, ENT_ID, _objecttype) = False Then
|
||||
Dim msg = "Die Entität-ID konnte nicht gesetzt werden! Bitte überprüfen Sie die Logfile"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "Could not index Entity-ID! Please check logfile!"
|
||||
End If
|
||||
MsgBox(msg, MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
End If
|
||||
If clsWD_SET.IndexFile(DOC_PATH, Record_Index, SELECTED_RECORDID, _objecttype) = False Then
|
||||
Dim msg = "Die Record-ID konnte nicht gesetzt werden! Bitte überprüfen Sie die Logfile"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "Could not index Record-ID! Please check logfile!"
|
||||
End If
|
||||
MsgBox(msg, MsgBoxStyle.Exclamation)
|
||||
Else
|
||||
Dim msg = String.Format("Der Datensatz wurde erfolgreich mit der Datei " & vbNewLine & "{0}" & vbNewLine & "verknüpft!", DOC_PATH)
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "The record was successfully linked to the file: " & vbNewLine & DOC_PATH
|
||||
End If
|
||||
tsslbl.Text = msg
|
||||
tsslbl.BackColor = Color.Yellow
|
||||
|
||||
ClassHelper.InsertEssential_Log(CURRENT_DOC_ID, "DOC-ID", "FILE LINK CREATED FOR RECORD: " & SELECTED_RECORDID.ToString)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
Save_DocGrid_Layout()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user