public void DeleteScheduledIntegrationTask(ScheduledIntegrationTask task)
 {
     _dataManager.ScheduledIntegrationTaskRepository.Delete(task);
 }
        private void ExecuteScheduledTask(ScheduledIntegrationTask task)
        {
            task.TaskState = IntegrationTaskState.Running;

            using (var dataManager = GetDataManager())
            {
                dataManager.ScheduledIntegrationTaskRepository.Update(task);
                dataManager.Commit();
            }

            try
            {
                _logger.Info(string.Format("Executing scheduled task {0}", task.Id));
                _sTasksOperations.FirstOrDefault().ProcessTask(task);
                task.TaskState = IntegrationTaskState.Finished;
            }
            catch (Exception exc)
            {
                string errorText = string.Format("Exception occured during scheduled task {0} execution", task.Id);
                _logger.Error(errorText, exc);
                task.TaskState = IntegrationTaskState.Error;
                task.Info = errorText + "\n" + exc.ToString();
            }
            finally
            {
                task.StartTime += task.GetRepeatTimeInterval();
                _logger.Info(string.Format("Manual task {0} execution finished", task.Id));
            }

            using (var dataManager = GetDataManager())
            {
                dataManager.ScheduledIntegrationTaskRepository.Update(task);
                dataManager.Commit();
            }
        }
 public void InsertScheduledIntegrationTask(ScheduledIntegrationTask task)
 {
     _dataManager.ScheduledIntegrationTaskRepository.Insert(task);
 }
 public void DeleteScheduledIntegrationTask(ScheduledIntegrationTask task)
 {
     _logger.MethodEntry();
     try
     {
         using (var serviceManager = ServiceLocator.Current.GetInstance<IServiceManager>())
         {
             serviceManager.DeleteScheduledIntegrationTask(task);
             serviceManager.Commit();
         }
     }
     catch (Exception exc)
     {
         _logger.FatalMethod(exc);
         throw;
     }
     _logger.MethodExit();
 }