AmazonMWS1.GetMatchingProduct.InvokeGetCompetitivePricingForASIN C# (CSharp) Method

InvokeGetCompetitivePricingForASIN() public static method

public static InvokeGetCompetitivePricingForASIN ( MarketplaceWebServiceProducts service, GetCompetitivePricingForASINRequest request ) : void
service MarketplaceWebServiceProducts
request MarketplaceWebServiceProducts.Model.GetCompetitivePricingForASINRequest
return void
        public static void InvokeGetCompetitivePricingForASIN(MarketplaceWebServiceProducts service,
                                                              GetCompetitivePricingForASINRequest request)
        {
            try{
                GetCompetitivePricingForASINResponse response = service.GetCompetitivePricingForASIN(request);

                List<GetCompetitivePricingForASINResult> getCompetitivePricingForASINResultList =
                    response.GetCompetitivePricingForASINResult;
                foreach (
                    GetCompetitivePricingForASINResult getCompetitivePricingForASINResult in
                        getCompetitivePricingForASINResultList){
                    if (getCompetitivePricingForASINResult.IsSetProduct()){
                        Product product = getCompetitivePricingForASINResult.Product;

                        if (product.IsSetCompetitivePricing()){
                            CompetitivePricingType competitivePricing = product.CompetitivePricing;
                            if (competitivePricing.IsSetTradeInValue()){
                                MoneyType tradeInValue = competitivePricing.TradeInValue;

                                if (tradeInValue.IsSetAmount()){
                                    tradeInPrice = Convert.ToString(tradeInValue.Amount);
                                    Console.WriteLine("Tradin Value: " + Convert.ToString(tradeInValue.Amount));
                                }
                            }
                        }
                    }
                }
            }
            catch (MarketplaceWebServiceProductsException ex){
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata);
            }
        }