public void DeleteWorkflow(Entities.Workflow workflow)
 {
     using (var context = DataContext.Instance())
     {
         var rep = context.GetRepository <Entities.Workflow>();
         rep.Delete(workflow);
     }
 }
Esempio n. 2
0
 private static void CacheWorkflow(Entities.Workflow workflow)
 {
     if (workflow.WorkflowID > 0)
     {
         CBO.GetCachedObject <Entities.Workflow>(new CacheItemArgs(GetWorkflowItemKey(workflow.WorkflowID),
                                                                   DataCache.WorkflowsCacheTimeout, DataCache.WorkflowsCachePriority), _ => workflow);
     }
 }
Esempio n. 3
0
        public void DeleteWorkflow(Entities.Workflow workflow)
        {
            using (var context = DataContext.Instance())
            {
                var rep = context.GetRepository <Entities.Workflow>();
                rep.Delete(workflow);
            }

            DataCache.RemoveCache(GetWorkflowItemKey(workflow.WorkflowID));
        }
        // TODO: validation
        public void UpdateWorkflow(Entities.Workflow workflow)
        {
            using (var context = DataContext.Instance())
            {
                var rep = context.GetRepository <Entities.Workflow>();

                if (DoesExistWorkflow(workflow, rep))
                {
                    throw new WorkflowNameAlreadyExistsException();
                }
                rep.Update(workflow);
            }
        }
 private static bool DoesExistWorkflow(Entities.Workflow workflow, IRepository <Entities.Workflow> rep)
 {
     return(rep.Find(
                "WHERE IsDeleted = 0 AND (PortalId = @0 OR PortalId IS NULL) AND WorkflowName = @1 AND WorkflowID != @2",
                workflow.PortalID, workflow.WorkflowName, workflow.WorkflowID).SingleOrDefault() != null);
 }