Class TaskService
- Namespace
- Dynamicweb.Scheduling
- Assembly
- Dynamicweb.Core.dll
public class TaskService : ICacheStorage<int, Task>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
TaskService
- Implements
- Inherited Members
Constructors
TaskService()
public TaskService()
Properties
Info
Information about the object cache
public CacheInformation Info { get; }
Property Value
Methods
AddOrUpdateTaskWithAddIn(string, MethodScheduledTaskAddIn, int)
Creates of updated the task found by name with addin settings
public static void AddOrUpdateTaskWithAddIn(string taskName, MethodScheduledTaskAddIn taskAddIn, int repeatIntervalInMinutes = 5)
Parameters
taskName
stringTask name
taskAddIn
MethodScheduledTaskAddInTask addin
repeatIntervalInMinutes
intTask repeat interval
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<int> keys)
Parameters
keys
IEnumerable<int>Keys to reset
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(int key)
Parameters
key
intKey to reset
DeleteById(int)
Deletes task with specific id
public void DeleteById(int id)
Parameters
id
intID of task to be deleted
GetLastExecutionsLogs(int, int)
public IEnumerable<TaskLogLine> GetLastExecutionsLogs(int taskId, int lastExecutionsAmount)
Parameters
Returns
GetLastExistingTaskName(string)
Gets last existing task name
public string GetLastExistingTaskName(string name)
Parameters
name
stringName of task
Returns
- string
Last existing task name
GetParentTasks()
Gets the main tasks
public List<Task> GetParentTasks()
Returns
GetTaskById(int)
Gets a task by id
public Task? GetTaskById(int id)
Parameters
id
intIdentifier of the task
Returns
- Task
Task, if found, otherwise null.
GetTaskByName(string)
Gets last existing task name
public Task? GetTaskByName(string name)
Parameters
name
stringName of task
Returns
- Task
Last existing task name
GetTasks()
Gets all tasks
public IEnumerable<Task> GetTasks()
Returns
- IEnumerable<Task>
All tasks
GetTasksByAddInType(Type)
Gets the tasks which assembly matches the specified type.
public IEnumerable<Task> GetTasksByAddInType(Type type)
Parameters
type
TypeThe task type, which is inherited from BaseScheduledTaskAddIn
Returns
GetTasksByAddInType<T>()
Gets the tasks which assembly matches the specified type.
public IEnumerable<Task> GetTasksByAddInType<T>() where T : BaseScheduledTaskAddIn
Returns
Type Parameters
T
GetTasksByParentId(int)
Gets the sub tasks from the parent task
public List<Task> GetTasksByParentId(int parentId)
Parameters
parentId
intTask parent id
Returns
Save(Task)
Saves a task
public void Save(Task task)
Parameters
task
TaskThe task
UpdateEnabled(int, bool)
Change active state of a task
public void UpdateEnabled(int id, bool enabled)
Parameters
UpdateRuntime(int, DateTime, DateTime)
Change runtime information for a task
public void UpdateRuntime(int id, DateTime previousRuntime, DateTime nextRuntime)