Udostępnij za pośrednictwem


Save Method

Saves the current PromoCodeDefinition object to the database.

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

Syntax

'Declaration
Public Sub Save ( _
    forceOverwrite As Boolean _
)
'Usage
Dim instance As PromoCodeDefinition
Dim forceOverwrite As Boolean

instance.Save(forceOverwrite)
public void Save(
    bool forceOverwrite
)
public:
void Save(
    bool forceOverwrite
)
public function Save(
    forceOverwrite : boolean
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

The current instance is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

The Id of the PromoCodeDefinition definition is less than or equal to 0.

DuplicateEntityIdException

A PromoCodeDefinition with the same Id already exists in the system.

DuplicateEntityNameException

A PromoCodeDefinition with the specified Name already exists within the scope of the same customer.

DuplicatePromoCodeException

A PromoCodeDefinition with the specified public promotion code already exists.

InvalidOperationException

An attempt was made to update the usage option of a PromoCodeDefinition.

StringLengthValidationException

One or more string property values of the current instance was set to an disallowed value. For more information, see the specific exception.

MinimumValueValidationException

One or more of the numeric property values of the current instance was set to a value less than the minimum allowed.

MaximumValueValidationException

One or more of the numeric property values of the current instance was set to a value greater than the maximum allowed.

EnumeratedValueValidationException

One or more of the enumerated property values of the current instance was set to an disallowed value.

PromoCodeUsageValidationException

The usage of the PromoCodeDefinition is incorrect. A Public PromoCodeDefinition must be a non-nullNothingnullptra null reference (Nothing in Visual Basic), non-empty PublicPromoCode string associated with it. For other types of PromoCodeDefinition, the PublicPromoCode string must be nullNothingnullptra null reference (Nothing in Visual Basic) or empty string.

OptimisticLockException

LastModifiedDate was not set or the current instance was modified in the database since being loaded for editing. This exception is raised only if forceOverwrite is false.

EntityDoesNotExistException

Id was set to a nonzero value, indicating an Update operation, but the specified PromoCodeDefinition does not exist in the database.

NotAuthorizedException

The user is not authorized to perform this operation.

Remarks

Use forceOverwrite to prevent overwriting the object in the database. This will raise an exception if set to false and the record was modified in the database after it was loaded for editing.

This method can only be used to add a new PromoCodeDefinition to the database. The following properties of the passed-in PromoCodeDefinition are updated:

Permissions

See Also

Reference

PromoCodeDefinition Class

PromoCodeDefinition Members

Microsoft.CommerceServer.Marketing Namespace