Esempio n. 1
0
 public void ClearTimersIgnore()
 {
     using (var connection = new NpgsqlConnection(ConnectionString))
     {
         WorkflowProcessTimer.ClearTimersIgnore(connection);
     }
 }
Esempio n. 2
0
 public void ClearTimer(Guid timerId)
 {
     using (var connection = new NpgsqlConnection(ConnectionString))
     {
         WorkflowProcessTimer.Delete(connection, timerId);
     }
 }
Esempio n. 3
0
 public void ClearTimers(Guid processId, List <string> timersIgnoreList)
 {
     using (var connection = new NpgsqlConnection(ConnectionString))
     {
         WorkflowProcessTimer.DeleteByProcessId(connection, processId, timersIgnoreList);
     }
 }
Esempio n. 4
0
        public void RegisterTimer(Guid processId, string name, DateTime nextExecutionDateTime, bool notOverrideIfExists)
        {
            using (var connection = new NpgsqlConnection(ConnectionString))
            {
                var timer = WorkflowProcessTimer.SelectByProcessIdAndName(connection, processId, name);
                if (timer == null)
                {
                    timer = new WorkflowProcessTimer
                    {
                        Id   = Guid.NewGuid(),
                        Name = name,
                        NextExecutionDateTime = nextExecutionDateTime,
                        ProcessId             = processId,
                        Ignore = false
                    };

                    timer.Insert(connection);
                }
                else if (!notOverrideIfExists)
                {
                    timer.NextExecutionDateTime = nextExecutionDateTime;
                    timer.Update(connection);
                }
            }
        }
Esempio n. 5
0
 public IEnumerable <ProcessTimer> GetTimersForProcess(Guid processId)
 {
     using (var connection = new NpgsqlConnection(ConnectionString))
     {
         var timers = WorkflowProcessTimer.SelectByProcessId(connection, processId);
         return(timers.Select(t => new ProcessTimer {
             Name = t.Name, NextExecutionDateTime = t.NextExecutionDateTime
         }));
     }
 }
 public void DeleteProcess(Guid processId)
 {
     using (NpgsqlConnection connection = new NpgsqlConnection(ConnectionString))
     {
         WorkflowProcessInstance.Delete(connection, processId);
         WorkflowProcessInstanceStatus.Delete(connection, processId);
         WorkflowProcessInstancePersistence.DeleteByProcessId(connection, processId);
         WorkflowProcessTransitionHistory.DeleteByProcessId(connection, processId);
         WorkflowProcessTimer.DeleteByProcessId(connection, processId);
     }
 }
Esempio n. 7
0
        public DateTime?GetCloseExecutionDateTime()
        {
            using (var connection = new NpgsqlConnection(ConnectionString))
            {
                var timer = WorkflowProcessTimer.GetCloseExecutionTimer(connection);
                if (timer == null)
                {
                    return(null);
                }

                return(timer.NextExecutionDateTime);
            }
        }
Esempio n. 8
0
        public List <TimerToExecute> GetTimersToExecute()
        {
            var now = _runtime.RuntimeDateTimeNow;

            using (var connection = new NpgsqlConnection(ConnectionString))
            {
                var timers = WorkflowProcessTimer.GetTimersToExecute(connection, now);
                WorkflowProcessTimer.SetIgnore(connection, timers);

                return(timers.Select(t => new TimerToExecute()
                {
                    Name = t.Name, ProcessId = t.ProcessId, TimerId = t.Id
                }).ToList());
            }
        }
Esempio n. 9
0
        public void DeleteProcess(Guid processId)
        {
            using (var connection = new NpgsqlConnection(ConnectionString))
            {
                connection.Open();

                using (var transaction = connection.BeginTransaction())
                {
                    WorkflowProcessInstance.Delete(connection, processId, transaction);
                    WorkflowProcessInstanceStatus.Delete(connection, processId, transaction);
                    WorkflowProcessInstancePersistence.DeleteByProcessId(connection, processId, transaction);
                    WorkflowProcessTransitionHistory.DeleteByProcessId(connection, processId, transaction);
                    WorkflowProcessTimer.DeleteByProcessId(connection, processId, null, transaction);
                    transaction.Commit();
                }
            }
        }