Class CustomForm
- Namespace
- CustomFormProcessor
- Assembly
- PolarStudio.dll
This class is used to create custom forms that store their data in xml in a table. The table must be of a type or category that contains the definition for the form of that type/category.
public class CustomForm : XMLparent
- Inheritance
-
CustomForm
- Inherited Members
- Extension Methods
Fields
AllowFieldNameCollisions
This property gets/sets if field name collissions (fields in the custom form having the same name as a field in the containing table) are allowed.
public bool AllowFieldNameCollisions
Field Value
DefaultControlClass
This property gets/sets the css class to apply to controls that have no class specified.
public string DefaultControlClass
Field Value
ShowFullTextSearchInEditor
This property gets/sets if the editor should support full text search.
public bool ShowFullTextSearchInEditor
Field Value
Properties
CompiledTemplate
This property gets the compiled form template.
public string CompiledTemplate { get; }
Property Value
CustomModuleCode
This property gets/set the source of the custom code module.
public string CustomModuleCode { get; set; }
Property Value
CustomModuleCompileError
This property get the text of the last compile error for the custom module.
public string CustomModuleCompileError { get; }
Property Value
CustomModuleTestExpression
The expression to test the custom module.
public string CustomModuleTestExpression { get; set; }
Property Value
DeleteAllowed
Gets if delete is allowed in this form.
public bool DeleteAllowed { get; }
Property Value
DeleteAllowedScript
A script expression to determine if delete is allowed.
public string DeleteAllowedScript { get; }
Property Value
DeleteAllowedStates
States in which delete is (not) allowed
public string DeleteAllowedStates { get; }
Property Value
EditAllowed
Gets if edit is allowed in this form.
public bool EditAllowed { get; }
Property Value
EditAllowedScript
A script expression to determine if edit is allowed.
public string EditAllowedScript { get; }
Property Value
EditAllowedStates
States in which edit is (not) allowed
public string EditAllowedStates { get; }
Property Value
Fields
Gets the custom fields in this custom form.
public Collection<CustomFormField> Fields { get; }
Property Value
FormAnalysis
This property gets the analysis of the last compiled form design template.
public string FormAnalysis { get; }
Property Value
FormDesignTemplate
This property gets/set the form design template.
public string FormDesignTemplate { get; set; }
Property Value
FormStorageFieldName
Gets the name of the field to store the form data in.
public string FormStorageFieldName { get; }
Property Value
ParentForm
Gets the parent custom form (if applicable).
public CustomForm ParentForm { get; }
Property Value
StateFieldName
Returns the name of the state field.
public string StateFieldName { get; }
Property Value
XML
This method returns the full xml of the data stored in the custom form.
public string XML { get; }
Property Value
Methods
AddField(string, string, string)
This method creates a custom form field (or updates its type). If a new field is created but data for that field is already existing in the data xml, this value is used.
public CustomFormField AddField(string pFieldName, string pFieldType, string pFieldSubType = "")
Parameters
pFieldName
stringThe name of the field to create or update.
pFieldType
stringThe field type to use.
pFieldSubType
stringThe field sub type to use.
Returns
- CustomFormField
The new or updated field.
Alive()
This property always returns True. Is used to check if the object is still alive.
public bool Alive()
Returns
- bool
True
AutoInitialise(Context, string, string, string, string, string, string, string, long, string, bool, string, bool)
This method is used to quickly initialize the Custom Form when accessed.
public object AutoInitialise(Context pContext, string pFormTypeIDfieldName = "", string pFormTypeTableName = "", string pFormTypeTablePKfieldName = "", string pFormTypeTableFormDefFieldName = "", string pFormTableName = "", string pFormStorageFieldName = "", string pFormStartedScriptExpression = "", long pForcedFormTypeID = 0, string pParentFormTypeFieldName = "", bool pAutoCreateDefaultFormTemplates = false, string pStateFieldName = "", bool pSuppressScriptedEvents = false)
Parameters
pContext
ContextThe Context.
pFormTypeIDfieldName
stringThe name of the foreign key holding the type of a record in this table (like 'CustomerTypeID').
pFormTypeTableName
stringThe name of the table describing the type of record in this table (like 'CustomerType').
pFormTypeTablePKfieldName
stringThe name of the primary key in the type-table (like 'CustomerTypeID')
pFormTypeTableFormDefFieldName
stringThe name of the form definition field in the type-table (like 'CustomFormDefinition')
pFormTableName
stringThe name of the 'current' table (Like 'Customer')
pFormStorageFieldName
stringThe name of the field in the current table that contains the xml data for the custom form (like 'CustomForm')
pFormStartedScriptExpression
stringA script expression that returns a boolean to indicate if the work in the record has 'started'. This can set specific permissions. Leave empty if you dont know what to do with it.
pForcedFormTypeID
longAn optional ID for force a specific form type.
pParentFormTypeFieldName
stringThe name of the ParentType-field in the type table when a recursive type is used (like 'ParentCustomerTypeID')
pAutoCreateDefaultFormTemplates
boolA boolean indicating default form templates are to be created if no form templates are set in the form-definition. May result in rough forms.
pStateFieldName
stringThe name of the state field to use for workflow.
pSuppressScriptedEvents
boolUsed internally for recursive types. Keep as False.
Returns
CalculateCalculatedFields(Context)
This method calculates the values of calculated fields.
public string CalculateCalculatedFields(Context pContext)
Parameters
pContext
ContextThe context.
Returns
- string
An empty string.
CancelUpdate(Context)
This method is to be called in the OnCancel event in the form to reset the form to the original values.
public void CancelUpdate(Context pContext)
Parameters
pContext
ContextThe context
CheckRequiredFields(Context, ref int, ref string, string)
This method is to be called in the OnUpdate event of the dataset and checks for required fields.
public object CheckRequiredFields(Context pContext, ref int pFieldListCount, ref string pFieldList, string pFieldSeparator = "")
Parameters
pContext
ContextThe context.
pFieldListCount
intBy ref int parameter that will be set to the number of missing required fields.
pFieldList
stringBy ref string parameter that will be set to the names of the missing fields.
pFieldSeparator
stringAn optional string used to separate the fields returned in pFieldList. Defaults to ', '
Returns
CheckState(Context, string)
This method checks if the current state matches the specied state(s).
public bool CheckState(Context pContext, string pStates)
Parameters
pContext
ContextThe context
pStates
stringThe state(s) to match, like: "New,InProgress,Done" or "!Cancelled,Rejected"
Returns
CodedVersion()
This method returns the version of this library coded as 1.2.3
public string CodedVersion()
Returns
- string
A string with the coded version
CreateCustomControl(Context, string)
This method returns the html for one custom form field.
public string CreateCustomControl(Context pContext, string pCustomControlName)
Parameters
pContext
ContextThe context.
pCustomControlName
stringThe name of the custom form field for which the html is requested.
Returns
- string
The html for the control.
CreateCustomControlCaption(Context, string)
This method returns the caption of the specified custom control.
public string CreateCustomControlCaption(Context pContext, string pCustomControlName)
Parameters
pContext
ContextThe context
pCustomControlName
stringThe name of the control for which the caption is to be created.
Returns
- string
The html for the caption.
CreateHTML(Context)
This method creates the html for the custom form.
public string CreateHTML(Context pContext)
Parameters
pContext
ContextThe context for scripts.
Returns
- string
The html string.
CreateSimpleHTML(Context, string)
This method returns a simple form with the html of this custom form using bootstrap.
public string CreateSimpleHTML(Context pContext, string pFieldNames = "")
Parameters
pContext
ContextThe context
pFieldNames
stringA list of fieldnames to get the html for. Can be preceeded by a dash (minus) character to invert the selection. Separate the names using comma's or semicolons.
Returns
- string
The html for the custom fields.
CreateSimpleText(Context, int)
This method returns the contents of the form layed out as plain text.
public string CreateSimpleText(Context pContext, int pCaptionWidthCharacters = 0)
Parameters
pContext
ContextThe context.
pCaptionWidthCharacters
intThe default width of captions in characters.
Returns
CustomModule(Context)
public object CustomModule(Context pContext)
Parameters
pContext
Context
Returns
CustomModule(Context, ref string)
Returns the compiled CustomCodeModule for this custom form.
public CustomCodeModule CustomModule(Context pContext, ref string pCompileError)
Parameters
pContext
ContextThe context used to compile.
pCompileError
stringA by ref string that is set to the compile error if applicable.
Returns
- CustomCodeModule
The CustomCodeModule or Nothing in case of a compile error.
DefaultsExist(Context)
Returns true if any of the fields have a default value.
public bool DefaultsExist(Context pContext)
Parameters
pContext
ContextThe context.
Returns
- bool
True if any of the fields have a default value.
DeleteAllowedResult(Context)
This method returns True if delete is allowed for the current record. It takes the global delete-allowed into account, the state and and DeleteAllowedScript.
public bool DeleteAllowedResult(Context pContext)
Parameters
pContext
ContextThe context.
Returns
- bool
True if delete is allowed.
DoAction(Context, string)
This method take a specific action. Used internally.
public string DoAction(Context pContext, string pAction)
Parameters
Returns
- string
A message indicating the result.
EditAllowedResult(Context)
This method returns True if edit is allowed for the current record. It takes the global edit-allowed into account, the state and and EditAllowedScript.
public bool EditAllowedResult(Context pContext)
Parameters
pContext
ContextThe context.
Returns
- bool
True if edit is allowed.
FillDefaults(Context, bool)
This property must be called in the OnInsert-event of the data table. It sets all defaults for custom fields.
public void FillDefaults(Context pContext, bool pForcedFill = false)
Parameters
pContext
ContextThe context.
pForcedFill
boolA boolean to indicate that fields must also be set to NULL/empty.
FormManipulator(Context)
This method is to be called from Polar Studio in the OnStartHTML-creation event of the data table to make sure the form is modified to the type of record.
public string FormManipulator(Context pContext)
Parameters
pContext
ContextThe context for the form.
Returns
- string
May return a string as is returned by the OnStartHTMLcreation-event that is fired by this method.
GetCompiledTemplate(Context, string)
This method compiles the given FormDesignTemplate. Any errors will be available in the FormAnalysis property.
public string GetCompiledTemplate(Context pContext, string pFormDesignTemplate)
Parameters
pContext
ContextThe context to use for compilation.
pFormDesignTemplate
stringThe template to compile.
Returns
- string
The compiled template.
GetCompiledTemplate(Context, string, ref string)
This method compiles the given FormDesignTemplate. Any errors will be available in the by-ref parameter pErrorMessages.
public string GetCompiledTemplate(Context pContext, string pFormDesignTemplate, ref string pErrorMessages)
Parameters
pContext
ContextThe context to use for compilation.
pFormDesignTemplate
stringThe template to compile.
pErrorMessages
stringA by-ref parameter that will contain any error messages if applicable.
Returns
- string
The compiled template.
GetCustomVariable(string, object)
This method get a custom variable from the stored xml.
public object GetCustomVariable(string pVarName, object pDefaultValue = null)
Parameters
pVarName
stringThe name of the custom variable.
pDefaultValue
objectThe value to use when the variable was not found.
Returns
- object
The value of the variable or the specified default value if not found.
GetFormDesignTemplate()
Gets the FormDesignTemplate for this record.
public string GetFormDesignTemplate()
Returns
HasProcedure(Context, string)
This function returns True if the given procedure is implemented (in this level or a level above).
public bool HasProcedure(Context pContext, string pProcedureName)
Parameters
Returns
Keep(Context)
This method keeps the values of the custom form in memory for later user.
public void Keep(Context pContext)
Parameters
pContext
ContextThe context.
ParseTextForIncludes(Context, string)
This method takes the input text and evaluates all embeded <%...%gt;-script expressions against the custom module.
public string ParseTextForIncludes(Context pContext, string pInputText)
Parameters
Returns
Release(Context)
The method releases a kept record from memory for this custom form (for the current record only).
public void Release(Context pContext)
Parameters
pContext
ContextThe context.
ReleaseAll()
The method releases all kepts record from memory for this custom form.
public void ReleaseAll()
RemoveField(string)
This method removes the specified field.
public void RemoveField(string pFieldName)
Parameters
pFieldName
stringThe field to remove
ReturnPopupSelectItemData(Context, int, string, string)
This method returns the data for a SelectItemPopup as a collection
public Collection ReturnPopupSelectItemData(Context pContext, int pMaxRecordCount, string pFilter, string pSubControlName)
Parameters
pContext
ContextThe Context
pMaxRecordCount
intThe max number of records to return.
pFilter
stringA filter to search for.
pSubControlName
stringAn optional SubControlName
Returns
- Collection
A collection with the data to show.
RunOverruledScript(Context, string)
This function only runs the top-most existing implementation of the function and then stops, even if an null result was returned
public object RunOverruledScript(Context pContext, string pScriptExpression)
Parameters
Returns
- object
The result of the script.
RunScript(Context, string)
This function will run all scripts for all levels (starting at the top-most parent) until a result (not-null-string) is given
public object RunScript(Context pContext, string pScriptExpression)
Parameters
Returns
- object
The result of the script.
ScriptEvaluate(Context, string)
This method evaluates a script in the current custom form. Errors will be ignored.
public object ScriptEvaluate(Context pContext, string pExpression)
Parameters
Returns
- object
The result of the evaluation.
ScriptEvaluate(Context, string, bool)
This method evaluates a script in the current custom form.
public object ScriptEvaluate(Context pContext, string pExpression, bool pReturnErrorMessageAsResult = false)
Parameters
pContext
ContextThe context to use.
pExpression
stringThe expression to evaluate.
pReturnErrorMessageAsResult
boolA boolean indicating an error is to be returned as a message for this call.
Returns
- object
The result of the evaluation.
ScriptEvaluate(Context, string, ref string, bool)
This method evaluates a script in the current custom form.
public object ScriptEvaluate(Context pContext, string pExpression, ref string pErrorMessage, bool pReturnErrorMessageAsResult = false)
Parameters
pContext
ContextThe context to use.
pExpression
stringThe expression to evaluate.
pErrorMessage
stringA by ref string that will contain the error message if applicable.
pReturnErrorMessageAsResult
boolA boolean indicating an error is to be returned as a message for this call.
Returns
- object
The result of the evaluation.
SetCustomVariable(string, object)
This method sets a custom variable to store in the xml.
public void SetCustomVariable(string pVarName, object pNewValue)
Parameters
StoreCustomFormInFormVariables(Context)
This method stores this custom form in a variable in the web form.
public void StoreCustomFormInFormVariables(Context pContext)
Parameters
pContext
ContextThe context having a web form.
StoreXMLinDataBase(Context)
This method stores the values of the fields in the xml in the dataset.
public string StoreXMLinDataBase(Context pContext)
Parameters
pContext
ContextThe context.
Returns
- string
An errormessage if applicable.
UpdateCustomFields(Context)
This method updates the custom form fields. Is used internally; no need to call manually.
public string UpdateCustomFields(Context pContext)
Parameters
pContext
Context
Returns
Version()
This method returns the version of this library.
public string Version()
Returns
- string
A string with the version