Partilhar via


Save Method

Saves changes made to the current Discount object.

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

Syntax

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

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

Parameters

Exceptions

Exception Condition
ArgumentException

One or more properties that describe the Discount is invalid. Please refer to actual exception message for more details.

ArgumentNullException

The Discount in the current instance was nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

The StartDate or EndDate of the current instance is set to an invalid date time value.

NotAuthorizedException

The user is not authorized to perform the requested updates.

EntityDoesNotExistException

One or more objects referred to by the current instance do not exist. For more information, see the actual exception message.

EntityStateException

An attempt was made to create or update a deleted Discount item object.

DuplicateEntityNameException

An attempt was made to create a Discount with a Name that already exists.

StringLengthValidationException

A string property of the Discount is too long or cannot be set to empty string. See individual properties for details.

PropertyNullValidationException

A string property of the Discount cannot be set to nullNothingnullptra null reference (Nothing in Visual Basic). See individual properties for details.

EnumeratedValueValidationException

An enumeration value of the Discount is not valid.

MaximumValueValidationException

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

MinimumValueValidationException

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

OptimisticLockException

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

InvalidOperationException

An attempt was made to update the Active status of an existing Discount through the Save API. To update this status, please use Activate or Deactivate.

Remarks

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

Save can be used to add a new Discount to the database or update an existing Discount in the database.

Permissions

See Also

Reference

Discount Class

Discount Members

Microsoft.CommerceServer.Marketing Namespace