Add Method
Adds the specified Promocode string to the end of the PromoCodeStringCollection.
Namespace: Microsoft.CommerceServer.Runtime.Orders
Assembly: Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)
Syntax
'Declaration
Public Function Add ( _
promotionCode As String _
) As Integer
'Usage
Dim instance As PromoCodeStringCollection
Dim promotionCode As String
Dim returnValue As Integer
returnValue = instance.Add(promotionCode)
public int Add(
string promotionCode
)
public:
int Add(
String^ promotionCode
)
public function Add(
promotionCode : String
) : int
Parameters
- promotionCode
Type: System..::.String
The Promocode string to add. Cannot be nullNothingnullptra null reference (Nothing in Visual Basic).
Return Value
Type: System..::.Int32
The index position into which the new element was inserted.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | promotionCode is nullNothingnullptra null reference (Nothing in Visual Basic). |
ArgumentException | promotionCode contained only whitespace characters, or had zero length, or exceeded a maximum length of 50 characters. |
EntityAlreadyExistsException | promotionCode already exists in the collection. |
ConfiguredLimitExceededException | The number of PromoCode instances in the collection is already at the PromoCodesPerOrderForm limit set in the web.config. |
Remarks
Adds the specified Promocode string to the end of the PromoCodeStringCollection.
Successfully calling Add updates LastModified.
Returns the index position into which the new element was inserted.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
PromoCodeStringCollection Class