internal static int UpdateSatesOrder(List <WorkflowState> wStates, Workflow wflow, bool IncrementOrder, int?DeletedWorkflowStateOrder) { int Order = -1; if (IncrementOrder) { WorkflowState wState = wStates.LastOrDefault(); Order = wState.Order; wState.Order++; wState.Update(); CacheFactory.Clear(CacheFactory.Keys.Workflow); return(Order); } else { if (DeletedWorkflowStateOrder.HasValue) { wStates = wStates.Where(ws => ws.Order > DeletedWorkflowStateOrder).ToList(); } foreach (WorkflowState wState in wStates) { wState.Order--; wState.Update(); } CacheFactory.Clear(CacheFactory.Keys.Workflow); return(DeletedWorkflowStateOrder.Value); } }
internal static WorkflowState UpdateWorkflowState(WorkflowState WorkflowState) { if (WorkflowState.StateID == 0) { WorkflowState.Insert(); } else { WorkflowState.Update(); } CacheFactory.Clear(CacheFactory.Keys.Workflow); return(WorkflowState); }