public void Execute(string serialNo, string actionName) { _provider.Execute(new ExecInstParam() { SerialNo = serialNo, Action = actionName }); }
private void processWorkFlow() { var formProcessing = CurrentActivity().CurrAction.FormDataProcessing; //Start workflow if (formProcessing.IsAddNewRequestHeader) { if (RequestHeader.Id > 0) { IDictionary <string, Object> dataField = GetDataField(); dataField.Add("RequestHeaderID", RequestHeader.Id); dataField.Add("RuntimeURL", WorkflowInstance.RuntimeURL); dataField.Add(GetUserComment(), string.Empty); Priority priority = Priority.LOW; if (WorkflowInstance.Priority == 1) { priority = Priority.MEDIUM; } else if (WorkflowInstance.Priority == 0) { priority = Priority.HIGH; } string proname = getFullProccessName(); if (formProcessing.TriggerWorkflow) { int procInstId = _procInstProvider.StartProcInstance(new InstParam() { ProcName = proname, Folio = RequestHeader.Title, CurrentUser = WorkflowInstance.CurrentUser, Priority = priority, DataFields = dataField }); RequestHeader.ProcessInstanceId = procInstId; } //Update process instance id requestHeaderRepository.Update(RequestHeader); unitOfWork.commit(); } else { throw new Exception(" No request header found to start workflow "); } } //Take action else if (formProcessing.TriggerWorkflow) { if (IsSubmitDraft()) { IDictionary <string, Object> dataField = GetDataField(); dataField.Add("RequestHeaderID", RequestHeader.Id); dataField.Add("RuntimeURL", WorkflowInstance.RuntimeURL); dataField.Add(GetUserComment(), string.Empty); Priority priority = Priority.LOW; if (WorkflowInstance.Priority == 1) { priority = Priority.MEDIUM; } else if (WorkflowInstance.Priority == 0) { priority = Priority.HIGH; } string proname = getFullProccessName(); RequestHeader.Title = requestHeaderRepository.GetRequestNo(GetRequestCodePrefix(), GetRequestCode()); if (formProcessing.TriggerWorkflow) { int procInstId = _procInstProvider.StartProcInstance(new InstParam() { ProcName = proname, Folio = RequestHeader.Title, CurrentUser = WorkflowInstance.CurrentUser, Priority = priority, DataFields = dataField }); RequestHeader.ProcessInstanceId = procInstId; } requestHeaderRepository.Update(RequestHeader); unitOfWork.commit(); } else { var dataFields = GetDataField(); dataFields.Add(GetUserComment(), WorkflowInstance.Comment); _procInstProvider.Execute(new ExecInstParam() { SerialNo = WorkflowInstance.SerialNo, Action = WorkflowInstance.Action, DataFields = dataFields }); } } }