Class BatchData
BatchData handles all batch database access.
Namespace: SuperOffice.CRM.BatchProcessing
Assembly: SoBatchProcessing.dll
Syntax
public class BatchData : Object
Constructors
BatchData()
BatchData handles all batch database access.
Declaration
public BatchData()
Methods
AquireTask(BatchTaskInfo)
When a task is retrieved from the batch task system and is ready to be started, we need a mechanism that will ensure a task is not started by two or more instances of a batch service. Before starting a task, try to aquire it with this method.
Declaration
public static bool AquireTask(BatchTaskInfo batchTaskInfo)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo |
Returns
Type | Description |
---|---|
Boolean | True if the task was aquired, false if someone else had aquired it before we got to do it. |
DeleteBatchTask(Int32)
Delete a batch task from the database.
Declaration
public static bool DeleteBatchTask(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id |
Returns
Type | Description |
---|---|
Boolean |
DeleteBatchTasks(Int32[])
Delete batch tasks from the database.
Declaration
public static bool DeleteBatchTasks(int[] ids)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | ids | Array of ids to delete. |
Returns
Type | Description |
---|---|
Boolean |
DeserializeFromBinaryObjectRowToParameterObject(Int32)
Deserialize an entry in BinaryObjectRow to a object.
Declaration
protected static StringDictionary DeserializeFromBinaryObjectRowToParameterObject(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | Id of the row to deserialize |
Returns
Type | Description |
---|---|
StringDictionary | The deserialized object. |
GetBatchTaskInfo(Int32)
Get information about a specified task.
Declaration
public static BatchTaskInfo GetBatchTaskInfo(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | batch task id. |
Returns
Type | Description |
---|---|
BatchTaskInfo |
GetBatchTasks(Int32, BatchTaskState)
Get all tasks for a specified user and state.
Declaration
public static BatchTaskInfo[] GetBatchTasks(int associateId, BatchTaskState state)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | The user to get tasks for. |
BatchTaskState | state | Get tasks with a BatchTaskState state |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | SuperOffice.CRM.Services.BatchTaskInfo collection |
GetBatchTasks(Int32[], BatchTaskState)
Get all tasks for specified users and state.
Declaration
public static BatchTaskInfo[] GetBatchTasks(int[] associateIds, BatchTaskState state)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | associateIds | The users to get tasks for. |
BatchTaskState | state | Get tasks with a BatchTaskState state |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | SuperOffice.CRM.Services.BatchTaskInfo collection |
GetBatchTasks(Int32[], BatchTaskState, DateTime, DateTime)
Get all tasks for a specified user and state in a specified time period.
Declaration
public static BatchTaskInfo[] GetBatchTasks(int[] associateIds, BatchTaskState state, DateTime fromDate, DateTime toDate)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | associateIds | |
BatchTaskState | state | |
DateTime | fromDate | Do not get task created before this date. Use DateTime.MinValue for no restriction. |
DateTime | toDate | Do not get task created after this date. Use DateTime.MaxValue for no restriction. |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | An array of BatchTaskInfo |
GetBatchTasks(String, Int32[], BatchTaskState, DateTime, DateTime)
BatchData handles all batch database access.
Declaration
public static BatchTaskInfo[] GetBatchTasks(string batchDefinitionName, int[] associateIds, BatchTaskState state, DateTime fromDate, DateTime toDate)
Parameters
Type | Name | Description |
---|---|---|
String | batchDefinitionName | |
Int32[] | associateIds | |
BatchTaskState | state | |
DateTime | fromDate | |
DateTime | toDate |
Returns
Type | Description |
---|---|
BatchTaskInfo[] |
GetSystemBatchTasks(BatchTaskState)
Get all tasks marked as system tasks for a specified state
Declaration
public static BatchTaskInfo[] GetSystemBatchTasks(BatchTaskState state)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskState | state | Get tasks with a BatchTaskState state |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | SuperOffice.CRM.Services.BatchTaskInfo collection |
GetUserBatchTasks(BatchTaskState)
Get all user tasks for a specified state
Declaration
public static BatchTaskInfo[] GetUserBatchTasks(BatchTaskState state)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskState | state | Get tasks with a BatchTaskState state |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | SuperOffice.CRM.Services.BatchTaskInfo collection |
GetUserBatchTasks(String, BatchTaskState)
Get all user tasks for a specified batchtask definition and state
Declaration
public static BatchTaskInfo[] GetUserBatchTasks(string batchDefinitionName, BatchTaskState state)
Parameters
Type | Name | Description |
---|---|---|
String | batchDefinitionName | Batch task definition name |
BatchTaskState | state | Get tasks with a BatchTaskState state |
Returns
Type | Description |
---|---|
BatchTaskInfo[] | SuperOffice.CRM.Services.BatchTaskInfo collection |
PopulateBatchTaskInfoFromRow(BatchTaskRow)
Take a BatchTaskRow and return a SuperOffice.CRM.Services.BatchTaskInfo object
Declaration
protected static BatchTaskInfo PopulateBatchTaskInfoFromRow(BatchTaskRow row)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskRow | row |
Returns
Type | Description |
---|---|
BatchTaskInfo |
RegisterPlugin(String)
Register a plugin to the BatchTaskDefinition table
Declaration
public static int RegisterPlugin(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name |
Returns
Type | Description |
---|---|
Int32 |
SaveBatchTaskInfo(BatchTaskInfo)
Save a new BatchTaskInfo to the database
Declaration
public static int SaveBatchTaskInfo(BatchTaskInfo batchTaskInfo)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo |
Returns
Type | Description |
---|---|
Int32 |
SaveBatchTaskInfo(BatchTaskInfo, StringDictionary)
Save a new BatchTaskInfo to the database a parameter object saved to BinaryObject table.
Declaration
public static int SaveBatchTaskInfo(BatchTaskInfo batchTaskInfo, StringDictionary parameterObject)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo | |
StringDictionary | parameterObject | A serializable object. Will be saved to BinaryObject table. The link will be set using DetailsTable and DetailsRecord in object BatchTaskInfo. |
Returns
Type | Description |
---|---|
Int32 |
SerializeParameterObjectToBinaryObjectRow(StringDictionary)
Serialize a StringDictionary to a row in BinaryObjectRow
Declaration
protected static BinaryObjectRow SerializeParameterObjectToBinaryObjectRow(StringDictionary stringDictionary)
Parameters
Type | Name | Description |
---|---|---|
StringDictionary | stringDictionary | StringDictionary to serialize |
Returns
Type | Description |
---|---|
BinaryObjectRow |
Remarks
The object must be serializable.
SetBatchTaskInfoState(BatchTaskInfo, BatchTaskState)
Update state on a BatchTaskInfo row
Declaration
public static void SetBatchTaskInfoState(BatchTaskInfo batchTaskInfo, BatchTaskState state)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo | |
BatchTaskState | state |
UpdateBatchTask(BatchTaskInfo)
Update information about a BatchTask.
Declaration
public static BatchTaskInfo UpdateBatchTask(BatchTaskInfo batchTaskInfo)
Parameters
Type | Name | Description |
---|---|---|
BatchTaskInfo | batchTaskInfo | The updated information to save. |
Returns
Type | Description |
---|---|
BatchTaskInfo | The updated BatchTaskInfo |