Exemplo n.º 1
0
            /// <summary>
            /// Download customer from AX.
            /// </summary>
            /// <param name="requestContext">The CRT context.</param>
            /// <param name="customerAccountNumber">The customer account number.</param>
            internal static void DownloadCustomerData(RequestContext requestContext, string customerAccountNumber)
            {
                // Download customer from AX.
                var customerDownloadRequest = new DownloadCustomerRealtimeRequest(customerAccountNumber);

                requestContext.Execute <NullResponse>(customerDownloadRequest);
            }
            /// <summary>
            /// Find and retrieve a customer customer from AX and add them to the DB.
            /// </summary>
            /// <param name="request">A service request specifying the customer to retrieve.</param>
            /// <returns>An empty response.</returns>
            private static NullResponse DownloadCustomer(DownloadCustomerRealtimeRequest request)
            {
                var client = new TransactionServiceClient(request.RequestContext);

                string packageData = client.GetCustomerDataPackage(
                    request.RecordId,
                    request.AccountNumber,
                    request.DirectoryPartyRecordId,
                    request.RequestContext.GetPrincipal().ChannelId);

                // Apply the retreived data package
                var packageWriteRequest = new ProcessDataPackageServiceRequest(packageData);

                request.RequestContext.Execute <NullResponse>(packageWriteRequest);

                return(new NullResponse());
            }