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
Properties
Activation
public ActivationVariant Activation { get; set; }
Property Value
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
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
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
Identifier
public string Identifier { get; }
Property Value
IsXmlTask
Is task from xml file
public bool IsXmlTask { get; }
Property Value
LastEventId
Gets or sets task last Event id
public int LastEventId { get; set; }
Property Value
LastException
Gets or sets task last exception
public string LastException { get; set; }
Property Value
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
LastRunTime
[Obsolete("Use PreviousRuntime instead.")]
public DateTime LastRunTime { get; set; }
Property Value
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
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
PreviousRuntime
Gets or sets the date and time of the last task execution.
public DateTime PreviousRuntime { get; set; }
Property Value
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
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
Token
Gets or sets task token
public static string Token { get; set; }
Property Value
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
Wday
[Obsolete("Use DayOfWeek instead.")]
public int Wday { get; set; }
Property Value
Methods
AllowedToRun(DateTime)
public bool AllowedToRun(DateTime dateTime)
Parameters
dateTime
DateTime
Returns
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
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
GetActivationUrl(Task, string)
Gets the activation URL.
public static string GetActivationUrl(Task task, string domain)
Parameters
Returns
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
GetXmlTasks()
Gets xml tasks
public static List<Task> GetXmlTasks()
Returns
MakeSafeFileName(string)
public static string MakeSafeFileName(string name)
Parameters
name
string
Returns
RenderStatusIcon()
Renders task last run status icon
public string RenderStatusIcon()
Returns
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()