Skip to content

Instantly share code, notes, and snippets.

@bentayloruk
Created March 14, 2012 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bentayloruk/2036897 to your computer and use it in GitHub Desktop.
Save bentayloruk/2036897 to your computer and use it in GitHub Desktop.
using Microsoft.CommerceServer.Catalog;
using Microsoft.CommerceServer.Runtime.Profiles;
namespace Enticify.CommerceServer.Tests.Scenarios
{
public class PromoInfoSourceApi
{
public void GetPromoInfoForProductAndDoSomething(Product csProduct, Profile csUserProfile)
{
var promotionQueryService = new PromotionQueryService();
var promosTargetingProductQuery = new PromotionsTargetingProductQuery(csProduct)
{
AvailableToUser = csUserProfile,
};
ProductPromotionResults productPromotionResults = promotionQueryService.GetPromotions(promosTargetingProductQuery);
if (!productPromotionResults.HasPromotionsTargetingProduct)
return;
//Do something cool with the data.
var conditionInfos = productPromotionResults.WhereConditionOnly;
var awardInfos = productPromotionResults.WhereAwardOnly;
var conditionAndAwardInfos = productPromotionResults.WhereConditionAndAward;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment