Class BatchTaskBase
Base class for tasks to be executed by the BatchTaskFactory.
Inheritance
Implements
Inherited Members
Namespace: SuperOffice.CRM.BatchProcessing.Tasks
Assembly: SoBatchProcessing.dll
Syntax
public abstract class BatchTaskBase : IBatchTask
Constructors
BatchTaskBase()
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected BatchTaskBase()
Fields
_isEnding
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected bool _isEnding
Field Value
Type | Description |
---|---|
bool |
_statusUpdateInterval
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected long _statusUpdateInterval
Field Value
Type | Description |
---|---|
long |
Properties
BatchTaskInfo
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected BatchTaskInfo BatchTaskInfo { get; }
Property Value
Type | Description |
---|---|
BatchTaskInfo |
Context
Context of the task
Declaration
public string Context { get; }
Property Value
Type | Description |
---|---|
string |
Id
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected int Id { get; }
Property Value
Type | Description |
---|---|
int |
Name
Name of the task.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Result
Result of the task.
Declaration
public string Result { get; }
Property Value
Type | Description |
---|---|
string |
State
State of the executing task.
Declaration
public BatchTaskState State { get; }
Property Value
Type | Description |
---|---|
BatchTaskState |
Methods
EndTask()
Set a flag to notify the task should be stopped.
Declaration
public void EndTask()
EnsureUdefs()
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected void EnsureUdefs()
GetTaskInfo()
Get information about the currently executing task.
Declaration
public BatchTaskInfo GetTaskInfo()
Returns
Type | Description |
---|---|
BatchTaskInfo | Information about the currently executing task. |
ProgressCallback(int, int, ref bool)
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected void ProgressCallback(int total, int current, ref bool cancel)
Parameters
Type | Name | Description |
---|---|---|
int | total | |
int | current | |
bool | cancel |
Run(string, string)
Run the task.
Declaration
protected abstract bool Run(string name, string context)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the task. |
string | context | Context for the task. |
Returns
Type | Description |
---|---|
bool | True if the task succeeded. |
Remarks
Call SetResult(string) as needed.
SaveStreamToBlob(Stream, string, string, string)
Base class for tasks to be executed by the BatchTaskFactory.
Declaration
protected int SaveStreamToBlob(Stream stream, string description = null, string extraInfo = null, string linkComment = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | |
string | description | |
string | extraInfo | |
string | linkComment |
Returns
Type | Description |
---|---|
int |
SetResult(string)
Set the result of the task.
Declaration
protected void SetResult(string result)
Parameters
Type | Name | Description |
---|---|---|
string | result | Result to set on the executing task. |
StartTask(BatchTaskInfo, string, BatchTaskStatusChanged)
Start a batch task
Declaration
public BatchTaskInfo StartTask(BatchTaskInfo batchTaskInfo, string context, BatchTaskStatusChanged onBatchTaskStatusChanged)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo | Information about the task to start. |
string | context | |
BatchTaskStatusChanged | onBatchTaskStatusChanged | Notify about changes to the batch task state. |
Returns
Type | Description |
---|---|
BatchTaskInfo | Returns a BatchTaskInfo with information about the started task |
StartTask(int, string, string, BatchTaskStatusChanged)
Start an already existing batch task
Declaration
public BatchTaskInfo StartTask(int id, string name, string context, BatchTaskStatusChanged onBatchTaskStatusChanged)
Parameters
Type | Name | Description |
---|---|---|
int | id | Id of the batch task. |
string | name | Name of the batch task |
string | context | |
BatchTaskStatusChanged | onBatchTaskStatusChanged | Notify about changes to the batch task state. |
Returns
Type | Description |
---|---|
BatchTaskInfo | Returns a BatchTaskInfo with information about the started task |