Пример #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)
        {
            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);
        }
Пример #2
0
        public void Call()
        {
            try
            {
                var request = new IgnoreTransactionRQ()
                {
                    POS = new IgnoreTransactionRQPOS()
                    {
                        Source = new IgnoreTransactionRQPOSSource()
                        {
                            PseudoCityCode = VolarisResources.PseudoCodeCity
                        }
                    },
                    Version = VolarisResources.IgnoreTransactionServiceVersion
                };
                request.IgnoreTransaction = new IgnoreTransactionRQIgnoreTransaction()
                {
                    Ind = true
                };
                var service = new IgnoreTransactionService()
                {
                    MessageHeaderValue = this.GetMessageHeader(),
                    SecurityValue      = new Security()
                    {
                        BinarySecurityToken = this.SecurityToken
                    }
                };

                Serializer.Serialize("IgnoreTransactionLLSRQ", request);
                var response = service.IgnoreTransactionRQ(request);
                Serializer.Serialize("IgnoreTransactionLLSRS", response);
                if (response.Errors == null && response.Success != null)
                {
                    Success = true;
                }
                else
                {
                    ErrorMessage = "Ocurrió un problema al tratar de ignorar la reservación.";
                    Success      = false;
                }
            }
            catch (Exception e)
            {
                Success      = false;
                ErrorMessage = e.Message;
            }
        }