Ejemplo n.º 1
0
        public void RegisterTimer(Guid processId, string name, DateTime nextExecutionDateTime, bool notOverrideIfExists)
        {
            using (OracleConnection connection = new OracleConnection(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);
                }

                WorkflowProcessTimer.Commit(connection);
            }
        }
Ejemplo n.º 2
0
 public void ClearTimer(Guid timerId)
 {
     using (OracleConnection connection = new OracleConnection(ConnectionString))
     {
         WorkflowProcessTimer.Delete(connection, timerId);
         WorkflowProcessTimer.Commit(connection);
     }
 }
Ejemplo n.º 3
0
 public void ClearTimersIgnore()
 {
     using (OracleConnection connection = new OracleConnection(ConnectionString))
     {
         WorkflowProcessTimer.ClearTimersIgnore(connection);
         WorkflowProcessTimer.Commit(connection);
     }
 }
Ejemplo n.º 4
0
 public void ClearTimers(Guid processId, List <string> timersIgnoreList)
 {
     using (OracleConnection connection = new OracleConnection(ConnectionString))
     {
         WorkflowProcessTimer.DeleteByProcessId(connection, processId, timersIgnoreList);
         WorkflowProcessTimer.Commit(connection);
     }
 }
Ejemplo n.º 5
0
 public DateTime?GetCloseExecutionDateTime()
 {
     using (var connection = new OracleConnection(ConnectionString))
     {
         var timer = WorkflowProcessTimer.GetCloseExecutionTimer(connection);
         return(timer != null ? timer.NextExecutionDateTime : (DateTime?)null);
     }
 }
Ejemplo n.º 6
0
 public IEnumerable <ProcessTimer> GetTimersForProcess(Guid processId)
 {
     using (var connection = new OracleConnection(ConnectionString))
     {
         var timers = WorkflowProcessTimer.SelectByProcessId(connection, processId);
         return(timers.Select(t => new ProcessTimer {
             Name = t.Name, NextExecutionDateTime = t.NextExecutionDateTime
         }));
     }
 }
Ejemplo n.º 7
0
        public DateTime?GetCloseExecutionDateTime()
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                var timer = WorkflowProcessTimer.GetCloseExecutionTimer(connection);
                if (timer == null)
                {
                    return(null);
                }

                return(timer.NextExecutionDateTime);
            }
        }
Ejemplo n.º 8
0
        public void DeleteProcess(Guid processId)
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString))
            {
                WorkflowProcessInstance.Delete(connection, processId);
                WorkflowProcessInstanceStatus.Delete(connection, processId);
                WorkflowProcessInstancePersistence.DeleteByProcessId(connection, processId);
                WorkflowProcessTransitionHistory.DeleteByProcessId(connection, processId);
                WorkflowProcessTimer.DeleteByProcessId(connection, processId);

                WorkflowProcessInstance.Commit(connection);
            }
        }
Ejemplo n.º 9
0
        public List <TimerToExecute> GetTimersToExecute()
        {
            var now = _runtime.RuntimeDateTimeNow;

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

                return(timers.Select(t => new TimerToExecute()
                {
                    Name = t.Name, ProcessId = t.ProcessId, TimerId = t.Id
                }).ToList());
            }
        }