RecordOrganizer/app/DD-Record-Organizer/frmTask_Management.vb
2017-04-03 13:01:57 +02:00

564 lines
29 KiB
VB.net

Public Class frmTask_Management
Private Shared _Instance As frmTask_Management = Nothing
Private insert As Boolean = False
Public Shared Function Instance() As frmTask_Management
If _Instance Is Nothing OrElse _Instance.IsDisposed = True Then
_Instance = New frmTask_Management
End If
_Instance.BringToFront()
Return _Instance
End Function
Private formloaded As Boolean = False
Private _ENTITYID As Integer
Private Sub TBPMO_WORKFLOWBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TBPMO_WORKFLOWBindingNavigatorSaveItem.Click
save_Workflow()
End Sub
Sub Save_workflow()
Try
Me.TBPMO_WORKFLOWBindingSource.EndEdit()
If DD_DMSDataSet.TBPMO_WORKFLOW.GetChanges Is Nothing = False Then
Me.CHANGED_WHOTextBox1.Text = USER_USERNAME
Me.TBPMO_WORKFLOWBindingSource.EndEdit()
Me.TBPMO_WORKFLOWTableAdapter.Update(DD_DMSDataSet.TBPMO_WORKFLOW)
toolstriplabel(True, "Änderungen Task erfolgreich gespeichert - " & Now)
Else
toolstriplabel(False, "")
End If
Catch ex As Exception
MsgBox("Error in Save TBPMO_WORKFLOW:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub toolstriplabel(visible As Boolean, txt As String)
tslbl.Text = txt
tslbl.Visible = visible
End Sub
Private Sub frmTaskmanagement_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
ClassWindowLocation.SaveFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmTaskmanagement")
End Sub
Private Sub frmTaskmanagement_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
ClassWindowLocation.LoadFormLocationSize(Me, 1, CURRENT_SCREEN_ID, "frmTaskmanagement")
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Connection.ConnectionString = MyConnectionString
VWPMO_GUI_ENTITYTableAdapter.Connection.ConnectionString = MyConnectionString
TBPMO_WORKFLOWTableAdapter.Connection.ConnectionString = MyConnectionString
Try
Me.VWPMO_GUI_ENTITYTableAdapter.Fill(Me.DD_DMSDataSet.VWPMO_GUI_ENTITY)
Catch ex As Exception
MsgBox("Error in VWPMO_GUI_ENTITYTableAdapter: " & ex.Message, MsgBoxStyle.Exclamation)
ClassLogger.Add(">> Error in VWPMO_GUI_ENTITYTableAdapter: " & ex.Message, False)
End Try
Load_TreeView()
Me.TBPMO_WORKFLOWTableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_WORKFLOW, USER_LANGUAGE)
Load_States()
Catch ex As Exception
MsgBox("Error in Load Form:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Sub SetSelectedNodeStyle(tncoll As TreeNodeCollection)
For Each node As TreeNode In tncoll
If node.IsSelected Then
node.NodeFont = New Font(TreeViewEntities.Font.FontFamily, TreeViewEntities.Font.Size, FontStyle.Bold)
node.Text = node.Text
Else
node.NodeFont = New Font(TreeViewEntities.Font.FontFamily, TreeViewEntities.Font.Size, FontStyle.Regular)
End If
If node.Nodes.Count > 0 Then
SetSelectedNodeStyle(node.Nodes)
End If
Next
TreeViewEntities.Refresh()
End Sub
Sub Load_TreeView()
Try
Dim DT_SQL = String.Format("SELECT ID, Title,[dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FormViewID), {1}) AS 'CAPTION' FROM VWPMO_GUI_ENTITY WHERE FORM_TYPE_ID = 1 AND PARENT_ID = 0", USER_LANGUAGE, CURRENT_SCREEN_ID)
Dim DT As DataTable = ClassDatabase.Return_Datatable(DT_SQL)
If DT.Rows.Count > 0 Then
TreeViewEntities.Nodes.Clear()
For Each Row As DataRow In DT.Rows
Dim Node As TreeNode
Node = TreeViewEntities.Nodes.Add(Row.Item("CAPTION").ToString)
Node.Tag = Row.Item("ID")
Node.BackColor = Color.Orange
'Jetzt die Ebene1Knoten einhängen
DT_SQL = String.Format("SELECT ID, Title,[dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FormViewID), {1}) AS 'CAPTION' FROM VWPMO_GUI_ENTITY WHERE FORM_TYPE_ID in (2,5) AND PARENT_ID = {2} ORDER BY LEVEL", USER_LANGUAGE, CURRENT_SCREEN_ID, Row.Item("ID"))
'Dim sql As String = "SELECT T.GUID, T1.FORM_TITLE FROM TBPMO_FORM T, TBPMO_FORM_VIEW T1 WHERE T.GUID = T1.FORM_ID AND T.FORM_TYPE_ID in (2,5) AND T.PARENT_ID = " & Row.Item("GUID") & " ORDER BY LEVEL"
Dim dtEbene1 As DataTable = ClassDatabase.Return_Datatable(DT_SQL)
If dtEbene1.Rows.Count > 0 Then
For Each row1 As DataRow In dtEbene1.Rows
Dim Node1 As TreeNode
Node1 = Node.Nodes.Add(row1.Item("CAPTION").ToString)
Node1.Tag = row1.Item("ID")
DT_SQL = String.Format("SELECT ID, Title,[dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FormViewID), {1}) AS 'CAPTION' FROM VWPMO_GUI_ENTITY WHERE FORM_TYPE_ID in (3,5) AND PARENT_ID = {2} ORDER BY LEVEL", USER_LANGUAGE, CURRENT_SCREEN_ID, row1.Item("ID"))
' Dim sql1 As String = "SELECT T.GUID, T1.FORM_TITLE FROM TBPMO_FORM T, TBPMO_FORM_VIEW T1 WHERE T.GUID = T1.FORM_ID AND T.FORM_TYPE_ID in (3,5) AND T.PARENT_ID = " & row1.Item("GUID") & " ORDER BY LEVEL"
'Jetzt die Ebene2 Knoten einhängen
Dim dtEbene2 As DataTable = ClassDatabase.Return_Datatable(DT_SQL)
If dtEbene2.Rows.Count > 0 Then
For Each row2 As DataRow In dtEbene2.Rows
Dim Node2 As TreeNode
Node2 = Node1.Nodes.Add(row2.Item("CAPTION").ToString)
Node2.Tag = row2.Item("ID")
Next
End If
Next
End If
Next
DT_SQL = String.Format("SELECT ID, Title,[dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FormViewID), {1}) AS 'CAPTION' FROM VWPMO_GUI_ENTITY WHERE FORM_TYPE_ID = 4 AND PARENT_ID = 0 ORDER BY CAPTION", USER_LANGUAGE, CURRENT_SCREEN_ID)
'Dim sql2 As String = "SELECT T.GUID, T1.FORM_TITLE FROM TBPMO_FORM T, TBPMO_FORM_VIEW T1 WHERE T.GUID = T1.FORM_ID AND T.FORM_TYPE_ID = 4 AND T.PARENT_ID = 0 ORDER BY T1.FORM_TITLE"
Dim DT3 As DataTable = ClassDatabase.Return_Datatable(DT_SQL)
If DT3.Rows.Count > 0 Then
Dim Node As TreeNode
Node = TreeViewEntities.Nodes.Add("INDEPENDENT ENTITIES")
For Each row3 As DataRow In DT3.Rows
Dim Node2 As TreeNode
Node2 = Node.Nodes.Add(row3.Item("CAPTION").ToString)
Node2.Tag = row3.Item("ID")
Next
End If
TreeViewEntities.ExpandAll()
TreeViewEntities.Nodes(0).EnsureVisible()
End If
Catch ex As Exception
MsgBox("Error in Load_TreeView:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub TBPMO_WORKFLOWBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBPMO_WORKFLOWBindingSource.AddingNew
DD_DMSDataSet.TBPMO_WORKFLOW.ADDED_WHOColumn.DefaultValue = USER_USERNAME
End Sub
Private Sub BindingNavigatorDeleteItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorDeleteItem.Click
End Sub
Private Sub TBPMO_WORKFLOW_FORMDataGridView_DragEnter(sender As Object, e As DragEventArgs)
' Check the format of the data being dropped.
If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Display the copy cursor.
e.Effect = DragDropEffects.Copy
Else
' Display the no-drop cursor.
e.Effect = DragDropEffects.None
End If
End Sub
'Private Sub WH_FormsDataGridView_SelectionChanged(sender As Object, e As EventArgs)
' If formloaded = True Then
' Dim i As Integer
' i = WH_FormsDataGridView.CurrentRow.Index
' If WH_FormsDataGridView.Item(0, i).Value Is Nothing = False Then
' _FORMID = WH_FormsDataGridView.Item(0, i).Value
' Dim ColName = WH_FormsDataGridView.Item("ColName", i).Value
' Try
' btnAddTask2Entity.Text = "Task zu Entität '" & ColName.ToString & "' hinzufügen"
' Catch ex As Exception
' End Try
' Refresh_Workflow_Form(_FORMID)
' End If
' End If
'End Sub
Private Sub frmTaskmanagement_Shown(sender As Object, e As EventArgs) Handles Me.Shown
formloaded = True
End Sub
Private Sub ToolStripButton18_Click(sender As Object, e As EventArgs) Handles ToolStripButton18.Click
Save_State()
End Sub
Sub Save_State()
Try
Me.TBPMO_WORKFLOW_TASK_STATEBindingSource.EndEdit()
If DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE.GetChanges Is Nothing = False Then
Me.CHANGED_WHOTextBox.Text = USER_USERNAME
Me.TBPMO_WORKFLOW_TASK_STATEBindingSource.EndEdit()
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Update(DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE)
toolstriplabel(True, "Änderungen erfolgreich gespeichert - " & Now)
End If
Catch ex As Exception
MsgBox("Error in Save TBPMO_WORKFLOW_TASK_STATE:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub TBPMO_WORKFLOW_TASK_STATEBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBPMO_WORKFLOW_TASK_STATEBindingSource.AddingNew
DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE.ADDED_WHOColumn.DefaultValue = USER_USERNAME
DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE.CHANGED_WHOColumn.DefaultValue = USER_USERNAME
End Sub
'Private Sub btnAddTask2Entity_Click(sender As Object, e As EventArgs) Handles btnAddTask2Entity.Click
' Try
' Save_workflow()
' 'Dim i As Integer
' 'i = WH_FormsDataGridView.CurrentRow.Index
' 'If WH_FormsDataGridView.Item(0, i).Value Is Nothing = False Then
' ' _FORMID = WH_FormsDataGridView.Item(0, i).Value
' If _ENTITYID = 0 Then
' MsgBox("Please choose an entity.", MsgBoxStyle.Exclamation)
' Exit Sub
' End If
' TBPMO_WORKFLOW_FORMTableAdapter.Insert(_ENTITYID, GUIDTextBox1.Text, 1, USER_USERNAME)
' toolstriplabel(True, "Task erfolgreich zugeordnet - " & Now)
' Refresh_Workflow_Form(_ENTITYID)
' ' End If
' Catch ex As Exception
' MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen Task zu Entität:")
' End Try
'End Sub
Private Sub btncolordialog_Click(sender As Object, e As EventArgs) Handles btncolordialog.Click
If ColorDialog1.ShowDialog <> System.Windows.Forms.DialogResult.Cancel Then
Dim colour As Integer = ColorTranslator.ToWin32(ColorDialog1.Color)
COLORTextBox.Text = colour
COLORTextBox.BackColor = ColorDialog1.Color
Save_State()
End If
End Sub
Private Sub ListBoxStati_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ListBoxStati.DrawItem
Dim clrSelectedText As Color = Color.Red 'Our color for selected text
Dim clrHighlight As Color = Color.Yellow 'Our background for selected items
If e.State = DrawItemState.Selected Then
'This item is selected
'e.DrawBackground()
e.Graphics.FillRectangle(New SolidBrush(clrHighlight), e.Bounds) 'Fill the item's rectangle with our highlight
e.Graphics.DrawString(ListBoxStati.Items.Item(e.Index), e.Font, New SolidBrush(clrSelectedText), e.Bounds) 'Draw the text for the item
ElseIf e.State = DrawItemState.None Then
'This item has no state
e.DrawBackground() 'Draw our regular background
e.Graphics.DrawString(ListBoxStati.Items.Item(e.Index), e.Font, Brushes.Black, e.Bounds) 'Draw the item text in its regular color
End If
'Draws a focus rectangle around the item if it has focus
e.DrawFocusRectangle()
End Sub
Private Sub COLORTextBox_TextChanged(sender As Object, e As EventArgs) Handles COLORTextBox.TextChanged
Try
COLORTextBox.BackColor = ColorTranslator.FromWin32(CInt(COLORTextBox.Text))
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
Private Sub TreeViewEntities_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeViewEntities.AfterSelect
Try
If Not TreeViewEntities.SelectedNode Is Nothing Then
Dim entityId As Integer = Integer.Parse(TreeViewEntities.SelectedNode.Tag)
'If USER_LANGUAGE = "de-DE" Then
' btnAddTask2Entity.Text = "Task zu Entität '" & TreeViewEntities.SelectedNode.Text & "' hinzufügen ..."
'Else
' btnAddTask2Entity.Text = "Add Task to entity '" & TreeViewEntities.SelectedNode.Text & "'...."
'End If
'If Not IsNothing(TreeViewEntities.SelectedNode) Then
' TreeView1.Nodes(0).Text = TreeViewEntities.SelectedNode.Text
'Else
' TreeView1.Nodes(0).Text = "no entity chosen"
'End If
'TreeView1.Nodes(0).Nodes(0).Text = TITLETextBox.Text
'TreeView1.Nodes(0).Nodes(0).Nodes(0).Text = STATE_DESCTextBox.Text
'TreeView1.ExpandAll()
_ENTITYID = entityId
Refresh_Inserts
'If Not IsNothing(ListBoxEntity_State.SelectedItem) And _ENTITYID > 0 Then
' Load_ENTITY_States(ListBoxEntity_State.SelectedItem)
'End If
SetSelectedNodeStyle(TreeViewEntities.Nodes)
TreeViewEntities.ExpandAll()
Load_ENTITY_States("ENT")
End If
Catch ex As Exception
MsgBox("Error in AfterSelect:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btndelete_Click(sender As Object, e As EventArgs) Handles btndeleteEntityWorkflow.Click
Try
Dim i As Integer
i = DataGridView1.CurrentRow.Index
If DataGridView1.Item(0, i).Value Is Nothing = False Then
Dim i1 = DataGridView1.Item(0, i).Value
Dim del = "DELETE FROM TBPMO_WORKFLOW_ENTITY_STATE WHERE GUID = " & i1
If ClassDatabase.Execute_non_Query(del, False) Then
Load_ENTITY_States("ENT")
End If
End If
'If ListBoxEntityWorkflow.SelectedIndex <> -1 Then
' Dim ID = ListBoxEntityWorkflow.SelectedValue
' If ClassDatabase.Execute_non_Query(del) = True Then
' Dim txt As String = "Der Datensatz wurde erfolgreich gelöscht - " & Now
' If USER_LANGUAGE <> "de-DE" Then
' txt = "The record has been deleted - " & Now
' End If
' Refresh_Workflow_Form(_ENTITYID)
' toolstriplabel(True, txt)
' End If
'End If
Catch ex As Exception
MsgBox("Error in delete entity-workflow:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub XtraTabControl1_TabIndexChanged(sender As Object, e As EventArgs) Handles XtraTabControl1.TabIndexChanged
Select Case XtraTabControl1.TabIndex
Case 1
If GUIDTextBox1.Text <> "" And _ENTITYID > 0 Then
Load_ENTITY_States(GUIDTextBox1.Text)
End If
End Select
End Sub
Sub Load_ENTITY_States(Type As String)
Try
Dim sql As String
Dim txtlbl As String
Select Case Type
Case "WF"
sql = String.Format("SELECT GUID as ID,dbo.FNPMO_GETOBJECTCAPTION('{0}', 'FORMVIEW_TITLE' + CONVERT(VARCHAR(5),FV_ID), 1) AS Entity,dbo.FNPMO_GETOBJECTCAPTION('{0}', 'TASK_TITLE' + CONVERT(VARCHAR(5),WF_ID), 1) AS [Task/Workflow],dbo.FNPMO_GETOBJECTCAPTION('{0}', 'WF_STATE_TITLE' + CONVERT(VARCHAR(5),STATE_ID), 1) AS [State],Final FROM VWPMO_WORKFLOW_ENTITY_STATE WHERE WF_ID = {1}", USER_LANGUAGE, GUIDTextBox1.Text)
txtlbl = "Worflow/Tasks for selected workflow"
Case "ENT"
txtlbl = "Worflow/Tasks for selected entity"
sql = String.Format("SELECT GUID as ID,dbo.FNPMO_GETOBJECTCAPTION('{0}', 'FORMVIEW_TITLE' + CONVERT(VARCHAR(5),FV_ID), 1) AS Entity,dbo.FNPMO_GETOBJECTCAPTION('{0}', 'TASK_TITLE' + CONVERT(VARCHAR(5),WF_ID), 1) AS [Task/Workflow],dbo.FNPMO_GETOBJECTCAPTION('{0}', 'WF_STATE_TITLE' + CONVERT(VARCHAR(5),STATE_ID), 1) AS [State],Final FROM VWPMO_WORKFLOW_ENTITY_STATE WHERE ENTITY_ID = {1}", USER_LANGUAGE, _ENTITYID)
Case "STATE"
txtlbl = "Worflow/Tasks for selected state"
sql = String.Format("SELECT GUID as ID,dbo.FNPMO_GETOBJECTCAPTION('{0}', 'FORMVIEW_TITLE' + CONVERT(VARCHAR(5),FV_ID), 1) AS Entity,dbo.FNPMO_GETOBJECTCAPTION('{0}', 'TASK_TITLE' + CONVERT(VARCHAR(5),WF_ID), 1) AS [Task/Workflow],dbo.FNPMO_GETOBJECTCAPTION('{0}', 'WF_STATE_TITLE' + CONVERT(VARCHAR(5),STATE_ID), 1) AS [State],Final FROM VWPMO_WORKFLOW_ENTITY_STATE WHERE STATE_ID = {1}", USER_LANGUAGE, GUIDTextBox.Text)
End Select
' Dim sql = String.Format("SELECT T.GUID,T1.STATE_DESC FROM TBPMO_WORKFLOW_ENTITY_STATE T, TBPMO_WORKFLOW_TASK_STATE T1 WHERE T.STATE_ID = T1.GUID AND T.WF_ID = {0} AND T.ENTITY_ID = {1}", Workflow_ID, _ENTITYID)
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
DataGridView1.DataSource = DT
lblSelection.Text = txtlbl
DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
'ListBoxEntity_State.DataSource = DT
'ListBoxEntity_State.DisplayMember = DT.Columns(1).ColumnName
'ListBoxEntity_State.ValueMember = DT.Columns(0).ColumnName
'If DT.Rows.Count = 0 Then
'End If
Catch ex As Exception
MsgBox("Error in Load_ENTITY_States" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub TBPMO_WORKFLOWBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBPMO_WORKFLOWBindingSource.CurrentChanged
If GUIDTextBox1.Text <> "" Then
Refresh_Inserts()
'If Not IsNothing(TreeViewEntities.SelectedNode) Then
' _ENTITYID = Integer.Parse(TreeViewEntities.SelectedNode.Tag)
' TreeView1.Nodes(0).Text = TreeViewEntities.SelectedNode.Text
'Else
' _ENTITYID = 0
' TreeView1.Nodes(0).Text = "no entity chosen"
'End If
'TreeView1.Nodes(0).Nodes(0).Text = TITLETextBox.Text
'TreeView1.Nodes(0).Nodes(0).Nodes(0).Text = STATE_DESCTextBox.Text
'TreeView1.ExpandAll()
Load_ENTITY_States("WF")
If GUIDTextBox1.Text <> "" And _ENTITYID > 0 Then
End If
End If
End Sub
Sub Refresh_Inserts()
txtWorkflow.Text = TITLETextBox.Text
txtWorkflow.Tag = GUIDTextBox1.Text
txtState.Text = STATE_DESCTextBox.Text
txtState.Tag = GUIDTextBox.Text
If Not IsNothing(TreeViewEntities.SelectedNode) Then
txtEntity.Text = TreeViewEntities.SelectedNode.Text
Dim entityId As Integer = Integer.Parse(TreeViewEntities.SelectedNode.Tag)
txtEntity.Tag = entityId
Else
txtEntity.Text = ""
txtEntity.Tag = Nothing
End If
End Sub
'Private Sub btnAddState2Entity_Click_1(sender As Object, e As EventArgs) Handles btnAddState2Entity.Click
' Try
' If GUIDTextBox.Text <> "" And GUIDTextBox1.Text <> "" And _ENTITYID <> 0 Then
' Dim ins = String.Format("INSERT INTO TBPMO_WORKFLOW_ENTITY_STATE (WF_ID,ENTITY_ID,STATE_ID,ADDED_WHO) VALUES({0},{1},{2},'{3}')", GUIDTextBox1.Text, _ENTITYID, GUIDTextBox.Text, USER_USERNAME)
' If ClassDatabase.Execute_non_Query(ins) Then
' Dim txt As String = "Der Datensatz wurde erfolgreich hinzugefügt - " & Now
' If USER_LANGUAGE <> "de-DE" Then
' txt = "The record was added successfully - " & Now
' End If
' toolstriplabel(True, txt)
' Else
' Dim txt As String = "Unvorhergesehener Fehler bei Hinzufügen Datensatz - " & Now
' If USER_LANGUAGE <> "de-DE" Then
' txt = "Unexpected error while adding record - " & Now
' End If
' toolstriplabel(True, txt)
' End If
' If GUIDTextBox1.Text <> "" And _ENTITYID > 0 Then
' Load_ENTITY_States(GUIDTextBox1.Text)
' End If
' Else
' Dim txt As String = "Bitte prüfen Sie ob ein Worflow, eine Entität und ein Status gewählt ist."
' If USER_LANGUAGE <> "de-DE" Then
' txt = "Please check wether a workflow, an entity amd a state are chosen properly."
' End If
' MsgBox(txt, MsgBoxStyle.Exclamation)
' End If
' Catch ex As Exception
' MsgBox("Error in Insert Entity-States" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
' End Try
'End Sub
Private Sub tsbtnrefresh_Stati_Click(sender As Object, e As EventArgs) Handles tsbtnrefresh_Stati.Click
Load_States()
End Sub
Sub Load_States()
Try
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE, USER_LANGUAGE)
Catch ex As Exception
MsgBox("Error in Refresh TBPMO_WORKFLOW_TASK_STATE: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
'Private Sub btndeleteEntityState_Click(sender As Object, e As EventArgs) Handles btndeleteEntityState.Click
' Try
' 'If ListBoxEntity_State.SelectedIndex <> -1 Then
' ' Dim ID = ListBoxEntity_State.SelectedValue
' ' Dim del = "DELETE FROM TBPMO_WORKFLOW_TASK WHERE STATE_ID = " & ID
' ' If ClassDatabase.Execute_non_Query(del) = True Then
' ' del = "DELETE FROM TBPMO_WORKFLOW_ENTITY_STATE WHERE GUID = " & ID
' ' If ClassDatabase.Execute_non_Query(del) = True Then
' ' Dim txt As String = "Der Datensatz wurde erfolgreich gelöscht - " & Now
' ' If USER_LANGUAGE <> "de-DE" Then
' ' txt = "The record has been deleted - " & Now
' ' End If
' ' If Not IsNothing(ListBoxEntity_State.SelectedItem) And _ENTITYID > 0 Then
' ' Load_ENTITY_States(ListBoxEntity_State.SelectedItem)
' ' End If
' ' toolstriplabel(True, txt)
' ' End If
' ' End If
' 'End If
' Catch ex As Exception
' MsgBox("Error in delete entity-workflow:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
' End Try
'End Sub
Private Sub TBPMO_WORKFLOW_TASK_STATEBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBPMO_WORKFLOW_TASK_STATEBindingSource.CurrentChanged
If GUIDTextBox.Text <> "" And _ENTITYID <> 0 Then
Load_ENTITY_States("STATE")
'If Not IsNothing(TreeViewEntities.SelectedNode) Then
' TreeView1.Nodes(0).Text = TreeViewEntities.SelectedNode.Text
'Else
' TreeView1.Nodes(0).Text = "no entity chosen"
'End If
'TreeView1.Nodes(0).Nodes(0).Text = TITLETextBox.Text
'TreeView1.Nodes(0).Nodes(0).Nodes(0).Text = STATE_DESCTextBox.Text
'TreeView1.ExpandAll()
Refresh_Inserts
End If
End Sub
Private Sub ListBoxEntityWorkflow_SelectedIndexChanged(sender As Object, e As EventArgs)
Try
'If ListBoxEntityWorkflow.SelectedIndex <> -1 Then
' Dim ID = ListBoxEntityWorkflow.SelectedValue
' Dim text = ListBoxEntityWorkflow.SelectedItem.ToString
' txtEntity.Text = text
' txtEntity.Tag = ID
' txtState.Text = STATE_DESCTextBox.Text
' txtState.Tag = GUIDTextBox.Text
'End If
Catch ex As Exception
MsgBox("Error in SelectedIndexChanged entity-workflow:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnAddWorkflowConfig_Click(sender As Object, e As EventArgs) Handles btnAddWorkflowConfig.Click
Try
If GUIDTextBox1.Text <> "" And _ENTITYID <> 0 Then
Dim final
Select Case chkfinal.Checked
Case False
final = 0
Case True
final = 1
End Select
Dim ins = String.Format("INSERT INTO TBPMO_WORKFLOW_ENTITY_STATE (WF_ID,ENTITY_ID,STATE_ID,ADDED_WHO,FINAL) VALUES({0},{1},{2},'{3}',{4})", GUIDTextBox1.Text, txtEntity.Tag, txtState.Tag, USER_USERNAME, final)
If ClassDatabase.Execute_non_Query(ins, False) Then
Dim txt As String = "Der Datensatz wurde erfolgreich hinzugefügt - " & Now
If USER_LANGUAGE <> "de-DE" Then
txt = "The record was added successfully - " & Now
End If
toolstriplabel(True, txt)
Else
Dim txt As String = "Unvorhergesehener Fehler bei Hinzufügen Datensatz - " & Now
If USER_LANGUAGE <> "de-DE" Then
txt = "Unexpected error while adding record - " & Now
End If
toolstriplabel(True, txt)
End If
Load_ENTITY_States("ENT")
Else
Dim txt As String = "Bitte prüfen Sie ob ein Worflow, eine Entität und ein Status gewählt ist."
If USER_LANGUAGE <> "de-DE" Then
txt = "Please check wether a workflow, an entity amd a state are chosen properly."
End If
MsgBox(txt, MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
MsgBox("Error in Insert Entity-States:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
Try
Dim i As Integer
i = DataGridView1.CurrentRow.Index
If DataGridView1.Item(0, i).Value Is Nothing = False Then
Dim i1 = DataGridView1.Item(0, i).Value
Dim sel = "SELECT COMMENT FROM TBPMO_WORKFLOW_ENTITY_STATE WHERE GUID = " & i1
Dim result = ClassDatabase.Execute_Scalar(sel)
txtComment.Text = result
End If
Catch ex As Exception
MsgBox("Error in getting Workflow Comment:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub txtComment_TextChanged(sender As Object, e As EventArgs) Handles txtComment.TextChanged
End Sub
Private Sub btnSaveComment_Click(sender As Object, e As EventArgs) Handles btnSaveComment.Click
If txtComment.Text <> "" Then
Try
Dim i As Integer
i = DataGridView1.CurrentRow.Index
If DataGridView1.Item(0, i).Value Is Nothing = False Then
Dim i1 = DataGridView1.Item(0, i).Value
Dim upd = "UPDATE TBPMO_WORKFLOW_ENTITY_STATE SET COMMENT = '" & txtComment.Text & "' WHERE GUID = " & i1
If ClassDatabase.Execute_non_Query(upd, False) = False Then
MsgBox("Workflow Comment could not be updated -Check log", MsgBoxStyle.Critical)
End If
End If
Catch ex As Exception
MsgBox("Error in Updating Workflow Comment:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
End Sub
End Class