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

                    timer.Ignore = false;
                    timer.Insert(connection);
                }

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

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

            using (MySqlConnection connection = new MySqlConnection(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();
            }
        }
Example #10
0
        public void DeleteProcess(Guid processId)
        {
            using (var connection = new MySqlConnection(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();
                }
            }
        }