public int AddWorkflowLevel(WorkflowLevel workflowlevel) { if (workflowlevel.WorkflowId > 0) { try { if (!string.IsNullOrEmpty(workflowlevel.Name)) { var workflow = _workflowLevels.Fetch(w => w.WorkflowId == workflowlevel.WorkflowId && w.RefId==workflowlevel.RefId) .OrderBy(w => w.LevelOrder) .Select(w => w); var workflowLevels = workflow as IList<WorkflowLevel> ?? workflow.ToList(); if (workflowlevel.LevelOrder <= 0 ||workflowlevel.Id==0&& workflowLevels.Any(w => w.LevelOrder == workflowlevel.LevelOrder)) { var lastWorkFlow = workflowLevels.LastOrDefault(); workflowlevel.LevelOrder = lastWorkFlow == null ? 1 : ++lastWorkFlow.LevelOrder; } try { _workflowLevels.Add(workflowlevel); return workflowlevel.Id; } catch (Exception ex) { throw new WorkflowConfigurationError( "Workflow Level must have a unique name or unique level Order per Workflow. " + ex.Message); } } else throw new WorkflowConfigurationError("Workflow Level cannot be added as the Level Name is empty."); } catch (Exception ex) { throw new WorkflowConfigurationError( "Workflow Level cannot be added as the level Order already exist." + ex.Message); } } else throw new WorkflowConfigurationError("Workflow Level not associated with any Workflow."); }
public int UpdateWorkflowLevel(WorkflowLevel workflowlevel) { return AddWorkflowLevel(workflowlevel); }
public void DownloadWorkflowFile(string workflowID, FileConnectorBase writer, Stream fileStream, WorkflowLevel workflowLevel) { writer.SaveFileStream(workflowID + ".xml", workflowFolderName, fileStream); }