MarketplaceWebServiceProducts.Model.Product.IsSetOffers C# (CSharp) Method

IsSetOffers() public method

Checks if Offers property is set
public IsSetOffers ( ) : System.Boolean
return System.Boolean
        public Boolean IsSetOffers()
        {
            return this.offersField != null;
        }

Usage Example

Exemplo n.º 1
0
        public Dictionary <string, decimal> GetMyPriceForSKUs(IEnumerable <string> skus)
        {
            Dictionary <string, decimal> myPriceDictionary = new Dictionary <string, decimal>();

            GetMyPriceForSKURequest requestMyPriceForSku = new GetMyPriceForSKURequest
            {
                SellerId      = m_sellerId,
                MarketplaceId = m_marketPlaceId,
                SellerSKUList = new SellerSKUListType()
            };

            requestMyPriceForSku.SellerSKUList.SellerSKU.AddRange(skus);
            try
            {
                GetMyPriceForSKUResponse response = m_productClient.GetMyPriceForSKU(requestMyPriceForSku);

                List <GetMyPriceForSKUResult> getMyPriceForSkuResultList = response.GetMyPriceForSKUResult;
                foreach (GetMyPriceForSKUResult getMyPriceForSkuResult in getMyPriceForSkuResultList)
                {
                    if (getMyPriceForSkuResult.IsSetProduct())
                    {
                        MarketplaceWebServiceProducts.Model.Product product = getMyPriceForSkuResult.Product;

                        if (product.IsSetOffers())
                        {
                            OffersList       offers    = product.Offers;
                            List <OfferType> offerList = offers.Offer;
                            foreach (OfferType offer in offerList)
                            {
                                if (offer.IsSetBuyingPrice())
                                {
                                    PriceType buyingPrice = offer.BuyingPrice;
                                    if (buyingPrice.IsSetLandedPrice())
                                    {
                                        MoneyType landedPrice2 = buyingPrice.LandedPrice;

                                        if (landedPrice2.IsSetAmount())
                                        {
                                            decimal myPrice = landedPrice2.Amount;
                                            myPriceDictionary.Add(offer.SellerSKU, myPrice);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (MarketplaceWebServiceProductsException e)
            {
                LoggingRepository.Log(LoggingCategory.RepricingScript, string.Format("Exception in 'GetMyPriceForSKU': {0}", e.Message));
            }

            return(myPriceDictionary);
        }