Exemple #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListPricesResponse response = new ListPricesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("NextPageMarker", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextPageMarker = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Prices", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <DomainPrice, DomainPriceUnmarshaller>(DomainPriceUnmarshaller.Instance);
                    response.Prices = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemple #2
0
        public virtual ListPricesResponse ListPrices(ListPricesRequest request)
        {
            var response = new ListPricesResponse();

            try {
                // Raise Initialization Event
                var initialization = ListPricesInitialization;
                if (initialization != null)
                {
                    initialization(request, response);
                }
                // Raise Execute Event
                var execute = ListPricesExecute;
                if (execute != null)
                {
                    response = execute(request);
                }
                // Raise Complete Event
                var complete = ListPricesComplete;
                if (complete != null)
                {
                    complete(request, response);
                }
            }
            catch (Exception exception) {
                // Raise Error Event
                var error = ListPricesError;
                if (error != null)
                {
                    error(request, response, exception);
                }
            }
            return(response);
        }
Exemple #3
0
        public override ListPricesResponse OnListPricesExecute(ListPricesRequest request)
        {
            var budgetFactory = new BudgetFactory();
            var response      = new ListPricesResponse();

            try
            {
                response.ListPrices = budgetFactory.CreateBudget(request.Items, request.ClientCode, request.CnpjCpf, true, true);
            }
            catch (Exception ex)
            {
                response.Exception = ex;
                response.Message   = ex.Message;
            }

            return(response);
        }