Class TaskService
- Namespace
- Dynamicweb.Scheduling
- Assembly
- Dynamicweb.Core.dll
public class TaskService : ICacheStorage<int, Task>, ICacheStorage<int>, ICacheStorage
- Inheritance
-
TaskService
- Implements
- Inherited Members
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
taskNamestringTask name
taskAddInMethodScheduledTaskAddInTask addin
repeatIntervalInMinutesintTask 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
keysIEnumerable<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
keyintKey to reset
DeleteById(int)
Deletes task with specific id
public virtual void DeleteById(int id)
Parameters
idintID of task to be deleted
DeleteTasksByFolderId(int)
Deletes all tasks that are associated with the specified folder ID.
public virtual void DeleteTasksByFolderId(int folderId)
Parameters
folderIdintThe folder Id
GetLastExecutionsLogs(int, int)
public virtual IEnumerable<TaskLogLine> GetLastExecutionsLogs(int taskId, int lastExecutionsAmount)
Parameters
Returns
GetLastExistingTaskName(string)
Gets last existing task name
public virtual string GetLastExistingTaskName(string name)
Parameters
namestringName of task
Returns
- string
Last existing task name
GetParentTasks()
Gets the main tasks
public virtual List<Task> GetParentTasks()
Returns
GetTaskById(int)
Gets a task by id
public virtual Task? GetTaskById(int id)
Parameters
idintIdentifier of the task
Returns
- Task
Task, if found, otherwise null.
GetTaskByName(string)
Gets last existing task name
public virtual Task? GetTaskByName(string name)
Parameters
namestringName of task
Returns
- Task
Last existing task name
GetTasks()
Gets all tasks
public virtual IEnumerable<Task> GetTasks()
Returns
- IEnumerable<Task>
All tasks
GetTasksByAddInType(Type)
Gets the tasks which assembly matches the specified type.
public virtual IEnumerable<Task> GetTasksByAddInType(Type type)
Parameters
typeTypeThe task type, which is inherited from BaseScheduledTaskAddIn
Returns
GetTasksByAddInType<T>()
Gets the tasks which assembly matches the specified type.
public virtual IEnumerable<Task> GetTasksByAddInType<T>() where T : BaseScheduledTaskAddIn
Returns
Type Parameters
T
GetTasksByFolderId(int)
public virtual IEnumerable<Task> GetTasksByFolderId(int folderId)
Parameters
folderIdint
Returns
GetTasksByParentId(int)
Gets the sub tasks from the parent task
public virtual List<Task> GetTasksByParentId(int parentId)
Parameters
parentIdintTask parent id
Returns
Save(Task)
Saves a task
public virtual void Save(Task task)
Parameters
taskTaskThe task
UpdateEnabled(int, bool)
Change active state of a task
public virtual void UpdateEnabled(int id, bool enabled)
Parameters
UpdateRuntime(int, DateTime, DateTime)
Change runtime information for a task
public virtual void UpdateRuntime(int id, DateTime previousRuntime, DateTime nextRuntime)