Class SelectionContactPersonExtender
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Inheritance
Implements
Inherited Members
Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.dll
Syntax
public class SelectionContactPersonExtender : ContactPersonAsEntityExtenderBase, IArchiveProviderQueryMapping, IArchiveExtender, IArchiveProviderDoesExtend, IArchiveProviderHasColumns, IArchiveProviderExtensible
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
Constructors
SelectionContactPersonExtender()
Default constructor, requesting the SelectionPerson set of features
Declaration
public SelectionContactPersonExtender()
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
SelectionContactPersonExtender(Features)
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Declaration
public SelectionContactPersonExtender(PersonExtenderBase.Features features)
Parameters
Type | Name | Description |
---|---|---|
PersonExtenderBase.Features | features |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
SelectionContactPersonExtender(string)
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Declaration
public SelectionContactPersonExtender(string context)
Parameters
Type | Name | Description |
---|---|---|
string | context |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
Fields
ColumnIncludePersonRestriction
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Declaration
public const string ColumnIncludePersonRestriction = "includePersonRestriction"
Field Value
Type | Description |
---|---|
string |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
ColumnIncludePersonWithNoDM
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Declaration
public const string ColumnIncludePersonWithNoDM = "includePersonWithNoDMRestriction"
Field Value
Type | Description |
---|---|
string |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
_colIncludePerson
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Declaration
protected ArchiveColumnInfo _colIncludePerson
Field Value
Type | Description |
---|---|
ArchiveColumnInfo |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
_colIncludePersonWithNoDM
The SelectionContactPersonExtender extends a contact with persons, if at least one person-related condition has been set (this happens in the ContactPersonAsEntityExtenderBase base class, and requests the PersonExtenderBase.SelectionPerson set of features from the PersonExtenderBase.
Declaration
protected ArchiveColumnInfo _colIncludePersonWithNoDM
Field Value
Type | Description |
---|---|
ArchiveColumnInfo |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
Properties
HasGenuinePersonRestrictions
Did the restrictions contain any clause that applied to the person part of the query (incluincludePersonRestriction and includePersonWithNoDMRestriction do not count as there are merely modifiers)
Declaration
public bool HasGenuinePersonRestrictions { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
IncludePerson
What has the includePersonRestriction been set to?
Declaration
public SelectionContactPersonExtender.IncludePersonType IncludePerson { get; }
Property Value
Type | Description |
---|---|
SelectionContactPersonExtender.IncludePersonType |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
NeedComplexPrimaryKey
Does the contact+person query need a complex (both contact AND person) key? This is true in one special, but useful, case: A search purely on contact criteria, but with the ALL option on persons. Then, we cannot either EITHER contactId OR personID, but have to use both in combination.
Declaration
public bool NeedComplexPrimaryKey { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
SwitchEntity
Specify that entity should be person unless IncludeFirstPerson is set
Declaration
protected override bool SwitchEntity { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
SwitchNavigation
Specify that navigation should be person level
Declaration
protected override bool SwitchNavigation { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
Methods
InnerPopulateRowFromReader(SoDataReader, ArchiveRow)
Override: Add a link hint to tell outsiders whether "genuine" person criteria were found (this triggers various behaviours, such as rowtype name)
Declaration
protected override void InnerPopulateRowFromReader(SoDataReader reader, ArchiveRow row)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | reader | |
ArchiveRow | row |
Overrides
Remarks
This class also adds the two special kinds of processing required for a dynamic selection: a) Exclude retired persons, unless otherwise specified, and b) Include the first person, if so requested; the column includePersonRestriction is defined for that purpose here
SetJoin()
Set up the join between our person table and the parent contact. Special processing, see remarks!
Declaration
protected override PersonTableInfo SetJoin()
Returns
Type | Description |
---|---|
PersonTableInfo |
Overrides
Remarks
Dynamic person selection restrictions are a complicated puzzle. Basically, the only user-settable restrictions are on Interests, and such restrictions should cause a narrowing of the result set (exclude contact/person rows that do not match). However, the includePersonRestriction has special behaviour - it means 'keep whatever contacts you may have, but add persons if they exist'. That implies an OUTER and not an INNER join from contact to person. Further, the includeNoDM and retired restrictions should be part of the outer join, because it would otherwise collapse into an inner join inside the database. (this is standard database behaviour - if part of the WHERE clause refers to the left-hand side of a LEFT OUTER join, the join effectively becomes an INNER join, because any restriction except IS NULL is FALSE for a NULL field - and NULL's are what you get for missing left-hand side rows).
All that can be fixed via this override of SetJoin, which sets up the outer join, puts in the special restrictions, and removes them from the RestrictionHelper, thereby avoiding having them inserted later on in the query...SetRestriction(params ArchiveRestrictionInfo[])
Override to allow special dynamic selection behaviour of restrictions; in particular, handle the noMailings and Retired restrictions, which are modifiers rather than mapping directly to simple database file/operator/value.
Declaration
public override bool SetRestriction(params ArchiveRestrictionInfo[] restrictions)
Parameters
Type | Name | Description |
---|---|---|
ArchiveRestrictionInfo[] | restrictions |
Returns
Type | Description |
---|---|
bool | true if this is a person-level selection |
Overrides
Remarks
If there are any person-level restrictions, ensure that a restriction on retired (person) is present. If not, add one, set to exclude retired persons.
If the includePersonRestriction has been set to true, make this a person level query, but keep the primary key to be contact to compress away duplicate contacts generated by multiple persons. Parallel handling of contact-level modifiers can be found in SelectionDynamicContactExtender.