Class SQLWrapperResultsController
A standard controller that displays results of executing a ISQLWrapper against any entity in the system
Uses the SQLWrapperResultsViewParams for the parameters of the ISQLWrapper to execute
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Views.Controllers
Assembly: LemonEdge.ClientCore.dll
Syntax
[ViewSerializedParam(typeof(SQLWrapperResultsViewParams))]
public class SQLWrapperResultsController : BaseGridAnyRelatedAnyCollectionController<ISQLWrapperResult>, IBaseGridController, ICollectionExportable, INewGridItemImplementor<ISQLWrapperResult>, ICopyGridItemImplementor<ISQLWrapperResult>, IGrid, IDeleteGridItemImplementor<ISQLWrapperResult>, ISearchController, IModelViewController
Constructors
SQLWrapperResultsController(IBaseGridAnyRelatedAnyCollection<ISQLWrapperResult>)
Creates a new SQLWrapperResultsController
Declaration
public SQLWrapperResultsController(IBaseGridAnyRelatedAnyCollection<ISQLWrapperResult> view)
Parameters
Type | Name | Description |
---|---|---|
IBaseGridAnyRelatedAnyCollection<ISQLWrapperResult> | view | The IBaseGridRelatedCollection view implementation using the UI components of the client application |
Properties
AllowCopyCommand
Indicates the command to allow selected rows to be copied by the user is included in the InitCommands(IList<ViewCommand>)
The default is false
Declaration
public override bool AllowCopyCommand { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
AllowNewCommand
Indicates the command to allow new items to be created by the user is included in the InitCommands(IList<ViewCommand>)
The default is false if NewItemHelper is equal to null
Declaration
public override bool AllowNewCommand { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
AllowOpenCommand
Indicates the command to allow selected rows to be opened by the user is included in the InitCommands(IList<ViewCommand>)
The default is false
Declaration
public override bool AllowOpenCommand { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
AutoSelectFirstRow
Indicates the first row of the results in this grid should automatically be selected by the view when the data is loaded and displayed
The default is false
Declaration
protected override bool AutoSelectFirstRow { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
CanCreateNew
Indicates if the user can create new items in the grid
The default implementation is true, allowing specific controller implementations to provide override values
Declaration
public override bool CanCreateNew { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
CollectionRelationshipColumnName
Indicates all ISQLWrapperResult are related through the SQLWrapperID property
Declaration
public override string CollectionRelationshipColumnName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
ContextHelpURL
An optional associated url of a help file for the view this controller works with
Declaration
public override string ContextHelpURL { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
CustomCommandParam
Declaration
protected override string CustomCommandParam { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
DefaultColumnGroupIndexes
Returns the indexes of the columns that should be grouped by default which are marked as GridGroupBy in the ISQLWrapper definition
Declaration
public override IEnumerable<int> DefaultColumnGroupIndexes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<int> |
Overrides
DefaultFrozenColumnCount
Returns the index of the column to show the pane freeze splitter which is marked as GridFreezeUpTo in the ISQLWrapper definition
If there are no columns marked as such then the default is returned of the first column
Declaration
public override int DefaultFrozenColumnCount { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
DefaultRowCount
The default number of rows that should be displayed in the grid before the grid will start paging the results
The default number is DisplayableItemDescriptor.UIRestrictedMaxCollectionItems which can be set depending on the client application. For instance mobiles can override this to a smaller number
The default if DisplayableItemDescriptor.UIRestrictedMaxCollectionItems is not set is 500Declaration
public override int DefaultRowCount { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
DefaultSearchColumn
Returns the column to be used when searching the grid by default, which is marked with GridIsDefaultSearch
Declaration
protected override string DefaultSearchColumn { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
ExcelExportCommand
Overrides the standard excel export command to use the ExportData command with the ISQLWrapper this controller is executing
Declaration
protected override ViewCommand ExcelExportCommand { get; }
Property Value
Type | Description |
---|---|
ViewCommand |
Overrides
LimitPagesToTotal
Declaration
public override bool LimitPagesToTotal { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
ListenToChanges
Indicates if this controller should listen to every item change.
Default is true as we want to provide the ability to bulk update multiple selected rows if a value changes
Declaration
public override bool ListenToChanges { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
LoadPager
Indicates if a pager should be used at all - default true. If not then all results will always be loaded
Declaration
public override bool LoadPager { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
OnlyExportFromQuery
Returns True - Indicates the export functionality should only work from the query itself, and not from results that are displayed in the grid
Declaration
public override bool OnlyExportFromQuery { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
RowPreviewColumns
Returns the column(s) that should have their values appear as text in a preview tooltip when scrolling, which are marked as GridPartOfRowHeader in the ISQLWrapper definition
Declaration
public override IEnumerable<ControlDisplayInfo> RowPreviewColumns { get; }
Property Value
Type | Description |
---|---|
IEnumerable<ControlDisplayInfo> |
Overrides
SelectedItemForSubViews
Returns the first selected item in the IBaseGrid<T> for any sub-views
Declaration
public override object SelectedItemForSubViews { get; }
Property Value
Type | Description |
---|---|
object |
Overrides
Methods
AddCustomCommand(ICustomCommand)
Declaration
protected override bool AddCustomCommand(ICustomCommand cmd)
Parameters
Type | Name | Description |
---|---|---|
ICustomCommand | cmd |
Returns
Type | Description |
---|---|
bool |
Overrides
AddParameterFilterToQuery(QueryableExecuter<ISQLWrapperResult>, QueryableFilter)
Declaration
protected virtual QueryableExecuter<ISQLWrapperResult> AddParameterFilterToQuery(QueryableExecuter<ISQLWrapperResult> query, QueryableFilter filter)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<ISQLWrapperResult> | query | |
QueryableFilter | filter |
Returns
Type | Description |
---|---|
QueryableExecuter<ISQLWrapperResult> |
AddParameterIDFilterToQuery(QueryableExecuter<ISQLWrapperResult>, IEnumerable<Guid>)
Declaration
protected virtual QueryableExecuter<ISQLWrapperResult> AddParameterIDFilterToQuery(QueryableExecuter<ISQLWrapperResult> query, IEnumerable<Guid> ids)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<ISQLWrapperResult> | query | |
IEnumerable<Guid> | ids |
Returns
Type | Description |
---|---|
QueryableExecuter<ISQLWrapperResult> |
ColumnGroups()
Returns all the column groups setup in the ISQLWrapper by the columns marked with GridGroupHeader and GridSubGroupHeader values
Declaration
public override IEnumerable<GridColumnGroup> ColumnGroups()
Returns
Type | Description |
---|---|
IEnumerable<GridColumnGroup> | All the column groups setup in the ISQLWrapper by the columns marked with GridGroupHeader and GridSubGroupHeader values |
Overrides
Columns()
Returns all the columns defined in the ISQLWrapper with their appropriate type, settings and visibility
Declaration
public override IEnumerable<ControlDisplayInfo> Columns()
Returns
Type | Description |
---|---|
IEnumerable<ControlDisplayInfo> | All the columns defined in the ISQLWrapper with their appropriate type, settings and visibility |
Overrides
DisplayUI()
Loads the ISQLWrapper to execute, from the wrapper specified in the SQLWrapperResultsViewParams or from the SingleItem this view is displaying if it is a SQLWrapper or Dataset
Once loaded (or already loaded), the system displays parameters (if required or is not the first execution of the grid) then displays the results
Declaration
public override Task DisplayUI()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
GetControlDisplayInfo(SQLWrapperInterpretor, ISQLTypeWrapper, short, bool)
Returns a control display info for displaying the specified control (defined using a ISQLTypeWrapper) against a ISQLWrapperResult
Declaration
public static ControlDisplayInfo GetControlDisplayInfo(SQLWrapperInterpretor helper, ISQLTypeWrapper col, short index, bool asParam)
Parameters
Type | Name | Description |
---|---|---|
SQLWrapperInterpretor | helper | The sql wrapper tor this control is being defined for |
ISQLTypeWrapper | col | The column defining the control |
short | index | The index to use for this control in the sequence of controls being created |
bool | asParam |
Returns
Type | Description |
---|---|
ControlDisplayInfo | A control display info for displaying the specified control (defined using a ISQLTypeWrapper) against a ISQLWrapperResult |
GetControlDisplayInfo(Func<ISQLTypeWrapper, string>, Func<int, ISQLTypeWrapper>, Func<int, ISQLTypeWrapper>, ISQLTypeWrapper, short, bool)
Returns a control display info for displaying the specified control (defined using a ISQLTypeWrapper) against a ISQLWrapperResult
Declaration
public static ControlDisplayInfo GetControlDisplayInfo(Func<ISQLTypeWrapper, string> getColumnBinding, Func<int, ISQLTypeWrapper> getColumnFromIndex, Func<int, ISQLTypeWrapper> getColumnPointingToIndex, ISQLTypeWrapper col, short index, bool asParam)
Parameters
Type | Name | Description |
---|---|---|
Func<ISQLTypeWrapper, string> | getColumnBinding | The binding this control will bound to on the ISQLWrapperResult |
Func<int, ISQLTypeWrapper> | getColumnFromIndex | Returns the column definition for the specified index |
Func<int, ISQLTypeWrapper> | getColumnPointingToIndex | |
ISQLTypeWrapper | col | The column defining the control |
short | index | The index to use for this control in the sequence of controls being created |
bool | asParam |
Returns
Type | Description |
---|---|
ControlDisplayInfo | A control display info for displaying the specified control (defined using a ISQLTypeWrapper) against a ISQLWrapperResult |
GetCopyGridCommand()
Returns the command for copying an item in the grid
Not implemented for this controller as the ISQLWrapperResult may not be an entity type it knows how to copy. Must be implemented by an inheriting controller.
Declaration
protected override ViewCommand GetCopyGridCommand()
Returns
Type | Description |
---|---|
ViewCommand | The command for copying an item in the grid |
Overrides
GetExportableColumnInfo(IEnumerable<ColumnDescriptor>)
Gets the columns that can be exported from this query including their visibility status
Declaration
public override Task<IEnumerable<ControlDisplayVisibilityInfo>> GetExportableColumnInfo(IEnumerable<ColumnDescriptor> visibleColumns)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ColumnDescriptor> | visibleColumns | The current columns visible in the grid |
Returns
Type | Description |
---|---|
Task<IEnumerable<ControlDisplayVisibilityInfo>> | The columns that can be exported from this query including their visibility status |
Overrides
GetGridSourceItems()
Prompts for parameters (if required or not the first execution), and executes the query with the correct filters/parameters, returning the results
Declaration
public override Task<IEnumerable<ISQLWrapperResult>> GetGridSourceItems()
Returns
Type | Description |
---|---|
Task<IEnumerable<ISQLWrapperResult>> | A list of all the results given the query execution |
Overrides
GetHeaderLabel(string)
Declaration
public string GetHeaderLabel(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value |
Returns
Type | Description |
---|---|
string |
GetNewGridCommand()
Returns the command for creating a new item in the grid
Declaration
protected override ViewCommand GetNewGridCommand()
Returns
Type | Description |
---|---|
ViewCommand | The command for creating a new item in the grid |
Overrides
GetOpenGridCommand()
Overrides the default open behaviour with a custom open command that provides the ability to open all the different type of openable items in a single query result
Declaration
protected override ViewCommand GetOpenGridCommand()
Returns
Type | Description |
---|---|
ViewCommand | A custom open command capable of opening more than one item from a query result row |
Overrides
GetQueryForExcelResults()
Returns the QueryableExecuter used to filter results from this custom ISQLWrapper query
Declaration
public override QueryableExecuter GetQueryForExcelResults()
Returns
Type | Description |
---|---|
QueryableExecuter | The QueryableExecuter used to filter results from this custom ISQLWrapper query |
Overrides
InitAsync()
Initializes this controller by loading the View.Descriptor.Param as a SQLWrapperResultsViewParams
If the WrapperID is set then the system loads the definition using a SQLWrapperInterpretor
Declaration
public override Task InitAsync()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
InitCommands(IList<ViewCommand>)
Adds a command called [Run] that prompts for parameter changes to the query and then re-runs to get all the new results
Declaration
protected override void InitCommands(IList<ViewCommand> commands)
Parameters
Type | Name | Description |
---|---|---|
IList<ViewCommand> | commands | The current commands for the controller |
Overrides
OnOpenRowItem(ISQLWrapperResult)
Automatically opens in a new layout the default openable item from this query
The openable items can be retrieved from OpenableColumns
Declaration
public override Task OnOpenRowItem(ISQLWrapperResult rowItem)
Parameters
Type | Name | Description |
---|---|---|
ISQLWrapperResult | rowItem | The selected row to open an item from |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
OnTrackedItemChanged(object, string)
Provids a mechanism for handling changes for any item in the context
By default this is used to apply changes made to a selected item automatically to all other selected items in the grid (if multi-select is enabled)
Declaration
protected override void OnTrackedItemChanged(object item, string propName)
Parameters
Type | Name | Description |
---|---|---|
object | item | The item that changed |
string | propName | The property name of the changed value |
Overrides
Redisplay()
Forces the query to be re-run (including prompting for parameters if required)
Declaration
public override Task Redisplay()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |