Share via


CreateFromCache Method (String)

Creates a DiscountItemCollection from the specified cache name.

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

Syntax

'Declaration
Public Shared Function CreateFromCache ( _
    cacheName As String _
) As DiscountItemCollection
'Usage
Dim cacheName As String
Dim returnValue As DiscountItemCollection

returnValue = DiscountItemCollection.CreateFromCache(cacheName)
public static DiscountItemCollection CreateFromCache(
    string cacheName
)
public:
static DiscountItemCollection^ CreateFromCache(
    String^ cacheName
)
public static function CreateFromCache(
    cacheName : String
) : DiscountItemCollection

Parameters

  • cacheName
    Type: System..::.String
    The cache name to be used to created the collection. Cannot be nullNothingnullptra null reference (Nothing in Visual Basic).

Return Value

Type: Microsoft.CommerceServer.Runtime.Marketing..::.DiscountItemCollection
A DiscountItemCollection object corresponding to the cache.

Exceptions

Exception Condition
ArgumentNullException

cacheName is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentException

A CommerceCache with the specified name does not exist in 'CommerceContext.Current.Caches'.

Remarks

Creates a DiscountItemCollection from the specified CommerceCache.

The 'CommerceContext.Current.Caches' collection is looked up to obtain a CommerceCache object. This object is then used to create a DiscountItemCollection.

The DiscountItemCollection contains all discounts that meet all of the following criteria:

  • The parent customer of the discount is not deleted or archived.

  • The parent campaign of the discount is not deleted or archived.

  • The parent campaign of the discount is active.

  • The discount is not deleted or archived.

  • The discount is active.

  • The discount has started or will start within one week.

  • The discount has not ended, or the discount has ended within the past month.

Permissions

See Also

Reference

DiscountItemCollection Class

DiscountItemCollection Members

CreateFromCache Overload

Microsoft.CommerceServer.Runtime.Marketing Namespace