Share via


SavePromoCodeDefinition Method

Insert a new PromoCodeDefinition (if the identifier is zero), or updates an existing PromoCodeDefinition (if the identifier is not zero).

Namespace:  Microsoft.CommerceServer.Marketing.WebService
Assembly:  Microsoft.CommerceServer.Marketing.DataManagement (in Microsoft.CommerceServer.Marketing.DataManagement.dll)

Syntax

'Declaration
<WebMethodAttribute> _
Public Overridable Function SavePromoCodeDefinition ( _
    promoCodeDefinition As PromoCodeDefinitionData, _
    forceOverwrite As Boolean _
) As PromoCodeDefinitionData
'Usage
Dim instance As MarketingWebService
Dim promoCodeDefinition As PromoCodeDefinitionData
Dim forceOverwrite As Boolean
Dim returnValue As PromoCodeDefinitionData

returnValue = instance.SavePromoCodeDefinition(promoCodeDefinition, _
    forceOverwrite)
[WebMethodAttribute]
public virtual PromoCodeDefinitionData SavePromoCodeDefinition(
    PromoCodeDefinitionData promoCodeDefinition,
    bool forceOverwrite
)
[WebMethodAttribute]
public:
virtual PromoCodeDefinitionData^ SavePromoCodeDefinition(
    PromoCodeDefinitionData^ promoCodeDefinition, 
    bool forceOverwrite
)
public function SavePromoCodeDefinition(
    promoCodeDefinition : PromoCodeDefinitionData, 
    forceOverwrite : boolean
) : PromoCodeDefinitionData

Parameters

  • promoCodeDefinition
    Type: PromoCodeDefinitionData
    The PromoCodeDefinition object containing the data to be saved (set to zero for an insert)
  • forceOverwrite
    Type: System..::.Boolean
    true to indicate that existing settings should be overwritten even if they are more recent; otherwise false.

Return Value

Type: PromoCodeDefinitionData
A PromoCodeDefinitionData instance with the specified promoCodeDefinition.

Exceptions

Exception Condition
NotAuthorizedException

The user is not authorized to perform the requested operation.

ArgumentOutOfRangeException

promoCodeDefinition is less than zero.

ArgumentNullException

An input argument or one of the required properties is nullNothingnullptra null reference (Nothing in Visual Basic).

StringLengthValidationException

One if the property values is too long or too short.

DuplicateEntityNameException

An entity with this name already exists.

DuplicateEntityIdException

An entity with this promoCodeDefinition already exists.

DuplicatePromoCodeException

This public promocode already exists.

EntityDoesNotExistException

No PromoCodeDefinition exists with this promoCodeDefinition, or one of the entities that this one depends on does not exist.

InvalidCatalogOperationException

The usage type of the definition cannot be updated.

OptimisticLockException

The entity has been modified since the last time this user accessed it. It should be reloaded and the operation should be retried.

DatabaseIntegrityException

A serious integrity issue with the database exists.

Remarks

Saves the specified PromoCodeDefinition object to the database. Inserts a new PromoCodeDefinition (if the identifier is zero), or updates an existing Campaign (if the identifier is not zero).

Use forceOverwrite to prevent overwriting the object in the database.

The forceOverwrite controls optimistic locking behavior. If the value is false and the record was modified in the database after it was loaded for editing, then an exception is raised.

Permissions

See Also

Reference

MarketingWebService Class

MarketingWebService Members

Microsoft.CommerceServer.Marketing.WebService Namespace