Share via


CatalogRule Class

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

An abstract class. Implements functionality of the Catalog Rules.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
<StrongNameIdentityPermissionAttribute(SecurityAction.InheritanceDemand, PublicKey := "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")> _
Public MustInherit Class CatalogRule
'Usage
Dim instance As CatalogRule
[StrongNameIdentityPermissionAttribute(SecurityAction.InheritanceDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
public abstract class CatalogRule
[StrongNameIdentityPermissionAttribute(SecurityAction::InheritanceDemand, PublicKey = L"0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
public ref class CatalogRule abstract
public abstract class CatalogRule

Remarks

Implements functionality of the Catalog Rules.

The following classes derive from this class:

  • PricingRule - Used to manage pricing rules in a catalog.

  • VirtualCatalogRule - Used to manage pricing rules in a virtual catalog.

Examples

internal void AddRules(string virtualCatalogName, string baseCatalog)
{
  try
  {
    VirtualCatalog vc = (VirtualCatalog)this.catalogContext.GetCatalog(virtualCatalogName);
    // Add a rule to the base catalog by caling the AddVirtualCatalogRule method
    // Set the last parameter to true to add an inclusion rule.
    // To add an exclusion rule set the last paremeter to true
    vc.AddVirtualCatalogRule(baseCatalog, null, null, null, false);
    // To add a price rule call the AddPriceRule method
    vc.AddPriceRule(baseCatalog, null, null, null, CatalogPricingRuleType.PercentageMultiplier, 10);
    // Call save to save the rules to the catalog system
    vc.Save();
    // Iterating through a rules collection
    VirtualCatalogRuleCollection  vcRules = vc.VirtualCatalogRules;
    foreach (VirtualCatalogRule vcRule in vcRules)
    {
      Console.WriteLine(vcRule.CatalogName);
    }
    // Iterating through a pricerules collection
    PricingRuleCollection vcPriceRules = vc.PriceRules;
    foreach (PricingRule vcPriceRule in vcPriceRules)
    {
      Console.WriteLine(vcPriceRule.CatalogName);
    }
  }
  catch (OptimisticLockException)
  {
    throw;
  }
}

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer.Catalog..::.CatalogRule
    Microsoft.CommerceServer.Catalog..::.PricingRule
    Microsoft.CommerceServer.Catalog..::.VirtualCatalogRule

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

CatalogRule Members

Microsoft.CommerceServer.Catalog Namespace