/// <summary> /// Initialises the import. /// </summary> /// <param name="transformId">The transform id.</param> /// <param name="iterator">The transaction iterator object.</param> /// <param name="updateOperation">The update operation for the import.</param> /// <param name="errorAction">The error action.</param> /// <param name="wrapper">The wrapper object.</param> public void Initialise(string transformId, TransactionIterator iterator, eERPUpdateOperation updateOperation, eTransformErrorAction errorAction, ImportHelper wrapper, SystemConnectorDTO system, ITransformAuditController auditController) { _transformId = transformId; _iterator = iterator; _updateOp = updateOperation; _errAction = errorAction; _wrapper = wrapper; _system = system; _auditController = auditController; }
/// <summary> /// Is called before processing is started; do any initialisation here. /// </summary> /// <param name="transformDef">The connector transform definition.</param> /// <param name="iterator">The transaction iterator.</param> /// <param name="testMode">Indicates if transform is being run in the designer/Preview mode.</param> /// <param name="errAction">The action to take if there's an error.</param> /// <param name="updateOperation">Whether to insert and/or update and/or delete.</param> /// <param name="system">The System object containing the settings.</param> /// <param name="auditController">The audit controller object.</param> public void Initialise(TransformDefinition transformDef, TransactionIterator iterator, bool testMode, eTransformErrorAction errAction, eERPUpdateOperation updateOperation, SystemConnectorDTO system, ITransformAuditController auditController) { _transformDef = transformDef; _iterator = iterator; _testMode = testMode; _errAction = errAction; _updateOperation = updateOperation; _system = system; _auditController = auditController; Logon(system); }
/// <summary> /// Initialises the import. /// </summary> /// <param name="transformId">The transform id.</param> /// <param name="iterator">The transaction iterator object.</param> /// <param name="updateOperation">The update operation for the import.</param> /// <param name="errorAction">The error action.</param> /// <param name="helper">The wrapper object.</param> public void Initialise(string transformId, TransactionIterator iterator, eERPUpdateOperation updateOperation, eTransformErrorAction errorAction, ImportHelper helper, SystemConnectorDTO systemConnector, ITransformAuditController auditController) { _transformId = transformId; _iterator = iterator; _updateOp = updateOperation; _errAction = errorAction; _wrapper = helper; _systemConnector = systemConnector; _auditController = auditController; _client = new Client(systemConnector); _validStatus = null; // _client.GetValidOrderStatuses(); }
/// <summary> /// Creates the TransformDefinition for the Customer push style connector. /// </summary> /// <returns></returns> private TransformDefinition CreateAuthorizeDefinition(eERPUpdateOperation updateOp = eERPUpdateOperation.eUpdateInsert) { // Create the resultant object. TransformDefinition tfmDef = CreatePushStyleTransformDef(TestConstants.CONNECTOR_SYSTEM, ImportTypeEnum.Authorize, updateOp); // Create the Customer RecordDefinition. TransformRecordDefinition recDef = TransformDefinitionBuilder.CreateRecord(tfmDef, "Authorize", string.Empty); // Add the fields to the Customer Transform. TransformDefinitionBuilder.CreateField(recDef, "Reference"); TransformDefinitionBuilder.CreateField(recDef, "Name"); TransformDefinitionBuilder.CreateField(recDef, "ShortName"); TransformDefinitionBuilder.CreateField(recDef, "CreditLimit", IntManFieldTypeEnum.eDecimal); TransformDefinitionBuilder.CreateField(recDef, "Currency"); TransformDefinitionBuilder.CreateField(recDef, "PaymentTermDays"); TransformDefinitionBuilder.CreateField(recDef, "CountryCode"); TransformDefinitionBuilder.CreateField(recDef, "AddressLine1"); TransformDefinitionBuilder.CreateField(recDef, "AddressLine2"); TransformDefinitionBuilder.CreateField(recDef, "AddressLine3"); TransformDefinitionBuilder.CreateField(recDef, "AddressLine4"); TransformDefinitionBuilder.CreateField(recDef, "City"); TransformDefinitionBuilder.CreateField(recDef, "County"); TransformDefinitionBuilder.CreateField(recDef, "PostCode"); TransformDefinitionBuilder.CreateField(recDef, "AddressCountryCode"); TransformDefinitionBuilder.CreateField(recDef, "MainTelephoneCountryCode"); TransformDefinitionBuilder.CreateField(recDef, "MainTelephoneAreaCode"); TransformDefinitionBuilder.CreateField(recDef, "MainTelephoneSubscriberNumber"); TransformDefinitionBuilder.CreateField(recDef, "MainFaxCountryCode"); TransformDefinitionBuilder.CreateField(recDef, "MainFaxAreaCode"); TransformDefinitionBuilder.CreateField(recDef, "MainFaxSubscriberNumber"); TransformDefinitionBuilder.CreateField(recDef, "MainWebSite"); TransformDefinitionBuilder.CreateField(recDef, "DefaultTaxCode", IntManFieldTypeEnum.eLongInt); TransformDefinitionBuilder.CreateField(recDef, "TaxRegistrationCode"); TransformDefinitionBuilder.CreateField(recDef, "MonthsToKeepTransactions", IntManFieldTypeEnum.eLongInt); TransformDefinitionBuilder.CreateField(recDef, "OrderPriority"); TransformDefinitionBuilder.CreateField(recDef, "DUNSCode"); TransformDefinitionBuilder.CreateField(recDef, "UseTaxCodeAsDefault", IntManFieldTypeEnum.eBoolean); TransformDefinitionBuilder.CreateField(recDef, "DefaultNominalCode"); TransformDefinitionBuilder.CreateField(recDef, "TradingAccountType"); TransformDefinitionBuilder.CreateField(recDef, "EarlySettlementDiscountPercent", IntManFieldTypeEnum.eDecimal); TransformDefinitionBuilder.CreateField(recDef, "EarlySettlementDiscountDays", IntManFieldTypeEnum.eLongInt); TransformDefinitionBuilder.CreateField(recDef, "PaymentTermsDays", IntManFieldTypeEnum.eLongInt); TransformDefinitionBuilder.CreateField(recDef, "PaymentTermsBasis", IntManFieldTypeEnum.eLongInt); TransformDefinitionBuilder.CreateField(recDef, "SAGE200IMPSUCCESS"); return(tfmDef); }
/// <summary> /// Processes a Push Style dataset by instantiating the ITransformInterop object and making the appropriate calls. /// </summary> /// <param name="transactionFactory">The transaction factory containing the dataset.</param> //protected string ProcessTransactions(TransactionFactory transactionFactory) //{ // ITransformInterop import = new TransformInterop(); // import.CreateController(JOBDEF_ID, INSTANCE_ID, transactionFactory.TransformDefinition.GetXml(), transactionFactory.Data.OuterXml, true, string.Empty); // ((TransformInterop) import).SetAuditProxy(new AuditProxy()); // // Run the actual import. // import.Process(); // return import.TransformedData(); //} protected static void ProcessTransactions(TransactionFactory transactionFactory) { TransformDefinition tfmDef = transactionFactory.TransformDefinition; // Obtain the system connector. SystemConnectorDTO connectorDTO = new SystemConnectorDTO(tfmDef.Options.GetProperty(GlobalResources.SYS_CONNECT_SYSID_OPT)); // Get the updateOperation. eERPUpdateOperation updateOperation = tfmDef.Options.GetProperty <eERPUpdateOperation>(GlobalResources.SYS_CONNECT_UPDATE_OP_OPT); // Create the ITransformProcess object implemented by the connector. PushDataInterop target = new PushDataInterop(); // Now initialise. target.Initialise(tfmDef, transactionFactory.CreateTransactionIterator(), false, tfmDef.AuditDefinition.ErrorAction, updateOperation, connectorDTO, new AuditProxy()); // Run the actual import. target.Process(); }
private TransformDefinition CreateCaptureDefinition(eERPUpdateOperation updateOperation = eERPUpdateOperation.eUpdate) { // Create the resultant object. TransformDefinition result = CreatePushStyleTransformDef(TestConstants.CONNECTOR_SYSTEM, ImportTypeEnum.Capture, updateOperation); // Create the Record Definition TransformRecordDefinition order = TransformDefinitionBuilder.CreateRecord(result, "Capture", string.Empty); TransformDefinitionBuilder.CreateField(order, nameof(Capture.ApiLoginID)); // "ApiLoginID"); TransformDefinitionBuilder.CreateField(order, nameof(Capture.ApiTransactionKey)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.TransactionAmount)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.TransactionID)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.ResponseCode)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.MessageCode)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.Description)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.AuthCode)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.ErrorCode)); TransformDefinitionBuilder.CreateField(order, nameof(Capture.CaptureErrorMessage)); return(result); }
public void CCCaptureTest() { //string ApiLoginID = "9r95gdR4N7T3"; //string ApiTransactionKey = "7C2p9DN6K8VztH5R"; decimal TransactionAmount = 1.00M; string TransactionID = "61620710013"; // Create the TransformDefinition for the Order datastructure. TransformDefinition tfmDef = CreateCaptureDefinition(); // Create a TransactionFactory object. var factory = new TransactionFactory(tfmDef); // Get a reference to the SalesOrder definition. TransformRecordDefinition recDef = tfmDef.RecordDefById(ENTITY); // Create the SalesOrder transaction. Transaction orderTransaction = TransactionFactory.CreateTransaction(recDef, true); // It's not necessary to set every field in a test...just those you want! //orderTransaction.SetFieldValue("ApiLoginID", ApiLoginID, true); //orderTransaction.SetFieldValue("ApiTransactionKey", ApiTransactionKey, true); orderTransaction.SetFieldValue("TransactionAmount", TransactionAmount, true); orderTransaction.SetFieldValue("TransactionID", TransactionID, true); eERPUpdateOperation updateOperation = eERPUpdateOperation.eUpdate; // Insert the transaction into the data structure TransactionFactory.InsertTransaction(factory.Data, orderTransaction); SystemConnectorDTO systemConnector = new SystemConnectorDTO(TestConstants.CONNECTOR_SYSTEM); ProcessTransactions(factory, tfmDef, updateOperation, systemConnector); // TODO: Performs some tests to ensure the data being 'Pushed' to the application has been // accepted and the fields have been populated with correct values. }
/// <summary> /// Creates a TransformDefinition object for a Push Style Connector. /// </summary> /// <param name="systemConnectorId">The id for the System Connector used to retrieve the connection properties.</param> /// <param name="impType">The import type.</param> /// <param name="updateOp">The update operation.</param> /// <returns></returns> protected TransformDefinition CreatePushStyleTransformDef(string systemConnectorId, ImportTypeEnum impType, eERPUpdateOperation updateOp) { TransformDefinition tfmDef = _jobDef.CreateTransform(); ITransformSetup tfmSetup = new CustomConnectorTransformSetup(); tfmSetup.InitialiseTransform(tfmDef); // Set the options for the connector. tfmDef.Options.SetProperty(GlobalResources.SYS_CONNECT_TRAN_TYPE_OPT, Convert.ToInt32(impType).ToString(), false); tfmDef.Options.SetProperty(GlobalResources.SYS_CONNECT_SYSID_OPT, systemConnectorId, false); tfmDef.Options.SetProperty(GlobalResources.SYS_CONNECT_UPDATE_OP_OPT, Convert.ToInt32(updateOp).ToString(), false); tfmDef.Options.SetProperty(GlobalResources.CUS_CONNECT_ASSEMBLY_NAME_OPT, TestConstants.ASSEMBLY_NAME, false); tfmDef.AuditDefinition.ErrorAction = eTransformErrorAction.eTransformErrorActionAbort; return(tfmDef); }
protected TransactionIterator ProcessTransactions(TransactionFactory transactionFactory, TransformDefinition tfmDef, eERPUpdateOperation updateOperation, SystemConnectorDTO system) { TransactionIterator iterator = new TransactionIterator(transactionFactory.Data, tfmDef); PushDataInterop target = new PushDataInterop(); target.Initialise(tfmDef, iterator, true, eTransformErrorAction.eTransformErrorActionAbort, updateOperation, system, new AuditProxy()); // Run the actual import. target.Process(); return(iterator); }