Share via


CatalogPricingRulesDataSet

The CatalogPricingRulesDataSet class contains information about all the pricing rules that are defined in the virtual catalog. You can access the DataRowCollection of the dataset’s data table by using the PricingRules property. You can access each row in the collection by using the properties of the CatalogPricingRulesDataSet..::.PricingRule class.

The following table contains the strongly typed properties in this dataset.

Property

Description

CatalogName

Gets or sets a string that specifies the name of the base catalog from which this pricing rule comes; maximum length is 85 characters.

CatalogPricingRuleType

Gets or sets a short integer that specifies the property type of the pricing rule. This property is a value of the CatalogPricingRuleType enumeration. The values for this property are as follows:

  • 0 - NoPriceChange

  • 1 - PercentageMultiplier

  • 2 - AddFixedAmount

  • 3 - ReplacePrice

CategoryName

Gets or sets a string that contains the category name for this rule; maximum length is 128 characters. This property returns null for all other rules.

DisplayName

Gets or sets a string that contains the display name for the category to which this rule applies; maximum length is 128 characters.

PriceChange

Gets or sets a decimal value that specifies the pricing amount that applies to this rule.

ProductId

Gets a string that specifies the product identifier for product and variant rules; maximum length is 256 characters. This property returns null if the rule is a category rule.

VariantId

Gets a string that specifies the variant identifier for variant rules; maximum length is 256 characters. This property returns null if the rule is not a variant rule.

Constraints

The CatalogPricingRulesDataSet class defines a unique constraint on the CatalogName, ProductId, VariantId, DisplayName, and CategoryName columns.

Using the CatalogPricingRulesDataSet Class

The following example demonstrates how to access the properties of the CatalogPricingRulesDataSet..::.PricingRule class.

public static void UseDataset(CatalogContext context, string virtualCatalogName)
{ 
    VirtualCatalog virtualCatalog = VirtualCatalog)context.GetCatalog(virtualCatalogName);
    CatalogPricingRulesDataSet virtualCatalogPriceRules = virtualCatalog.PriceRules.DataSet;
    int count = virtualCatalogPriceRules.PricingRules.Count;
    // Iterate through the pricing rules.
    for (int ruleIndex = 0; ruleIndex < count; ruleIndex++)
    {
        string catalogName = virtualCatalogPriceRules.PricingRules[ruleIndex].CatalogName;
        string categoryName = virtualCatalogPriceRules.PricingRules[ruleIndex].CategoryName;
    }
}

The CatalogPricingRulesDataSetSchema Class

The CatalogPricingRulesDataSetSchema class provides constants for all the built-in columns in the dataset and defines all the associated methods. The following table contains the associated methods for this class.

Method

Description

IsReadOnlyColumn

Returns true if the columnName in the dataset cannot be updated, or false if the columnName in the dataset can be updated.

IsBuiltInColumn

Returns true if the columnName is a built-in column in the dataset, or false if the columnName is a user-defined property.

See Also

Other Resources

Typed Datasets in the Catalog System