Class BizFormHelper
- Namespace
- CMS.OnlineForms
- Assembly
- CMS.OnlineForms.dll
Provides helper methods for biz forms.
public class BizFormHelper : AbstractHelper<BizFormHelper>
- Inheritance
-
objectBizFormHelper
- Inherited Members
- Extension Methods
Constructors
BizFormHelper()
public BizFormHelper()
Methods
Create(string, string, string)
Creates a new biz form by creating the underlying database table and setting the corresponding BizFormInfo and DataClassInfo. The database table name is prefixed using GetFormTablePrefix() and processed by GetFullTableName(TableManager, string, string) which truncates excessive table names.
If formName is not specified or its value equals CODENAME_AUTOMATIC,
a new code name is created based on display name.
The form name is sanitized via GetIdentifier(object, string). The form name is used as table name
if tableName is not specified or its value equals to CODENAME_AUTOMATIC.
public static BizFormInfo Create(string formDisplayName, string formName, string tableName)
Parameters
formDisplayNamestringDisplay name of the form.
formNamestringName of the form, or null.
tableNamestringTable name to store form data, or null.
Returns
- BizFormInfo
Returns the new biz form.
Remarks
The resulting BizFormInfo has FormLogActivity enabled by default.
Exceptions
- ArgumentNullException
Thrown when
formDisplayNameis null.- ArgumentException
Thrown when
formDisplayNameis an empty string.- BizFormTableNameNotUniqueException
Thrown when biz form table of specified name already exists.
- BizFormException
Thrown when an exception during database table creation, BizFormInfo creation or DataClassInfo creation occurs. See the inner exception for details.
CreateBizFormInfo(string, string)
Creates a new BizFormInfo and initializes it using given display name and name. Does not set the info to the database. The method is used by CMS.OnlineForms.BizFormHelper.CreateInternal(System.String,System.String,System.String,System.String) to supply the BizFormInfo instance.
If formName is not specified or its value equals CODENAME_AUTOMATIC,
a new code name is created based on display name.
The form name is sanitized via GetIdentifier(object, string) and can be safely used as part of the resulting table name.
protected virtual BizFormInfo CreateBizFormInfo(string formDisplayName, string formName)
Parameters
formDisplayNamestringDisplay name of the form.
formNamestringName of the form, or null.
Returns
- BizFormInfo
Returns a new BizFormInfo instance initialized with given values.
Remarks
The resulting BizFormInfo has FormLogActivity enabled by default.
Exceptions
- ArgumentNullException
Thrown when
formDisplayNameis null.- ArgumentException
Thrown when
formDisplayNameis an empty string.
CreateInternal(string, string, string)
Creates a new biz form by creating the underlying database table and setting the corresponding BizFormInfo and DataClassInfo. The database table name is prefixed using GetFormTablePrefix() and processed by GetFullTableName(TableManager, string, string) which truncates excessive table names.
If formName is not specified or its value equals CODENAME_AUTOMATIC,
a new code name is created based on display name.
The form name is sanitized via GetIdentifier(object, string). The form name is used as table name
if tableName is not specified or its value equals to CODENAME_AUTOMATIC.
protected virtual BizFormInfo CreateInternal(string formDisplayName, string formName, string tableName)
Parameters
formDisplayNamestringDisplay name of the form.
formNamestringName of the form, or null.
tableNamestringTable name to store form data, or null.
Returns
- BizFormInfo
Returns the new biz form.
Remarks
The resulting BizFormInfo has FormLogActivity enabled by default.
Exceptions
- ArgumentNullException
Thrown when
formDisplayNameis null.- ArgumentException
Thrown when
formDisplayNameis an empty string.- BizFormTableNameNotUniqueException
Thrown when biz form table of specified name already exists.
- BizFormException
Thrown when an exception during database table creation, BizFormInfo creation or DataClassInfo creation occurs. See the inner exception for details.
GetFormTablePrefix()
Gets prefix for biz form table name. The prefix is a string in format Form_.
public static string GetFormTablePrefix()
Returns
- string
Returns prefix for biz form table name.
GetFormTablePrefixInternal()
Gets prefix for biz form table name. The prefix is a string in format Form_.
protected virtual string GetFormTablePrefixInternal()
Returns
- string
Returns prefix for biz form table name.
GetFullTableName(TableManager, string, string)
Gets table name including prefix for biz form table. Both tableNamePrefix and tableName must be
sanitized strings suitable for a table name.
If the resulting table name is longer than 60 characters, it is truncated and appended an ordinal number to ensure uniqueness.
public static string GetFullTableName(TableManager tableManager, string tableNamePrefix, string tableName)
Parameters
tableManagerTableManagerTable manager to be used for uniqueness testing when truncating table name.
tableNamePrefixstringTable name prefix from which to derive full table name.
tableNamestringTable name from which to derive full table name.
Returns
- string
Returns full table name derived from a prefix and table name.
Exceptions
- ArgumentNullException
Thrown when
tableManager,tableNamePrefixortableNameis null.- ArgumentException
Thrown when
tableNamePrefixortableNameis an empty string.
GetFullTableNameInternal(TableManager, string, string)
Gets table name including prefix for biz form table. Both tableNamePrefix and tableName must be
sanitized strings suitable for a table name.
If the resulting table name is longer than 60 characters, it is truncated and appended an ordinal number to ensure uniqueness.
protected virtual string GetFullTableNameInternal(TableManager tableManager, string tableNamePrefix, string tableName)
Parameters
tableManagerTableManagerTable manager to be used for uniqueness testing when truncating table name.
tableNamePrefixstringTable name prefix from which to derive full table name.
tableNamestringTable name from which to derive full table name.
Returns
- string
Returns full table name derived from a prefix and table name.
Exceptions
- ArgumentNullException
Thrown when
tableManager,tableNamePrefixortableNameis null.- ArgumentException
Thrown when
tableNamePrefixortableNameis an empty string.