Class ColumnHelper
This class is a helper that contains functionality for handling columns in an archive provider. It includes collections and methods for keeping track of available and chosen columns, determining whether any particular column is wanted, and the method that uses reflection to locate standard column declarations in client classes.
Inherited Members
Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public class ColumnHelper
Constructors
ColumnHelper(IArchiveProviderHasColumns)
Construct the instance, set the owner (client) class reference
Declaration
public ColumnHelper(IArchiveProviderHasColumns owner)
Parameters
| Type | Name | Description |
|---|---|---|
| IArchiveProviderHasColumns | owner |
Fields
DefaultCheckboxWidth
Default width setting for columns of type checkbox
Declaration
public const string DefaultCheckboxWidth = "4c"
Field Value
| Type | Description |
|---|---|
| string |
DefaultDateTimeWidth
Default width setting for columns of type date
Declaration
public const string DefaultDateTimeWidth = "16c"
Field Value
| Type | Description |
|---|---|
| string |
DefaultDateWidth
Default width setting for columns of type date
Declaration
public const string DefaultDateWidth = "10c"
Field Value
| Type | Description |
|---|---|
| string |
DefaultDecimalWidth
Default width setting for columns of type decimal (floating-point)
Declaration
public const string DefaultDecimalWidth = "12c"
Field Value
| Type | Description |
|---|---|
| string |
DefaultIconWidth
Default width setting for columns of type icon
Declaration
public const string DefaultIconWidth = "3c"
Field Value
| Type | Description |
|---|---|
| string |
DefaultNumberWidth
Default width setting for columns of type number (integer)
Declaration
public const string DefaultNumberWidth = "8c"
Field Value
| Type | Description |
|---|---|
| string |
DefaultStringWidth
Default width setting for columns of type string
Declaration
public const string DefaultStringWidth = "10%"
Field Value
| Type | Description |
|---|---|
| string |
DefaultTimeWidth
Default width setting for columns of type decimal (floating-point)
Declaration
public const string DefaultTimeWidth = "5c"
Field Value
| Type | Description |
|---|---|
| string |
Properties
AvailableColumns
Get the current list of available columns as an array
Declaration
public List<ArchiveColumnInfo> AvailableColumns { get; }
Property Value
| Type | Description |
|---|---|
| List<ArchiveColumnInfo> |
AvailableRestrictionColumns
Get the current list of available restriction columns as an array
Declaration
public List<ArchiveColumnInfo> AvailableRestrictionColumns { get; }
Property Value
| Type | Description |
|---|---|
| List<ArchiveColumnInfo> |
Count
Get the number of currently known columns
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
DesiredColumns
Current desired columns setting
Declaration
public string[] DesiredColumns { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
DisplayNamePrefix
Current display name prefix
Declaration
public string DisplayNamePrefix { get; }
Property Value
| Type | Description |
|---|---|
| string |
NamePrefix
Current name prefix
Declaration
public string NamePrefix { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
AddAvailableColumns(params ArchiveColumnInfo[])
Add one or more columns to the list of available columns for this client class. If the column already exists, then let the new column disable OrderBy and RestrictBy if it does not support them.
Declaration
public void AddAvailableColumns(params ArchiveColumnInfo[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| ArchiveColumnInfo[] | columns | One or more column information data blocks |
AddAvailableColumns(Action<ArchiveColumnInfo, ArchiveColumnInfo>, params ArchiveColumnInfo[])
Add one or more columns to the list of available columns for this client class. If the column already exists, the passed-in handler is called to deal with it
Declaration
public void AddAvailableColumns(Action<ArchiveColumnInfo, ArchiveColumnInfo> processDuplicates, params ArchiveColumnInfo[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<ArchiveColumnInfo, ArchiveColumnInfo> | processDuplicates | Method that gets the existing and the new column; any changes made to the existing column are what will be the final result |
| ArchiveColumnInfo[] | columns | One or more column information data blocks |
AddAvailableColumnsAfter(string, params ArchiveColumnInfo[])
Add one or more columns to the list of available columns for this client class. Add them right after the named column, if it exists, or at the end if it does not exist
Declaration
public void AddAvailableColumnsAfter(string addAfter, params ArchiveColumnInfo[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| string | addAfter | Name of column to add new columns after |
| ArchiveColumnInfo[] | columns | One or more column information data blocks |
AddAvailableColumnsBefore(string, params ArchiveColumnInfo[])
Add one or more columns to the list of available columns for this client class. Add them right before the named column, if it exists, or at the end if it does not exist
Declaration
public void AddAvailableColumnsBefore(string addBefore, params ArchiveColumnInfo[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| string | addBefore | |
| ArchiveColumnInfo[] | columns | One or more column information data blocks |
GetColumn(string)
Get a column from the available columns list, by full prefixed programmatic name
Declaration
public ArchiveColumnInfo GetColumn(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Column to get |
Returns
| Type | Description |
|---|---|
| ArchiveColumnInfo | Column information, or null (no exception thrown) if the column does not exist |
HasAvailableColumn(string)
Determine whether the given column (by programmatic name) is in the current available columns list
Declaration
public bool HasAvailableColumn(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Programmatic column name to check |
Returns
| Type | Description |
|---|---|
| bool | true if the name matches an available column |
RemoveAllAvailableColumns()
Remove all columns from the list of available columns for this client class
Declaration
public void RemoveAllAvailableColumns()
RemoveAvailableColumns(params string[])
Remove one or more columns from the list of available columns for this client class
Declaration
public void RemoveAvailableColumns(params string[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | columns | Names of columns to remove |
RemoveDesiredColumns(params string[])
Remove one or more columns from the list of desired columns
Declaration
public void RemoveDesiredColumns(params string[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | columns | Names of columns to remove |
SetAbsolutePrefixes(string, string)
This class is a helper that contains functionality for handling columns in an archive provider. It includes collections and methods for keeping track of available and chosen columns, determining whether any particular column is wanted, and the method that uses reflection to locate standard column declarations in client classes.
Declaration
public void SetAbsolutePrefixes(string namePrefix, string displayNamePrefix)
Parameters
| Type | Name | Description |
|---|---|---|
| string | namePrefix | |
| string | displayNamePrefix |
SetDesiredColumns(string[])
Set the desired columns, using an array of programmatic names. This will add to any currently chosen columns. Only columns that match our current list of available columns will be retained, other columns (that probably belong to other providers) will be quietly ignored. This behaviour is very much by design.
Declaration
public void SetDesiredColumns(string[] columnIds)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | columnIds | Array of programmatic column names |
SetIconHint(string)
Set the icon hint on all available columns that do not already have one; this will NOT force a column scan, so you can safely call from a base class
Declaration
public void SetIconHint(string iconHint)
Parameters
| Type | Name | Description |
|---|---|---|
| string | iconHint | Iconhint to be set on all columns that have no iconhint yet |
SetIconHint(string, params ArchiveColumnInfo[])
Set the icon hint on all available columns that do not already have one; this WILL force a column scan, so call with care from base classes
Declaration
public void SetIconHint(string iconHint, params ArchiveColumnInfo[] columnsToSet)
Parameters
| Type | Name | Description |
|---|---|---|
| string | iconHint | Iconhint to be set on all columns that have no iconhint yet |
| ArchiveColumnInfo[] | columnsToSet |
SetPrefixes(string, string)
Set the programmatic name and display name prefixes (one or both)
Declaration
public void SetPrefixes(string namePrefix, string displayNamePrefix)
Parameters
| Type | Name | Description |
|---|---|---|
| string | namePrefix | Name prefix to set, or null if no prefix is to be set |
| string | displayNamePrefix | Display name prefix to set, or null if no prefix is to be set |
ToString()
Return a string suitable for debugging
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
WantAnyColumn()
Determine whether ANY of our columns is in the desired columns list. This is a fast check, independent of the number of available or desired columns
Declaration
public bool WantAnyColumn()
Returns
| Type | Description |
|---|---|
| bool | true if at least one column has been set as desired |
WantAnyColumn(params ArchiveColumnInfo[])
Determine whether at least one of the given columns is in the list of currently desired columns
Declaration
public bool WantAnyColumn(params ArchiveColumnInfo[] columns)
Parameters
| Type | Name | Description |
|---|---|---|
| ArchiveColumnInfo[] | columns | Array of column information objects to check |
Returns
| Type | Description |
|---|---|
| bool | true if at least one of the names is in the desired column list, otherwise false |
WantAnyColumn(params string[])
Determine whether at least one of the given columns is in the list of currently desired columns
Declaration
public bool WantAnyColumn(params string[] names)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | names | Array of programmatic names to check |
Returns
| Type | Description |
|---|---|
| bool | true if at least one of the names is in the desired column list, otherwise false |