RandomCodeGenerator Class |
Namespace: CMS.Ecommerce
public class RandomCodeGenerator
The RandomCodeGenerator type exposes the following members.
Name | Description | |
---|---|---|
RandomCodeGenerator |
Initializes new instance of RandomCodeGenerator generating random codes starting with prefix. Format of codes is specified by codePattern
parameter.
|
Name | Description | |
---|---|---|
CodeIsUnique |
Checks if given code is unique - not generated yet and accepted by CodeChecker function.
| |
GenerateCode |
Generates one new unique code. Throws exception when not able to generate unique code within 10 attempts.
| |
GetRandomDigit |
Returns random digit 0-9.
| |
GetRandomChar |
Returns random character A-Z.
| |
GetRandomNumber |
Returns random number from 0 to max (exclusive).
| |
GetRandomSymbol |
Returns random symbol 0-9 or A-Z.
| |
GetSymbolForType |
Returns charType. Override this method to add custom character sets.
| |
RememberCode |
Remembers given code as already generated.
| |
TryGenerateCode |
Generates one random code.
|
Name | Description | |
---|---|---|
AsValue |
Converts object to a query value which can be used as a query parameter
(Defined by QueryExtensions.) | |
GetAPIString |
Gets the string by the specified resource key
(Defined by CoreExtensions.) | |
GetString |
Gets the string by the specified resource key
(Defined by CoreExtensions.) | |
ToBoolean |
Returns the boolean representation of an object or default value if not.
(Defined by CoreExtensions.) | |
ToDateTime |
Returns the DateTime representation of an object or default value if not.
(Defined by CoreExtensions.) | |
ToDouble |
Returns the double representation of an object or default value if not.
(Defined by CoreExtensions.) | |
ToGuid |
Returns the Guid representation of an object or default value if not.
(Defined by CoreExtensions.) | |
ToInteger |
Returns the integer representation of an object or default value if not.
(Defined by CoreExtensions.) | |
ToString |
Returns the string representation of an object or default value if not.
(Defined by CoreExtensions.) |
Name | Description | |
---|---|---|
digits |
Digits 0-9.
| |
chars |
Characters A-Z.
| |
pattern |
Pattern of generated codes. It is set via constructor.
| |
prefix |
Prefix of codes. This string will be added at the beginning of all generated codes.
| |
symbols |
Symbols A-Z and 0-9.
|
Name | Description | |
---|---|---|
CodeChecker |
Function returning true when its parameter represents acceptable code.
|