Table of Contents

Class Task

Namespace
Dynamicweb.Scheduling
Assembly
Dynamicweb.Core.dll

Represents task

public class Task
Inheritance
Task
Inherited Members

Constructors

Task()

Creates new Task instance

public Task()

Fields

XmlFolder

Xml folder to store scheduled tasks

public static readonly string XmlFolder

Field Value

string

Properties

ActiveImage

Gets active state image

public string ActiveImage { get; }

Property Value

string

Image path

AddInSettings

Gets or sets add-in settings

public string? AddInSettings { get; set; }

Property Value

string

String value

AddInTypeName

Gets or sets add-in type name settings

public string? AddInTypeName { get; set; }

Property Value

string

String value

Begin

Gets or sets task begin datetime stamp

public DateTime Begin { get; set; }

Property Value

DateTime

DateTime stamp

CheckPreviousTask

Run the task only if previous task executed with Success

public bool CheckPreviousTask { get; set; }

Property Value

bool

Comment

Gets or sets task comment

public string? Comment { get; set; }

Property Value

string

ConfigFilePath

Gets or sets config xml file

public string? ConfigFilePath { get; set; }

Property Value

string

Day

Gets or sets day value

public int Day { get; set; }

Property Value

int

Integer value

DayOfWeek

Gets or sets week day

public int DayOfWeek { get; set; }

Property Value

int

Integer value

Enabled

Gets or sets enabled state

public bool Enabled { get; set; }

Property Value

bool

True or false value

End

Gets or sets task end datetime stamp

public DateTime End { get; set; }

Property Value

DateTime

DateTime stamp

Hour

Gets or sets hour value

public int Hour { get; set; }

Property Value

int

Integer value

ID

Gets task identifier

public int ID { get; }

Property Value

int

Identifier

public string Identifier { get; }

Property Value

string

LastEventId

Gets or sets task last Event id

public int LastEventId { get; set; }

Property Value

int

LastException

Gets or sets task last exception

public string? LastException { get; set; }

Property Value

string

LastResult

Gets or sets task last result

public bool? LastResult { get; set; }

Property Value

bool?

LastRun

Gets last run date

public DateTime? LastRun { get; }

Property Value

DateTime?

String representation of last run date

LastRunState

Gets task last run state

public TaskLastRunState LastRunState { get; }

Property Value

TaskLastRunState

LogFileName

Returns Log file name (like 'Import data with custom request add-in20240209-1244344396042_77.log')

public string LogFileName { get; }

Property Value

string

LogFileTimeStamp

Log file time stamp like 20240209-1031436943489

public string? LogFileTimeStamp { get; set; }

Property Value

string

Minute

Gets or sets minute value

public int Minute { get; set; }

Property Value

int

Integer value

Name

Gets or sets task name

public string Name { get; set; }

Property Value

string

NextRun

Gets next run date

public string NextRun { get; }

Property Value

string

String representation of next run date

ParentId

Gets the parent task identifier

public int? ParentId { get; set; }

Property Value

int?

PreviousRuntime

Gets or sets the date and time of the last task execution.

public DateTime PreviousRuntime { get; set; }

Property Value

DateTime

Schedule

Gets task schedule

public string Schedule { get; }

Property Value

string

String representation of task schedule data

Sort

Gets or sets task sort order

public int Sort { get; set; }

Property Value

int

StartFromLastRun

Gets or sets a value to indicate if next run time should be calculated based on the end of the last run time or based on Begin start time.

public bool StartFromLastRun { get; set; }

Property Value

bool

String value

Remarks

If set to true, a number of minutes will be added to the end of the task run time for the next run time. If set to false, the begin date and time will be used to calculate the next. I.e. always run 24 hours after the last start, i.e. 02.00 every night

Timeout

Returns timeout in seconds

public int Timeout { get; }

Property Value

int

Token

Gets or sets task token

public static string? Token { get; set; }

Property Value

string

UpcomingRuntime

Gets or sets the date and time of the next task execution.

public DateTime UpcomingRuntime { get; set; }

Property Value

DateTime

Methods

AllowedToRun(DateTime)

public bool AllowedToRun(DateTime dateTime)

Parameters

dateTime DateTime

Returns

bool

ChangeActive()

Change active state of current task

public void ChangeActive()

Delete()

Deletes scheduled task

public void Delete()

Delete(int)

Deletes scheduled task with specific id

public static void Delete(int id)

Parameters

id int

ID of task to be deleted

GetAbsoluteConfigFilePath(Task)

Gets the config file path

public static string? GetAbsoluteConfigFilePath(Task task)

Parameters

task Task

Returns

string

GetActivationUrl(Task, string)

Gets the activation URL.

public static string GetActivationUrl(Task task, string domain)

Parameters

task Task

The task.

domain string

The domain. Include the protocol.

Returns

string

Exceptions

ArgumentNullException

domain or task

GetActiveTasksCount()

Gets count of active tasks

public static int GetActiveTasksCount()

Returns

int

Number of active tasks

GetCopy()

Gets the task object copy.

public Task GetCopy()

Returns

Task

Task.

GetLastExistingTaskName(string)

Gets last existing task name

public static string GetLastExistingTaskName(string name)

Parameters

name string

Name of task

Returns

string

Last existing task name

GetParent()

Gets the parent task

public Task? GetParent()

Returns

Task

Parent task

GetTaskById(int)

Gets a task by id

public static Task? GetTaskById(int id)

Parameters

id int

Identifier of the task

Returns

Task

Task, if found, otherwise null.

GetTaskByName(string)

Gets a task by name

public static Task? GetTaskByName(string name)

Parameters

name string

Name of the task

Returns

Task

Task, if found, otherwise null.

GetTasks()

Gets the sub tasks

public IEnumerable<Task> GetTasks()

Returns

IEnumerable<Task>

Sub tasks

ImportXmlTask(string)

Imports task from xml file to database

public static bool ImportXmlTask(string xmlFilePath)

Parameters

xmlFilePath string

Task xml file path

Returns

bool

True if imported, otherwise false

MakeSafeFileName(string)

public static string MakeSafeFileName(string name)

Parameters

name string

Returns

string

RenderStatusIcon()

Renders task last run status icon

public string RenderStatusIcon()

Returns

string

Save()

Saves task

public void Save()

SaveAsXml()

Save task to xml file

public void SaveAsXml()

SaveAsXml(string?)

Save task to xml file

public void SaveAsXml(string? folderPath = null)

Parameters

folderPath string

SetLastRun()

Sets last run date time stamp

public void SetLastRun()

SetNextRun()

Sets task next run date time

public void SetNextRun()
To top