Class OrderProvider
- Namespace
- Dynamicweb.DataIntegration.Providers.OrderProvider
- Assembly
- Dynamicweb.DataIntegration.dll
[AddInName("Dynamicweb.DataIntegration.Providers.Provider")]
[AddInLabel("Order Provider")]
[AddInDescription("Order provider")]
[AddInIgnore(false)]
public class OrderProvider : BaseSqlProvider, IParameterizedDestination, IParameterOptions, ISource, IDestination
- Inheritance
-
OrderProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
OrderProvider()
public OrderProvider()
OrderProvider(string)
public OrderProvider(string connectionString)
Parameters
connectionStringstring
OrderProvider(XmlNode)
public OrderProvider(XmlNode xmlNode)
Parameters
xmlNodeXmlNode
Properties
DiscardDuplicates
[AddInParameter("Discard duplicates")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Destination")]
public bool DiscardDuplicates { get; set; }
Property Value
DoNotExportCarts
[AddInParameter("Export completed orders only")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "", Explanation = "Only export completed orders (order type). Carts and other order types are excluded.")]
[AddInParameterGroup("Source")]
public virtual bool DoNotExportCarts { get; set; }
Property Value
ExportNotExportedOrders
[AddInParameter("Export not yet exported Orders")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "", Explanation = "Only export orders that have not previously been exported.")]
[AddInParameterGroup("Source")]
public virtual bool ExportNotExportedOrders { get; set; }
Property Value
ExportOnlyOrdersWithoutExtID
[AddInParameter("Only export orders without externalID")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "", Explanation = "Skip orders that already have an external ID assigned.")]
[AddInParameterGroup("Source")]
public virtual bool ExportOnlyOrdersWithoutExtID { get; set; }
Property Value
OnlyExportOrdersForShop
[AddInParameter("Only export orders for shop")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "none=true;noneText=All shops;", Explanation = "Limit export to orders placed in this shop.")]
[AddInParameterGroup("Source")]
public virtual string? OnlyExportOrdersForShop { get; set; }
Property Value
OnlyExportOrdersWithState
[AddInParameter("Only export orders with state")]
[AddInParameterEditor(typeof(GroupedDropDownParameterEditor), "none=true;noneText=All states;", Explanation = "Limit export to orders in this state. Only states for the Order type are listed.")]
[AddInParameterGroup("Source")]
public virtual string? OnlyExportOrdersWithState { get; set; }
Property Value
OrderStateAfterExport
[AddInParameter("Order state after export")]
[AddInParameterEditor(typeof(GroupedDropDownParameterEditor), "none=true;noneText=Leave unchanged;", Explanation = "Automatically move exported orders to this state after a successful export.")]
[AddInParameterGroup("Source")]
public virtual string? OrderStateAfterExport { get; set; }
Property Value
RemoveMissingOrderLines
[AddInParameter("Remove missing order lines")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Destination")]
public bool RemoveMissingOrderLines { get; set; }
Property Value
SkipFailingRows
[AddInParameter("Persist successful rows and skip failing rows")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Destination")]
[AddInParameterOrder(100)]
public bool SkipFailingRows { get; set; }
Property Value
Methods
Close()
Closes the provider when the job has finished, releasing connections and other resources. Called on both the source and the destination provider. Must be overridden; the base implementation throws NotImplementedException.
public override void Close()
GetOriginalDestinationSchema()
Gets the unmodified schema as read from the underlying destination, ignoring any user edits. Used by the job editor to reset or compare schemas. Must be overridden by destination providers; the base implementation throws NotImplementedException.
public override Schema GetOriginalDestinationSchema()
Returns
- Schema
The original destination schema.
GetOriginalSourceSchema()
Gets the unmodified schema as read from the underlying source, ignoring any user edits. Used by the job editor to reset or compare schemas. Must be overridden by source providers; the base implementation throws NotImplementedException.
public override Schema GetOriginalSourceSchema()
Returns
- Schema
The original source schema.
GetParameterOptions(string)
public IEnumerable<ParameterOption> GetParameterOptions(string parameterName)
Parameters
parameterNamestring
Returns
GetReader(Mapping)
Creates a reader that returns the source rows for a table mapping. Called by the destination provider's RunJob(Job) once per active mapping when this provider is the source of the job; the returned reader is drained via IsDone()/GetNext() and disposed afterwards. Must be overridden by source providers; the base implementation throws NotImplementedException.
public override ISourceReader GetReader(Mapping mapping)
Parameters
mappingMappingThe table mapping to read source rows for.
Returns
- ISourceReader
A reader positioned at the first row of the mapped source table.
LoadSettings(Job)
Called before the job runs to let the provider read settings from the job it participates in. Override to pick up job-level configuration; the default implementation does nothing.
public override void LoadSettings(Job job)
Parameters
jobJobThe job the provider is the source or destination of.
OrderTablesInJob(Job, bool)
Reorders the job's table mappings so tables referenced by foreign keys are processed before the tables that reference them. Called by the administration UI when table mappings are saved. The base implementation opens a connection to the Dynamicweb database and delegates to OrderTablesByConstraints(Job, SqlConnection, bool); override it to use the provider's own connection, or to enforce a provider-specific order as the Ecom, Order and User providers do.
public override void OrderTablesInJob(Job job, bool isSource)
Parameters
jobJobThe job whose mappings are reordered in place.
isSourcebooltrueto order by source table names; otherwise by destination table names.
OverwriteDestinationSchemaToOriginal()
Discards user edits to the destination schema and reverts to GetOriginalDestinationSchema(). Must be overridden by destination providers; the base implementation throws NotImplementedException.
public override void OverwriteDestinationSchemaToOriginal()
OverwriteSourceSchemaToOriginal()
Discards user edits to the source schema and reverts to GetOriginalSourceSchema(). Must be overridden by source providers; the base implementation throws NotImplementedException.
public override void OverwriteSourceSchemaToOriginal()
RunJob(Job)
Executes the job with this provider as the destination. Called once by the job engine; the implementation
loops the active table mappings, reads the rows from job.Source via
GetReader(Mapping), processes each row with
ProcessInputRow(Dictionary<string, object>, Mapping) and writes it to the destination.
Must be overridden by destination providers; the base implementation throws
NotImplementedException.
public override bool RunJob(Job job)
Parameters
jobJobThe job to run.
Returns
Serialize()
Serializes the provider configuration to an XML fragment string, used when the provider settings are stored
as part of a job definition. Must round-trip with the Ctor(XmlNode) constructor. The base
implementation throws NotImplementedException.
public override string Serialize()
Returns
- string
The provider configuration as an XML string.
UpdateDestinationSettings(IDestination)
Copies the settings of another instance of the same provider into this instance, used when the job editor saves updated destination settings onto an existing job. Must be overridden by destination providers; the base implementation throws NotImplementedException.
public override void UpdateDestinationSettings(IDestination destination)
Parameters
destinationIDestinationThe instance holding the new settings; cast to the concrete provider type.
UpdateSourceSettings(ISource)
Copies the settings of another instance of the same provider into this instance, used when the job editor saves updated source settings onto an existing job. Must be overridden by source providers; the base implementation throws NotImplementedException.
public override void UpdateSourceSettings(ISource source)
Parameters
sourceISourceThe instance holding the new settings; cast to the concrete provider type.
ValidateDestinationSettings()
Validates the destination settings. Used to validate properties when created by the AddinSelector.
public override string ValidateDestinationSettings()
Returns
ValidateSourceSettings()
Validates the source settings when the provider is configured as a source in the job editor. Override to check connectivity, file existence and similar; return an error description to show the user, or a non-error string when valid.
public override string ValidateSourceSettings()
Returns
- string
A validation message; the default implementation performs no validation.