Search
/
|
|
|

Data Manager Customizations

Data Manager, one of the most powerful toolsets in EfficiencySpring, has several options available for adding customizations via coding.

1) Classes inherited from EfficiencyCommon API

The three primary classes from the EfficiencyCommon.DataManager namespace are inherited into the EfficiencyCommonC namespace.

Base Class Derived Class
EfficiencyCommon.DataManager.Record EfficiencyCommonC.Record
EfficiencyCommon.DataManager.StructureElement EfficiencyCommonC.StructureElement
EfficiencyCommon.DataManager.RecordSearch EfficiencyCommonC.RecordSearch


The files containing the derived classes are located in the \app_code\data_manager folder, and can be customized directly. In addition:

  • The derived EfficiencyCommonC.Record class can used as a template for making separated customized versions of the Record class (covered in item 2 of this page).
  • The derived EfficiencyCommonC.RecordSearch class can also be utilized as a template for making separate customized versions of the RecordSearch class.


The following table contain functions and subroutines in the EfficiencyCommonC.Record class that are often customized:

Function/Subroutine Purpose
New Constructor
InsertRecord Handles the insertion of database record, as well as any subrecords. Custom logic can be added both before and after the record insert.
UpdateRecord

Handles updates to the database record, as well as any subrecords. Custom logic can be added both before and after the record update.

LoadValuesFromDB Loads the current values from the database.
ValidateServerSide Runs server-side validation against the Record object. Additional validation logic can be added here.
DeleteRecord Handles the deletion of the database record, as well as any subrecords related to the record. Custom logic can be added both before and after the record delete.
UserHasAccessToRecord Determines whether the user has access to the record, based on the ownership settings of the section. Custom logic can be added to enforce additional checks.

 

The next table lists functions and subroutines in the EfficiencyCommonC.StructureElement class that are also often customized:

Function/Subroutine Purpose
New The constructor of the class
CustomizedStructureElementPreRender Executes custom code before the StructureElement's value is rendered on the add/edit/view Data Manager pages.
CustomizedStructureElementRender Executes custom code for StructureElements with the structure type "Custom" on the add/edit/view Data Manager pages.
RenderInput Handles the rendering of the add/edit interfaces for the structure element.
BuildInput(StringBuilder) Similar to RenderInput. Instead of immediately writing the interface though, this overloaded subroutine/function saves the interface to a StringBuilder or String object.
ValidateServerSide Handles the server-side validation for the structure element.
WriteJavaScriptValidation Writes the JavaScript validation for the structure element.
GetPlainTextValue Returns the current value of the structure element in plain text.
GetHtmlEncodedValue Returns the current value of the structure element in formatted HTML.
GetSqlValue Returns the current value of the structure element prepped as a SQL literal.
LoadValueFromForm Sets the current value of the structure element using the value posted in the Request.Form object.
LoadValueFromQueryString Sets the current value of the structure element using the value in the Request.QueryString object.



The derived EfficiencyCommonC.RecordSearch class contains a wrapper function called ConstructSearchQuery, which is responsible for assembling the SQL query necessary for searching Data Manager sections, as well as for running exports and reports. The SQL generated from the base class can be intercepted in the wrapper function, and updated with relevant customizations related to security or business context. After the internal call to ContructSearchQuery completes, four variables (strSelectstrFrom, strWhere, strSort) are available to modify and then use to reassemble the search query.
 

2) Centralized method for instantiating the Record class

The EfficiencySpringPage class, which is inherited into every EfficiencySpring web page, contains an instance of the EfficiencyCommonC.CoreObjectFactory class. This class contains a function called CreateNewRecordObject, which is used to instantiate a standard or customized version of the Record class. This function is utilized everywhere in the aspx codebase for creating Record objects, providing a central place for controlling what version of the Record class is created, based on the context of the user.

The function is located in the CoreObjectFactory.vb file, and already contains several examples of instantiating custom versions of the Record object based on the active section's URL.
 

3) Centralized method for instantiating the RecordSearch class

As stated above, the EfficiencySpringPage class, which is inherited into every EfficiencySpring web page, contains an instance of the EfficiencyCommonC.CoreObjectFactory class. This class contains a function called CreateNewRecordSearchObject, which is used to instantiate a standard or customized version of the RecordSearch class. The function is utilized everywhere in the aspx codebase for creating RecordSearch objects, providing a central place for controlling what version of the RecordSearch class is created, based on the context of the user.

The function is located in the CoreObjectFactory.vb file, and already contains an example of instantiating a custom version of the RecordSearch object based on the active section's URL.


Printable Version