public static void CreateTask(IConnection _conn, long objectId, WorkflowStepData workflowStep)
        {
            TaskCreateData tcd = new TaskCreateData();

            tcd.SetDescription("Automatic Step");
            tcd.SetPriority(5);
            tcd.SetAvailable(DateTime.Now);

            workflowStep.TaskId = _conn.Workflow.CreateTask(objectId, workflowStep.StepId, tcd);
        }
        public static List <WorkflowStepData> GetFromImgr(IConnection _conn, string WorkflowName, BindingList <AttributeList> attributes)
        {
            List <WorkflowStepData> wfSteps  = new List <WorkflowStepData>();
            WorkflowDef             workflow = _conn.WorkflowMetadata.GetWorkflow(WorkflowName);

            StepRootDef[] steps = _conn.WorkflowMetadata.Steps(workflow.id, StepRequestFlag.Production);

            foreach (StepRootDef step in steps)
            {
                if (step.typeGuid != MANUAL_STEP_GUID)
                {
                    continue;
                }

                List <List <string> > atrList = getGuidAttributes(_conn, step.id, attributes);
                var atrSortList = FindAllCombinations(atrList);

                //if (atrSortList.Count(IEnumerable<List<string>>) == 0)
                //{
                //    WorkflowStepData wfStep = new WorkflowStepData();
                //    wfStep.Workflow = workflow.programmaticName;
                //    wfStep.StepId = step.id;
                //    wfStep.FromStep = step.programmaticName;
                //    wfSteps.Add(wfStep);
                //}

                foreach (var _val in atrSortList)
                {
                    WorkflowStepData wfStep = new WorkflowStepData();
                    foreach (var _val2 in _val)
                    {
                        wfStep.Workflow = workflow.programmaticName;
                        wfStep.StepId   = step.id;
                        wfStep.FromStep = step.programmaticName;

                        string attrName = getAttributeName(attributes, _val.IndexOf(_val2));
                        wfStep.Attribute.Add(attrName, _val2);
                    }
                    wfSteps.Add(wfStep);
                }
            }
            return(wfSteps);
        }
        public static void ReleaseTask(IConnection _conn, WorkflowStepData workflowStep)
        {
            _conn.Workflow.LockTask(workflowStep.TaskId);

            foreach (KeyValuePair <string, string> attributeVal in workflowStep.Attribute)
            {
                _conn.Workflow.SetTaskAttribute(workflowStep.TaskId, attributeVal.Key, attributeVal.Value);
            }

            TaskReleaseStatus taskStatus = _conn.Workflow.ReleaseTask(workflowStep.TaskId, true);

            TaskData task = _conn.Workflow.GetTaskData(workflowStep.TaskId);

            workflowStep.ToStep = _conn.WorkflowMetadata.GetStep(task.stepid, StepRequestFlag.Production).programmaticName;

            if (taskStatus.ErrorMessage == null)
            {
                return;
            }

            workflowStep.ErrorMessage = taskStatus.ErrorMessage;
            workflowStep.Error        = taskStatus.TaskError.ToString();
        }