Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
The following example programmatically accesses the DiscountPrioritySet.
To access the DiscountPrioritySet
Create a MarketingServiceAgent object. This type is visible when you add a Web reference to your project.
Create a MarketingContext object.
Create a DiscountPrioritySet object.
Use the DiscountPriorities property of this object to access and alter the discount priorities.
Use the UpdateDiscountPriorities method to save the changes.
Example
MarketingServiceAgent agent = new MarketingServiceAgent(url);
MarketingSystem marketingSystem = new MarketingSystem(agent);
// Swap the priority of the Discounts with ID=23 and ID=24.
Discount di1 = (Discount)marketingSystem.CampaignItems.GetCampaignItem(23);
Discount di2 = (Discount)marketingSystem.CampaignItems.GetCampaignItem(24);
DiscountPrioritySet ds = new DiscountPrioritySet();
ds.DiscountPriorities.AddDiscountPriority(di1.Id, di2.Priority);
ds.DiscountPriorities.AddDiscountPriority(di2.Id, di1.Priority);
marketingSystem.CampaignItems.UpdateDiscountPriorities(ds);