Interface IImportAgent
Interface for the Import Agent This agent can be used to import data into the system
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Import Agent", "Interface for the Import Agent. This agent can be used to import data into the system")]
public interface IImportAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ImportAgent agent = new ImportAgent())
{
// call methods on agent here...
}
}
Methods
CreateDefaultImportLineAsync(int, CancellationToken)
Create a new empty import row with x count of values
Declaration
Task<ImportLine> CreateDefaultImportLineAsync(int countColumns, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | countColumns | The count of values that will can be filled out |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ImportLine> | A new ImportLine |
CreateErpImportDataAsync(ArchiveRestrictionInfo[], string[], int, ErpActorType, CancellationToken)
Populates the ImportLines and columnDefs basedfrom erp system
Declaration
Task<ImportErpData> CreateErpImportDataAsync(ArchiveRestrictionInfo[] restriction, string[] columns, int connectionId, ErpActorType erpActorType, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ArchiveRestrictionInfo[] | restriction | Archive restrictions. |
| string[] | columns | Columns. |
| int | connectionId | Connection id for Erp system |
| ErpActorType | erpActorType | Erp Actor type |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ImportErpData> | The ImportLines and ColumnDefs |
PreviewImportAsync(ImportLine[], string[], string, string, CancellationToken)
Preview the import
Declaration
Task<ImportLine[]> PreviewImportAsync(ImportLine[] importLines, string[] columnDefinition, string culture, string context, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ImportLine[] | importLines | The rows that will be manipulated and according to Import rules |
| string[] | columnDefinition | An array of the columndefinitions, like firstname, lastname, ... |
| string | culture | The current culture used in the import. Used to match language specific strings |
| string | context | Optional context for the import. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ImportLine[]> | An array of the the rows that can be imported, manipulated according to Import rules given |
SaveImportAsync(ImportLine[], string[], bool, string, string, CancellationToken)
Do the actual import
Declaration
Task<int[]> SaveImportAsync(ImportLine[] importLines, string[] columnDefinition, bool createSelection, string culture, string context, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ImportLine[] | importLines | The rows that will be imported |
| string[] | columnDefinition | An array of the columndefinitions, like firstname, lastname, ... |
| bool | createSelection | true if a selection of the imported entities shall be made |
| string | culture | The current culture used in the import. Used to match language specific strings |
| string | context | Optional context for the import. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int[]> | First part: the id of the selection created after the import, 0 if no selection is created. Second part: The number of rows actually imported |