Пример #1
0
        public IArticlePriceFinishedProcessState StartProcess(IEnumerable <ArticlePriceRequestArticle> articles, Iso4217Code?currency)
        {
            ArticlePriceRequest request = this.CreateRequest(articles, currency);

            ArticlePriceResponse response = this.SendRequest(request,
                                                             () =>
            {
                return(this.Dialog.SendRequest(request));
            });

            return(new ArticlePriceFinishedProcessState(request, response));
        }
Пример #2
0
        private void Dialog_RequestReceived(Object sender, MessageReceivedEventArgs <ArticlePriceRequest> e)
        {
            ArticlePriceRequest request = e.Message;

            this.OnMessageReceived(request,
                                   () =>
            {
                IArticlePriceRequestedProcessState processState = new ArticlePriceRequestedProcessState(this, request);

                this.ProcessStarted?.Invoke(this, new ProcessStartedEventArgs <IArticlePriceRequestedProcessState>(processState));
            });
        }
Пример #3
0
        public async Task <IArticlePriceFinishedProcessState> StartProcessAsync(IEnumerable <ArticlePriceRequestArticle> articles,
                                                                                Iso4217Code?currency,
                                                                                CancellationToken cancellationToken = default)
        {
            ArticlePriceRequest request = this.CreateRequest(articles, currency);

            ArticlePriceResponse response = await this.SendRequestAsync(request,
                                                                        () =>
            {
                return(this.Dialog.SendRequestAsync(request, cancellationToken));
            }).ConfigureAwait(continueOnCapturedContext: false);

            return(new ArticlePriceFinishedProcessState(request, response));
        }
        /// <summary>
        /// Processes an incomming article price request.
        /// </summary>
        /// <param name="request">The request to be processed.</param>
        private void ProcessArticlePriceRequest(ArticlePriceRequest request)
        {
            // Set the underlying XmlObjectStream to send the response on when request.Finish() is called.
            lock (_syncLock)
            {
                if (_messageObjectStream == null)
                {
                    return;
                }

                request.MessageObjectStream = _messageObjectStream;
            }

            // Raise the corresponding event.
            base.Raise("ArticlePriceRequested", _articlePriceRequested, this, request);
        }
Пример #5
0
 public Task <ArticlePriceResponse> SendRequestAsync(ArticlePriceRequest request, CancellationToken cancellationToken = default)
 {
     return(base.SendRequestAsync <ArticlePriceRequest, ArticlePriceResponse>(request, cancellationToken));
 }
Пример #6
0
 public ArticlePriceResponse SendRequest(ArticlePriceRequest request)
 {
     return(base.SendRequest <ArticlePriceRequest, ArticlePriceResponse>(request));
 }
Пример #7
0
 protected void OnRequestReceived(ArticlePriceRequest request)
 {
     this.RequestReceived?.Invoke(this, new MessageReceivedEventArgs <ArticlePriceRequest>(request, this.DialogProvider));
 }
Пример #8
0
 public ArticlePriceFinishedProcessState(ArticlePriceRequest request, ArticlePriceResponse response)
 {
     this.Request  = request;
     this.Response = response;
 }
Пример #9
0
 public ArticlePriceRequestedProcessState(ArticlePriceWorkflow workflow, ArticlePriceRequest request)
 {
     this.Workflow = workflow;
     this.Request  = request;
 }