Teilen über


CampaignItem Class

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Represents the base class for all campaign item types. Provides the base functionality shared by all campaign items.

Namespace:  Microsoft.CommerceServer.Marketing
Assembly:  Microsoft.CommerceServer.Marketing.CrossTierTypes (in Microsoft.CommerceServer.Marketing.CrossTierTypes.dll)

Syntax

'Declaration
<ComVisibleAttribute(False)> _
Public MustInherit Class CampaignItem _
    Inherits MarketingServices
'Usage
Dim instance As CampaignItem
[ComVisibleAttribute(false)]
public abstract class CampaignItem : MarketingServices
[ComVisibleAttribute(false)]
public ref class CampaignItem abstract : public MarketingServices
public abstract class CampaignItem extends MarketingServices

Remarks

A CampaignItem is a communication vehicle that contributes to the specified result of a campaign. You can create three types of campaign items in Commerce Server: ads, direct mail, or discounts. You can use third-party products to create additional types of campaign items.

The following classes derive from this abstract class:

  • DirectMail - A Direct Mail describes an e-mail campaign.

Examples

public static CampaignItem GetSampleDiscount(MarketingContext marketingSystem)
{
  InsertEventType(marketingSystem);
  InsertIndustryCode(marketingSystem);
  // create a customer
  Customer cu =  GetSampleCustomer1(marketingSystem);
 cu.Save(true);
  //get a sample campaign object
  Campaign ca = GetSampleCampaign1(marketingSystem, cu.Id);
  ca.Save(true);
  marketingSystem.Campaigns.Activate(ca.Id, ca.LastModifiedDate);
  //create an empty Discount
  Discount di = marketingSystem.CampaignItems.NewDiscount(ca.Id);
  Guid name = Guid.NewGuid();
  di.Name = "Dis_" + name.ToString();
  di.StartDate = DateTime.Now - TimeSpan.FromDays(1);
  di.EndDate = DateTime.Now + TimeSpan.FromDays(14);
  di.Description = "Sample Discount description.";
  di.DiscountType = DiscountType.OrderLevelCustom;
  di.MultiLingualBasketDisplay.Add(new LanguageString("basket!!!! you happy now?!", "fr"));
  di.WizardType = 5;
  di.PerOrderLimit = 1;
  di.ClickRequired = true;
  di.AwardExpression = marketingSystem.Expressions.NewExpressionRef(0); // alwaysTrue;
  di.MaxAwards = 1;
  di.OfferType = OfferType.Percentage;
  di.OfferAmount = 100;
  di.OfferDisjoint = true;
  di.CustomOrderLevelOfferType = "ABC";
  di.AutoAddAward = true;
  di.PromoCodeDefinitionId = 0;
  di.ReuseConditionsAsAwards = true;
  di.ReuseAwardsAsConditions = true;
  di.ReuseAwardsAsAwards = true;
  di.ReuseAwardsAsConditions = true;
  di.Condition.Basis = ConditionBasis.Price;
  di.Condition.MinimumAmount = 100;
  di.Condition.ConditionExpression = marketingSystem.Expressions.NewExpressionRef(0); // alwaysTrue
  di.EligibilityRequirements.Clear();
  di.Save(true);
  marketingSystem.CampaignItems.Activate(di.Id, di.LastModifiedDate);
  return di;
}

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer.Marketing..::.MarketingServices
    Microsoft.CommerceServer.Marketing..::.CampaignItem
      Microsoft.CommerceServer.Marketing..::.DirectMail
      Microsoft.CommerceServer.Marketing..::.DisplayableCampaignItem

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

CampaignItem Members

Microsoft.CommerceServer.Marketing Namespace