Пример #1
0
        /// <summary>
        /// Runs the activity asynchronously.
        /// </summary>
        /// <param name="sharedContext">The shared context.</param>
        /// <returns>
        /// Next activity to be run or <c>null</c> if last in flow.
        /// </returns>
        public async Task <IActivity> RunAsync(SharedContext sharedContext)
        {
            IBargainFinderMaxData data = sharedContext.GetResult <IBargainFinderMaxData>(InputDataSharedContextKey);

            if (data == null)
            {
                throw new ArgumentException("No data found under key: " + InputDataSharedContextKey);
            }

            var security = await this.sessionPool.TakeSessionAsync(sharedContext.ConversationId);

            var service = this.soapServiceFactory.CreateBargainFinderMaxService(sharedContext.ConversationId, security);
            var request = this.CreateRequest(data);

            sharedContext.AddSerializedResultXML(RequestXmlSharedContextKey, request);
            try
            {
                var result = service.BargainFinderMaxRQ(request);
                sharedContext.AddSerializedResultXML(ResponseXmlSharedContextKey, result);
                EnhancedAirBookData enhancedAirBookData = this.CreateEnhancedAirBookData(result);
                sharedContext.AddResult(EnhancedAirBookActivity.InputDataSharedContextKey, enhancedAirBookData);
                return(new PassengerDetailsContactActivity(this.soapServiceFactory, this.sessionPool));
            }
            catch (Exception ex)
            {
                sharedContext.AddResult(CommonConstants.ExceptionSharedContextKey, ex);
                sharedContext.IsFaulty = true;
                this.sessionPool.ReleaseSession(sharedContext.ConversationId);
                return(null);
            }
        }
Пример #2
0
        /// <summary>
        /// Runs the activity asynchronously.
        /// </summary>
        /// <param name="sharedContext">The shared context.</param>
        /// <returns>
        /// Next activity to be run or <c>null</c> if last in flow.
        /// </returns>
        public async Task <IActivity> RunAsync(SharedContext sharedContext)
        {
            TravelItineraryReadRQ request = new TravelItineraryReadRQ
            {
                Version          = "3.6.0",
                MessagingDetails = new TravelItineraryReadRQMessagingDetails
                {
                    SubjectAreas = new[] { "PNR" }
                },
                UniqueID = new TravelItineraryReadRQUniqueID
                {
                    ID = sharedContext.GetResult <string>(TravelItineraryRefContextKey)
                }
            };
            var security = await this.sessionPool.TakeSessionAsync(sharedContext.ConversationId);

            var service = this.soapServiceFactory.CreateTravelItineraryReadService(sharedContext.ConversationId, security);

            sharedContext.AddSerializedResultXML(RequestXmlSharedContextKey, request);
            try
            {
                TravelItineraryReadRS response = service.TravelItineraryReadRQ(request);
                sharedContext.AddResult(SharedContextKey, response);
                sharedContext.AddSerializedResultXML(ResponseXmlSharedContextKey, response);
                return(null);
            }
            catch (Exception ex)
            {
                sharedContext.AddResult(SharedContextKey, ex);
                sharedContext.IsFaulty = true;
                this.sessionPool.ReleaseSession(sharedContext.ConversationId);
                return(null);
            }
        }
Пример #3
0
        /// <summary>
        /// Runs the activity asynchronously.
        /// </summary>
        /// <param name="sharedContext">The shared context.</param>
        /// <returns>
        /// Next activity to be run or <c>null</c> if last in flow.
        /// </returns>
        public async Task <IActivity> RunAsync(SharedContext sharedContext)
        {
            IgnoreTransactionRQ request = new IgnoreTransactionRQ {
                Version = "2.0.0"
            };

            sharedContext.AddSerializedResultXML(RequestXmlSharedContextKey, request);
            Security security = await this.sessionPool.TakeSessionAsync(sharedContext.ConversationId);

            IgnoreTransactionService service = this.soapServiceFactory.CreateIgnoreTransactionService(sharedContext.ConversationId, security);

            try
            {
                IgnoreTransactionRS response = service.IgnoreTransactionRQ(request);
                sharedContext.AddSerializedResultXML(ResponseXmlSharedContextKey, response);
            }
            catch (Exception ex)
            {
                sharedContext.AddResult(CommonConstants.ExceptionSharedContextKey, ex);
            }

            sharedContext.IsFaulty = true;
            this.sessionPool.ReleaseSession(sharedContext.ConversationId);
            return(null);
        }
        /// <summary>
        /// Runs the activity asynchronously.
        /// </summary>
        /// <param name="sharedContext">The shared context.</param>
        /// <returns>
        /// Next activity to be run or <c>null</c> if last in flow.
        /// </returns>
        public async Task <IActivity> RunAsync(SharedContext sharedContext)
        {
            var security = await this.sessionPool.TakeSessionAsync(sharedContext.ConversationId);

            var service = this.soapServiceFactory.CreatePassengerDetailsService(sharedContext.ConversationId, security);
            IPassengerDetailsActivityData data    = sharedContext.GetResult <IPassengerDetailsActivityData>(InputDataSharedContextKey);
            PassengerDetailsRQ            request = this.CreateRequest(data);

            sharedContext.AddSerializedResultXML(RequestXmlSharedContextKey, request);
            try
            {
                PassengerDetailsRS response = service.PassengerDetailsRQ(request);
                sharedContext.AddResult(SharedContextKey, response);
                sharedContext.AddSerializedResultXML(ResponseXmlSharedContextKey, response);
                sharedContext.AddResult(TravelItineraryReadActivity.TravelItineraryRefContextKey, response.ItineraryRef.ID);
                return(new TravelItineraryReadActivity(this.soapServiceFactory, this.sessionPool));
            }
            catch (Exception ex)
            {
                sharedContext.AddResult(CommonConstants.ExceptionSharedContextKey, ex);
                sharedContext.IsFaulty = true;
                this.sessionPool.ReleaseSession(sharedContext.ConversationId);
                return(null);
            }
        }