Table of Contents

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

CacheInformation

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 string

Task name

taskAddIn MethodScheduledTaskAddIn

Task addin

repeatIntervalInMinutes int

Task 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 int

Key to reset

DeleteById(int)

Deletes task with specific id

public void DeleteById(int id)

Parameters

id int

ID of task to be deleted

GetLastExistingTaskName(string)

Gets last existing task name

public string GetLastExistingTaskName(string name)

Parameters

name string

Name of task

Returns

string

Last existing task name

GetParentTasks()

Gets the main tasks

public List<Task> GetParentTasks()

Returns

List<Task>

List of parent tasks

GetTaskById(int)

Gets a task by id

public Task? GetTaskById(int id)

Parameters

id int

Identifier of the task

Returns

Task

Task, if found, otherwise null.

GetTaskByName(string)

Gets last existing task name

public Task? GetTaskByName(string name)

Parameters

name string

Name 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 Type

The task type, which is inherited from BaseScheduledTaskAddIn

Returns

IEnumerable<Task>

GetTasksByAddInType<T>()

Gets the tasks which assembly matches the specified type.

public IEnumerable<Task> GetTasksByAddInType<T>() where T : BaseScheduledTaskAddIn

Returns

IEnumerable<Task>

Type Parameters

T

GetTasksByParentId(int)

Gets the sub tasks from the parent task

public List<Task> GetTasksByParentId(int parentId)

Parameters

parentId int

Task parent id

Returns

List<Task>

Sub tasks from the parent task

Save(Task)

Saves a task

public void Save(Task task)

Parameters

task Task

The task

UpdateEnabled(int, bool)

Change active state of a task

public void UpdateEnabled(int id, bool enabled)

Parameters

id int

Task identifier

enabled bool

Task active state

UpdateRuntime(int, DateTime, DateTime)

Change runtime information for a task

public void UpdateRuntime(int id, DateTime previousRuntime, DateTime nextRuntime)

Parameters

id int

Task identifier

previousRuntime DateTime

Previous runtime

nextRuntime DateTime

Next runtime

To top