This commit is contained in:
2022-06-17 15:19:35 +02:00
parent 3c3b07ee49
commit 18f2e76686
5 changed files with 223 additions and 96 deletions

View File

@@ -8,6 +8,8 @@ Imports System.Drawing
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DevExpress.Utils.Svg
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Imports System.Windows.Forms
Public Class frmWorkflow_Adhoc_start
Private ReadOnly Property LogConfig As LogConfig
@@ -19,6 +21,9 @@ Public Class frmWorkflow_Adhoc_start
Private IsLoading As Boolean = True
Private WFUserList As List(Of User2Workflow)
Private WorkflowList As List(Of Workflows)
Private GridCursorLocation As Point
Private oSelectedProfilID As Integer
Private Property FormHelper As FormHelper
Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pAdhocWorkflow As AdHocWorkflow)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
@@ -176,14 +181,7 @@ Public Class frmWorkflow_Adhoc_start
GridSelectedUsers.DataSource = WFUserList
TileViewUser.FocusedRowHandle = GridControl.InvalidRowHandle
'Else
' Dim omsg = "Bitte wählen Sie zuerst einen Workflow"
' If Environment.User.Language <> "de-DE" Then
' omsg = "Please choose a workflow first"
' End If
' Dim oMsgBox As New frmDialog(omsg, "Error", False)
' oMsgBox.ShowDialog()
'End If
End Sub
@@ -198,4 +196,91 @@ Public Class frmWorkflow_Adhoc_start
End If
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
Try
Dim oErrorOcurred As Boolean = False
If oSelectedProfilID = 0 Then
BarStaticItem1.Caption = "Please choose a workflow via clickin on it..."
BarStaticItem1.ItemAppearance.Normal.BackColor = Color.Orange
Exit Sub
End If
Dim oInsert = $"DECLARE @OUT_ID
BIGINT EXEC PRPM_AH_WF_ADD_OBJ_REL {AdHocWorkflow.OBJECT_ID}, {oSelectedProfilID}, '{txtWORK_INSTRUCTION.Text}','{Environment.User.UserName}',@OUT_ID OUTPUT
SELECT @OUT_ID"
Dim oAdhocWF_ID
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
Dim oResponse = Client.GetScalarValueFromECM(oInsert)
If oResponse.OK Then
oAdhocWF_ID = oResponse.Scalar
Else
MsgBox("Unexpected error in WF-Party-Creator. Check your log and inform Admin-Team", MsgBoxStyle.Critical)
oErrorOcurred = True
Exit Sub
End If
Else
oAdhocWF_ID = Environment.Database.GetScalarValue(oInsert)
End If
If Not IsNothing(oAdhocWF_ID) Then
For index = 0 To TileViewUser.RowCount
Dim oRow As User2Workflow = TileViewUser.GetRow(index)
If oRow Is Nothing Then
Continue For
End If
oInsert = $"DECLARE @OUT_ID
BIGINT EXEC PRPM_AH_WF_PARTY {oAdhocWF_ID}, {oRow.UserID}, '{Environment.User.UserName}',@OUT_ID OUTPUT
SELECT @OUT_ID"
Dim oID
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
Dim oResponse = Client.GetScalarValueFromECM(oInsert)
If oResponse.OK Then
oID = oResponse.Scalar
Else
MsgBox("Unexpected error in WF-Party-Creator. Check your log and inform Admin-Team", MsgBoxStyle.Critical)
oErrorOcurred = True
Exit For
End If
Else
oID = Environment.Database.GetScalarValue(oInsert)
End If
Next
End If
If oErrorOcurred = False Then
Me.Close()
End If
Catch ex As Exception
Logger.Error(ex)
BarStaticItem1.Caption = ex.Message
BarStaticItem1.ItemAppearance.Normal.BackColor = Color.Red
FormHelper.ShowErrorMessage(ex, "Error in AHWF Save and Close")
End Try
End Sub
Private Sub TileViewWorkflows_MouseDown(sender As Object, e As MouseEventArgs) Handles TileViewWorkflows.MouseDown
GridCursorLocation = e.Location
End Sub
Private Sub TileViewWorkflows_ItemClick(sender As Object, e As Views.Tile.TileViewItemClickEventArgs) Handles TileViewWorkflows.ItemClick
Try
Dim oWorkflowID As Workflows = TileViewWorkflows.GetRow(TileViewWorkflows.FocusedRowHandle)
Try
If CInt(oWorkflowID.ID) > 0 Then
oSelectedProfilID = oWorkflowID.ID
End If
Catch ex As Exception
oSelectedProfilID = 0
End Try
Catch ex As Exception
oSelectedProfilID = 0
End Try
End Sub
End Class