270 lines
13 KiB
VB.net
270 lines
13 KiB
VB.net
Imports System.Windows.Forms
|
|
|
|
Public Class frmTask_Editor
|
|
|
|
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
|
|
Try
|
|
Dim upd = String.Format("UPDATE TBPMO_WORKFLOW_TASK SET COMMENT = '{0}', DUE_DATE = '{1}', STATE_ID = {2}, ACTIVE = {3}, CHANGED_WHO = '{4}', TASK_DATE = '{5}' " & _
|
|
"WHERE GUID = {6}", COMMENTTextBox.Text, DUE_DATEDateTimePicker.Value, STATE_IDComboBox.SelectedValue, 1, USER_USERNAME, DateTimePicker1.Value, Me.GUIDTextBox.Text)
|
|
If MYDB_ECM.ExecuteNonQuery(upd) Then
|
|
Me.Close()
|
|
Else
|
|
MsgBox("Update not successfull. Please check logfile.", MsgBoxStyle.Exclamation)
|
|
End If
|
|
' Me.TBPMO_WORKFLOW_TASKTableAdapter.cmdUpdate(COMMENTTextBox.Text, DUE_DATEDateTimePicker.Value, STATE_IDComboBox.SelectedValue, 1, USER_USERNAME, DateTimePicker1.Value, Me.GUIDTextBox.Text)
|
|
Catch ex As Exception
|
|
MsgBox("Error in Exit:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
|
|
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
|
|
Me.Close()
|
|
End Sub
|
|
|
|
|
|
Private Sub frmWF_TaskEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Try
|
|
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
|
|
Me.TBPMO_WORKFLOW_TASKTableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
|
|
Me.VWPMO_WF_ACTIVETableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
|
|
Load_Task()
|
|
|
|
If DD_DMSDataSet.VWPMO_WF_ACTIVE.Rows.Count = 0 Then
|
|
Dim result As MsgBoxResult = MsgBox("Aktuell ist der Workflow anscheinend noch nicht aktiv - Wollen Sie diesen nun starten?", MsgBoxStyle.YesNo, "Frage:")
|
|
If result = MsgBoxResult.Yes Then
|
|
TBPMO_WORKFLOW_TASKTableAdapter.cmdsetActive(USER_USERNAME, CURRENT_RECORD_ID)
|
|
Load_Task()
|
|
If DD_DMSDataSet.VWPMO_WF_ACTIVE.Rows.Count = 0 Then
|
|
MsgBox("Keine aktiven Tasks - Bitte informieren Sie Ihren Systembetreuer.", MsgBoxStyle.Exclamation)
|
|
Me.Close()
|
|
End If
|
|
Else
|
|
Me.Close()
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox("Error Loading Form:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
Me.Close()
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Sub Load_Task()
|
|
Try
|
|
Me.VWPMO_WF_ACTIVETableAdapter.FillByRecord(Me.DD_DMSDataSet.VWPMO_WF_ACTIVE, USER_LANGUAGE, USER_USERNAME, CURRENT_RECORD_ID)
|
|
Catch ex As Exception
|
|
MsgBox("Error in Load_Task:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
Sub Load_Following()
|
|
Try
|
|
Dim sql = "select WF_TASK_ID, dbo.FNPMO_GETOBJECTCAPTION('{0}', 'TASK_TITLE' + CONVERT(VARCHAR(5), WF_ID), 1) AS [Workflow-Title] from VWPMO_WF_ACTIVE where WF_TASK_ID <> " & Me.GUIDTextBox.Text & " AND RECORD_ID = " & CURRENT_RECORD_ID
|
|
Dim DT As DataTable = MYDB_ECM.GetDatatable(sql)
|
|
Dim msg As String = " nachfolgender Task"
|
|
If USER_LANGUAGE <> "de-DE" Then
|
|
msg = " following task:"
|
|
End If
|
|
If DT.Rows.Count > 0 Then
|
|
If DT.Rows.Count = 1 Then
|
|
Label1.Text = "1" & msg
|
|
Else
|
|
If USER_LANGUAGE <> "de-DE" Then
|
|
msg = " following tasks:"
|
|
Else
|
|
msg = " nachfolgende Tasks:"
|
|
End If
|
|
Label1.Text = DT.Rows.Count.ToString & msg
|
|
End If
|
|
|
|
ListBoxFollowing.Visible = True
|
|
btndelete_following.Visible = True
|
|
ListBoxFollowing.DataSource = DT
|
|
ListBoxFollowing.DisplayMember = DT.Columns(1).ColumnName
|
|
ListBoxFollowing.ValueMember = DT.Columns(0).ColumnName
|
|
'Me.DataGridView1.DataSource = DT
|
|
Else
|
|
If USER_LANGUAGE <> "de-DE" Then
|
|
msg = "No following tasks"
|
|
Else
|
|
msg = "Keine nachfolgenden Tasks"
|
|
End If
|
|
Label1.Text = msg
|
|
Me.ListBoxFollowing.Visible = False
|
|
btndelete_following.Visible = False
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox("Error in Load_Following:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
Sub Load_User()
|
|
Try
|
|
Dim Sql = "SELECT T.GUID as [User-ID], T.NAME + ', ' + T.PRENAME AS [User] FROM TBDD_USER T INNER JOIN TBDD_USER_MODULES T1 ON T.GUID = T1.USER_ID INNER JOIN TBDD_MODULES T2 ON T1.MODULE_ID = T2.GUID
|
|
WHERE T2.SHORT_NAME = 'ADDI' ORDER BY USERNAME"
|
|
Dim DT As DataTable = MYDB_ECM.GetDatatable(sql)
|
|
If DT Is Nothing = False Then
|
|
Me.ListBoxUser.Visible = True
|
|
Me.ListBoxUser.DataSource = DT
|
|
Me.ListBoxUser.DisplayMember = DT.Columns(1).ColumnName
|
|
Me.ListBoxUser.ValueMember = DT.Columns(0).ColumnName
|
|
Else
|
|
Me.ListBoxUser.Visible = False
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
MsgBox("Error in Load_User:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
Sub Load_TASK_USER()
|
|
Try
|
|
'Dim sql = "SELECT * FROM VWPMO_WF_USER WHERE LOWER(USERNAME) = '" & USER_USERNAME & "' AND WF_TASK_ID = " & Me.GUIDTextBox.Text
|
|
Dim sql = "SELECT * FROM VWPMO_WF_USER WHERE WF_TASK_ID = " & Me.GUIDTextBox.Text
|
|
Dim DT As DataTable = MYDB_ECM.GetDatatable(sql)
|
|
Dim count As Integer = 0
|
|
If DT Is Nothing = False Then
|
|
ListViewExclusiveUser.Items.Clear()
|
|
For Each row As DataRow In DT.Rows
|
|
ListViewExclusiveUser.Items.Add(row.Item("GUID").ToString)
|
|
ListViewExclusiveUser.Items(count).SubItems.Add(row.Item("TITLE").ToString)
|
|
ListViewExclusiveUser.Items(count).SubItems.Add(row.Item("USERNAME").ToString)
|
|
count += 1
|
|
Next
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox("Error in Load_TASK_USER:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub frmWF_TaskEditor_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
|
Try
|
|
Me.TBPMO_WORKFLOW_TASK_STATETableAdapter.FillBy(Me.DD_DMSDataSet.TBPMO_WORKFLOW_TASK_STATE, USER_LANGUAGE, WF_IDTextBox.Text, CURRENT_ENTITY_ID)
|
|
Dim state = DD_DMSDataSet.VWPMO_WF_ACTIVE.Rows(0).Item("STATE_TITLE")
|
|
Me.STATE_IDComboBox.SelectedIndex = STATE_IDComboBox.FindStringExact(state)
|
|
Catch ex As Exception
|
|
MsgBox("Error in Load_TaskStates:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
Load_Following()
|
|
Load_User()
|
|
Load_TASK_USER()
|
|
End Sub
|
|
|
|
'Private Sub DataGridView2_MouseDown(sender As Object, e As MouseEventArgs)
|
|
' If DataGridViewUser.Visible = True Then
|
|
' 'If tsbtnworkUser.Text <> "Bearbeitung aktiv" Then
|
|
' Dim i As Integer
|
|
' i = DataGridViewUser.CurrentRow.Index
|
|
' If DataGridViewUser.Item(0, i).Value Is Nothing = False Then
|
|
' Me.DataGridViewUser.DoDragDrop(DataGridViewUser.Item(0, i).Value.ToString, DragDropEffects.Copy)
|
|
' End If
|
|
' End If
|
|
|
|
'End Sub
|
|
Private Sub ListView1_DragEnter(sender As Object, e As DragEventArgs) Handles ListViewExclusiveUser.DragEnter
|
|
' 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 ListView1_DragDrop(sender As Object, e As DragEventArgs) Handles ListViewExclusiveUser.DragDrop
|
|
Try
|
|
If e.Data.GetData(DataFormats.Text) Is Nothing = False Then
|
|
Dim sql = "Insert INTO TBPMO_WORKFLOW_TASK_USER (WF_TASK_ID,[USER_ID]) VALUES (" & Me.GUIDTextBox.Text & ", " & e.Data.GetData(DataFormats.Text) & ")"
|
|
If MYDB_ECM.ExecuteNonQuery(SQL) = True Then
|
|
Load_TASK_USER()
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Hinzufügen eines Users:")
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btndeleteuser_Click(sender As Object, e As EventArgs) Handles btndeleteuser.Click
|
|
Try
|
|
If (Me.ListViewExclusiveUser.SelectedItems.Count > 0) Then
|
|
Dim sql = "DELETE FROM TBPMO_WORKFLOW_TASK_USER WHERE GUID = " & Me.ListViewExclusiveUser.SelectedItems.Item(0).Text
|
|
MYDB_ECM.ExecuteNonQuery(SQL)
|
|
Load_TASK_USER()
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in btndeleteuser:")
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btndeleteTask_Click(sender As Object, e As EventArgs) Handles btndeleteTask.Click
|
|
Try
|
|
Dim result As MsgBoxResult = MsgBox("Sind Sie sicher das Sie diesen Task löschen wollen??", MsgBoxStyle.YesNo, "Bestätigung erforderlich:")
|
|
If result = MsgBoxResult.Yes Then
|
|
Dim sql = "DELETE FROM TBPMO_WORKFLOW_TASK_USER WHERE WF_TASK_ID = " & Me.GUIDTextBox.Text
|
|
If MYDB_ECM.ExecuteNonQuery(Sql) Then
|
|
sql = "DELETE FROM TBPMO_WORKFLOW_TASK WHERE GUID = " & Me.GUIDTextBox.Text
|
|
If MYDB_ECM.ExecuteNonQuery(Sql) Then
|
|
Load_Task()
|
|
Load_Following()
|
|
Load_TASK_USER()
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Delete Task:")
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnAddAppointment_Click(sender As Object, e As EventArgs) Handles btnAddAppointment.Click
|
|
Dim Subject As String = "WF-Task: " & TITLETextBox.Text
|
|
Dim Desc As String = COMMENTTextBox.Text
|
|
' Dim ControlID As Integer = 10
|
|
Dim DueDate = DUE_DATEDateTimePicker.Value
|
|
|
|
ClassFunctionCommandsUI.NewEditTaskAppointment(CURRENT_RECORD_ID, 0, Subject, Desc, DueDate)
|
|
End Sub
|
|
|
|
Private Sub btndelete_following_Click(sender As Object, e As EventArgs) Handles btndelete_following.Click
|
|
Try
|
|
If ListBoxFollowing.SelectedIndex <> -1 Then
|
|
Dim ID = ListBoxFollowing.SelectedValue
|
|
If ID > 0 Then
|
|
Dim result As MsgBoxResult = MsgBox("Sind Sie sicher das Sie diesen nachfolgenden Task löschen wollen??", MsgBoxStyle.YesNo, "Bestätigung erforderlich:")
|
|
If result = MsgBoxResult.Yes Then
|
|
Dim sql = "DELETE FROM TBPMO_WORKFLOW_TASK WHERE GUID = " & ID
|
|
If MYDB_ECM.ExecuteNonQuery(Sql) = True Then
|
|
Load_Task()
|
|
Load_Following()
|
|
Load_TASK_USER()
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Delete Following:")
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub ListBoxUser_MouseDown(sender As Object, e As MouseEventArgs) Handles ListBoxUser.MouseDown
|
|
|
|
End Sub
|
|
|
|
Private Sub btnAddUser_Click(sender As Object, e As EventArgs) Handles btnAddUser.Click
|
|
Try
|
|
If ListBoxUser.SelectedIndex <> -1 And ListBoxUser.SelectedValue > 0 Then
|
|
Dim sql = "Insert INTO TBPMO_WORKFLOW_TASK_USER (WF_TASK_ID,[USER_ID]) VALUES (" & Me.GUIDTextBox.Text & ", " & ListBoxUser.SelectedValue & ")"
|
|
If MYDB_ECM.ExecuteNonQuery(SQL) = True Then
|
|
Load_TASK_USER()
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox("Error in Adding User exclusive Task:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
|
|
End Sub
|
|
End Class
|