Click or drag to resize
RandomCodeGenerator Class
Class generating random coupon codes according to specified pattern.
Inheritance Hierarchy
SystemObject
  CMS.EcommerceRandomCodeGenerator

Namespace: CMS.Ecommerce
Assembly: CMS.Ecommerce (in CMS.Ecommerce.dll) Version: 13.0.131
Syntax
C#
public class RandomCodeGenerator

The RandomCodeGenerator type exposes the following members.

Constructors
  NameDescription
Public methodRandomCodeGenerator
Initializes new instance of RandomCodeGenerator generating random codes starting with prefix. Format of codes is specified by codePattern parameter.
Top
Fields
  NameDescription
Protected fieldStatic memberCHARS
Characters A-Z.
Protected fieldStatic memberDIGITS
Digits 0-9.
Protected fieldStatic memberSYMBOLS
Symbols A-Z and 0-9.
Top
Methods
  NameDescription
Protected methodCodeIsUnique
Checks if given code is unique - not generated yet.
Public methodGenerateCode
Generates one new unique code. Throws exception when not able to generate unique code within 10 attempts.
Protected methodGetRandomChar
Returns random character A-Z.
Protected methodGetRandomDigit
Returns random digit 0-9.
Protected methodGetRandomNumber
Returns random number from 0 to max (exclusive).
Protected methodGetRandomSymbol
Returns random symbol 0-9 or A-Z.
Protected methodGetSymbolForType
Returns charType. Override this method to add custom character sets.
Protected methodRememberCode
Remembers given code as already generated.
Protected methodTryGenerateCode
Generates one random code.
Top
See Also