Class ServerTask
Implements
Inherited Members
Namespace: LemonEdge.API.Entities.Tasks
Assembly: LemonEdge.API.Entities.Auto.dll
Syntax
[DataContract]
public class ServerTask : BaseEntityWithPermissions, IServerTask, IBaseEntityWithPermissions, ICanBeLocked, IQueueableItemOnSave, IBaseEntity, IEquatable<IBaseEntity>, INotifyPropertyChanged, INotifyPropertyChanging, ICloneableAsync, ICanTrackProperties, ISetCopier, ICloneableAsync<IServerTask>
Constructors
ServerTask()
Declaration
public ServerTask()
Properties
Cancel
Indicates the user has cancelled the execution of this task.
Declaration
public bool Cancel { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ChainRecreateWhenChaining
Indicates the chained task is re-created as a chained task in the created task - this creates a recursive set of tasks that are created and executed until the ChainedGuardFormula fails
Declaration
public bool ChainRecreateWhenChaining { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ChainedGuardFormula
A formula that when returning true indicates we should run the chained task
Declaration
public string ChainedGuardFormula { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ChainedTaskType
The typeof task to run on the server as a chained task after this onee is complete.
Declaration
public Guid? ChainedTaskType { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid? |
Description
A user friendly description of the task to be processed
Declaration
[StringLength(2000)]
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Enabled
Indicates if this task is enabled - only enabled tasks will be processed by the task services
Declaration
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
EndRunDate
If this task has an Occurrence and Frequency (i.e. is set to repeat) then this date indicates the date the repeating task should stop.
This doesn't have to be set - if it is blank, a task will repeat forever.
Declaration
public DateTimeOffset? EndRunDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset? |
EndedRunDate
Holds the data and time the task services finished processing this task.
Declaration
public DateTimeOffset? EndedRunDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset? |
Frequency
Used in conjunction with Occurrence to specify how often the task should repeat.
i.e.with an Occurrence of Days and a Frequency of 1, the task would repeat every day.With an Occurrence of Months and a Frequency of 3, it would repeat every 3 months (or quarter).
Declaration
public short Frequency { get; set; }
Property Value
| Type | Description |
|---|---|
| short |
HasResult
Returns true if this task has a result record in IServerTaskData
Declaration
public bool HasResult { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Locked
Indicates the current record is locked and can not be modified until it is unlocked.
Declaration
[Required]
public bool Locked { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
NextRunDate
If this is a scheduled task to run at some point in the future, this will hold the date/time the task should next run.
If this is blank then the task should be processed at the earliest possible convinience
Declaration
public DateTimeOffset? NextRunDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset? |
Occurance
If this task is to repeat then you can use this to specify how often you want it to repeat [Days, Weeks, Months, Years]
Declaration
[EnumDataType(typeof(ServerTaskOccurrence))]
public ServerTaskOccurrence? Occurance { get; set; }
Property Value
| Type | Description |
|---|---|
| ServerTaskOccurrence? |
Occurance_Tooltip
Declaration
[NotMapped]
public string Occurance_Tooltip { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RunAsUser
The user to run the task under
Declaration
public Guid? RunAsUser { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid? |
RunAsUser_Label
Declaration
public string RunAsUser_Label { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RunAsUser_Label_Silent
Declaration
[NotMapped]
public string RunAsUser_Label_Silent { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
StartedRunDate
Holds the date and time the task was picked up by a task service and started processing.
Declaration
public DateTimeOffset? StartedRunDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset? |
Status
The status of the task
Declaration
[EnumDataType(typeof(ServerTaskStatusEnum))]
public ServerTaskStatusEnum Status { get; set; }
Property Value
| Type | Description |
|---|---|
| ServerTaskStatusEnum |
Status_Tooltip
Declaration
[NotMapped]
public string Status_Tooltip { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
TaskType
The type of task being processed. Custom tasks coded against our API (inheriting from ITaskProcessor) will also appear here.
Declaration
public Guid TaskType { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid |
TotalRunTime
Holds the total amount of time spent processing the task (End Run Date - Started Run Date).
Is a calculated property, is not stored in the database
Declaration
[NotMapped]
[JsonIgnore]
public string TotalRunTime { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
CopyFromEntity(IBaseEntity)
Declaration
protected override void CopyFromEntity(IBaseEntity src)
Parameters
| Type | Name | Description |
|---|---|---|
| IBaseEntity | src |
Overrides
CopyFromSource(IServerTask)
Updates all properties in this item to have the same properties as the source object.
Declaration
public void CopyFromSource(IServerTask source)
Parameters
| Type | Name | Description |
|---|---|---|
| IServerTask | source | The source object to copy all values from. |
QueueItem(string, DateTimeOffset, IStorageService, string)
This item has been successfully saved by the platform, and now can be added to a queue for external processing
Declaration
public Task QueueItem(string databaseConnection, DateTimeOffset committedDateTime, IStorageService queueStorage, string queueName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | databaseConnection | |
| DateTimeOffset | committedDateTime | The date/time stamp the item was saved |
| IStorageService | queueStorage | A storage manager that has a queue implementation for saving queue messages |
| string | queueName | Queue Name from Task Service |
Returns
| Type | Description |
|---|---|
| Task | A task indicating the completion of this operation |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |