Table of Contents

Class Task

Namespace
Dynamicweb.Scheduling
Assembly
Dynamicweb.Scheduling.dll
Represents task
public class Task
Inheritance
Task
Inherited Members

Constructors

Task()

Creates new Task instance
public Task()

Task(IDataReader)

Creates new
[Obsolete]
public Task(IDataReader reader)

Parameters

reader IDataReader

Task(int)

Creates new Task instance
[Obsolete("Use GetTaskById or constructor with no arguments")]
public Task(int id)

Parameters

id int
Task identifier

Task(XmlDocument)

Creates new
public Task(XmlDocument xmlDocument)

Parameters

xmlDocument XmlDocument

Fields

XmlFolder

Xml folder to store scheduled tasks
public static readonly string XmlFolder

Field Value

string

Properties

Activation

public ActivationVariant Activation { get; set; }

Property Value

ActivationVariant

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

Args

Gets or sets arguments
public string[] Args { get; set; }

Property Value

string[]
Array of strings

Assembly

Gets or sets assembly
public string Assembly { 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

Class

Gets or sets class
public string Class { get; set; }

Property Value

string
String value

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

IsXmlTask

Is task from xml file
public bool IsXmlTask { get; }

Property Value

bool

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 string LastRun { get; }

Property Value

string
String representation of last run date

LastRunState

Gets task last run state
public TaskLastRunState LastRunState { get; }

Property Value

TaskLastRunState

LastRunTime

[Obsolete("Use PreviousRuntime instead.")]
public DateTime LastRunTime { get; set; }

Property Value

DateTime

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

Namespace

Gets or sets namespace
public string Namespace { get; set; }

Property Value

string
String value

NextRun

Gets next run date
public string NextRun { get; }

Property Value

string
String representation of next run date

NextRunTime

[Obsolete("Use UpcomingRuntime instead.")]
public DateTime NextRunTime { get; set; }

Property Value

DateTime

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

Target

Gets or sets target
public string Target { get; set; }

Property Value

string
String value

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

Type

Gets or sets
[Obsolete("Use Activation instead")]
public int Type { get; set; }

Property Value

int
Integer value

UpcomingRuntime

Gets or sets the date and time of the next task execution.
public DateTime UpcomingRuntime { get; set; }

Property Value

DateTime

Wday

[Obsolete("Use DayOfWeek instead.")]
public int Wday { get; set; }

Property Value

int

Methods

AllowedToRun(DateTime)

public bool AllowedToRun(DateTime dateTime)

Parameters

dateTime DateTime

Returns

bool

ChangeActive()

Change active state of current task
public void ChangeActive()

ChangeActive(int, string, bool)

Change active state of current task
public static int ChangeActive(int type, string target, bool active)

Parameters

type int
Type of task
target string
Task target
active bool
Is active

Returns

int
The number of rows affected with update sql command

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()

Gets the config file path
public string GetAbsoluteConfigFilePath()

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

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.

GetTaskFromXmlByName(string)

Gets task from xml file by task name
public static Task GetTaskFromXmlByName(string name)

Parameters

name string
task name

Returns

Task

GetXmlTasks()

Gets xml tasks
public static List<Task> GetXmlTasks()

Returns

List<Task>

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()

SetLastRun()

Sets last run date time stamp
public void SetLastRun()

SetNextRun()

Sets task next run date time
public void SetNextRun()
To top