Class Selection
Selection tab
Entity Object for table 'selection'. Entity objects represent full entities with both the base table object and all related objects, such as visiblefor, and things like owner associate and whatever else is logically related to the base object.Inherited Members
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.dll
Syntax
public class Selection : EntityBase, INestedPersist, ISoItem, ITableRowLoadHandler
Remarks
Entity objects can be created in several ways.
- Use the static CreateNew() method to create a new, empty object. After populating it with values,
you call the
method and corresponding row(s) in the database are created, and the objects' primary key field updated. This is the preferred way to insert new entities into the database. - You can create a (nested) Selection Selection.CustomSearch object to obtain a query pre-populated with the correct tableinfo and return fields. This query can be modified with restrictions, etc. Then, use the static GetFromCustomSearch(Selection.CustomSearch) method to apply the query to the database and obtain the result as an Entity object. This is how you select existing entities from the database when you have a query that does not correspond to any of the existing database indexes.
- For each unique index defined for the table, there is a corresponding GetFromIdx method to make retrieving data via the indexes easy.
Note that if you try to fetch a row that does not exist (for instance, by using the primary key index and specifying a primary key that does
not exist in the database), you will get a Row object with the
and properties set to true. Such an Entity object is called a 'ghost' and cannot be updated, saved or deleted. You can also get a ghost if the row does exist in the database, but the Sentry system denies Select rights to the row.
Unique indexes on Selection are:
Index fields | Nested index class name |
---|---|
SelectionId | SelectionId: Primary key Nested index class: Selection.IdxSelectionIdStatic Get method: GetFromIdxSelectionId(Int32) |
Index fields | Nested index class name |
---|---|
Name | Name: Selection name, freetext indexed Nested index class: SelectionCollection.IdxNameStatic Get method: GetFromIdxName(String) |
AssociateId | AssociateId: Can also represent other types of owner Nested index class: SelectionCollection.IdxAssociateIdStatic Get method: GetFromIdxAssociateId(Int32) |
SoundEx | SoundEx: What the name sounds like, for duplicate detection Nested index class: SelectionCollection.IdxSoundExStatic Get method: GetFromIdxSoundEx(String) |
GroupIdx | GroupIdx: Link to group Nested index class: SuperOffice.CRM.Entities.SelectionCollection.IdxGroupIdxStatic Get method: GetFromIdxGroupIdx(Int32) |
Source | Source: How did we get this selection? For future integration needs Nested index class: SelectionCollection.IdxSourceStatic Get method: GetFromIdxSource(Int16) |
Constructors
Selection(Selection.SelectionIdxBase)
Constructor for class Selection.
This object represents a row in table 'selection'.
Table contact: Selections
Declaration
protected Selection(Selection.SelectionIdxBase idx)
Parameters
Type | Name | Description |
---|---|---|
SuperOffice.CRM.Entities.Selection.SelectionIdxBase | idx | ContactRowSelectionRow.SelectionRowIdx object that the Contact encapsulates. |
Selection(SelectionRow, Selection.SelectionIdxBase)
Declaration
protected Selection(SelectionRow row, Selection.SelectionIdxBase idx)
Parameters
Type | Name | Description |
---|---|---|
SelectionRow | row | |
SuperOffice.CRM.Entities.Selection.SelectionIdxBase | idx |
Fields
_associate
Related HDB object(s).
Declaration
protected AssociateRow _associate
Field Value
Type | Description |
---|---|
AssociateRow |
_createdAssociate
Related HDB object(s).
Declaration
protected AssociateRow _createdAssociate
Field Value
Type | Description |
---|---|
AssociateRow |
_lastLoadedBy
Declaration
protected AssociateRow _lastLoadedBy
Field Value
Type | Description |
---|---|
AssociateRow |
_lastMembershipChangeBy
Declaration
protected AssociateRow _lastMembershipChangeBy
Field Value
Type | Description |
---|---|
AssociateRow |
_row
HDB object this entity is a facade for.
Declaration
protected SelectionRow _row
Field Value
Type | Description |
---|---|
SelectionRow |
_rowIdx
Declaration
protected Selection.SelectionIdxBase _rowIdx
Field Value
Type | Description |
---|---|
SuperOffice.CRM.Entities.Selection.SelectionIdxBase |
_searchCategory
Related HDB object(s).
Declaration
protected SearchCatRow _searchCategory
Field Value
Type | Description |
---|---|
SearchCatRow |
_selectionInfo
Related HDB object(s).
Declaration
protected TextRow _selectionInfo
Field Value
Type | Description |
---|---|
TextRow |
_selectionMembers
Related HDB object(s).
Declaration
protected SelectionMemberRows _selectionMembers
Field Value
Type | Description |
---|---|
SelectionMemberRows |
_selectionText
Related HDB object(s).
Declaration
protected TextRow _selectionText
Field Value
Type | Description |
---|---|
TextRow |
_updatedAssociate
Related HDB object(s).
Declaration
protected AssociateRow _updatedAssociate
Field Value
Type | Description |
---|---|
AssociateRow |
_userGroup
Related HDB object(s).
Declaration
protected UserGroupRow _userGroup
Field Value
Type | Description |
---|---|
UserGroupRow |
Properties
Associate
Related object AssociateRow: Employees, resources and other users - except for External persons
Declaration
public AssociateRow Associate { get; set; }
Property Value
Type | Description |
---|---|
AssociateRow |
CompanyUnique
Only one person from a company may be selected as a member
Declaration
public short CompanyUnique { get; set; }
Property Value
Type | Description |
---|---|
System.Int16 |
CreatedAssociate
Related object AssociateRow: Employees, resources and other users - except for External persons
Declaration
public AssociateRow CreatedAssociate { get; set; }
Property Value
Type | Description |
---|---|
AssociateRow |
IncludePerson
0 = Include first person, 1 = Include all persons, 2 = Include no persons
Declaration
public int IncludePerson { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsDeleted
Is the row deleted?
Declaration
public override bool IsDeleted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsMarkedForDelete
Gets or sets a value indicating whether this instance is marked for delete.
Declaration
public override bool IsMarkedForDelete { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
IsNew
Is the row new, e.g. not been inserted to the database?
Declaration
public override bool IsNew { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
LastLoadedBy
Declaration
public AssociateRow LastLoadedBy { get; set; }
Property Value
Type | Description |
---|---|
AssociateRow |
LastMembershipChangeBy
Declaration
public AssociateRow LastMembershipChangeBy { get; set; }
Property Value
Type | Description |
---|---|
AssociateRow |
MainRow
Return the main row for the Entity.
Declaration
protected override TableRowBase MainRow { get; }
Property Value
Type | Description |
---|---|
TableRowBase |
Overrides
MemberCount
How many selectionmembers (for progress bar)
Declaration
public uint MemberCount { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Name
Name, freetext indexed
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Registered
Registered when
Declaration
public DateTime Registered { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime |
Row
The encapsulated object SelectionRow.
Declaration
public SelectionRow Row { get; }
Property Value
Type | Description |
---|---|
SelectionRow |
SearchCategory
Related object SearchCatRow: SearchCat list table
Declaration
public SearchCatRow SearchCategory { get; set; }
Property Value
Type | Description |
---|---|
SearchCatRow |
SelectionId
Declaration
public int SelectionId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectionInfo
Related object TextRow: Long text fields from all over the system
Declaration
public TextRow SelectionInfo { get; set; }
Property Value
Type | Description |
---|---|
TextRow |
SelectionMembers
Related object SelectionMemberRows: Selection members
Declaration
public SelectionMemberRows SelectionMembers { get; }
Property Value
Type | Description |
---|---|
SelectionMemberRows |
SelectionText
Related object TextRow: Long text fields from all over the system
Declaration
public TextRow SelectionText { get; set; }
Property Value
Type | Description |
---|---|
TextRow |
Seltype
0 = static selection, 1 = dynamic selection, 2 = combined selection
Declaration
public short Seltype { get; set; }
Property Value
Type | Description |
---|---|
System.Int16 |
SoundEx
What the name sounds like, for duplicate detection
Declaration
public string SoundEx { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Source
How did we get this selection? For future integration needs
Declaration
public short Source { get; set; }
Property Value
Type | Description |
---|---|
System.Int16 |
SystemType
0 = managed by user, 1 = temporary static, 2 = personal dynamic for Find
Declaration
public SelectionSystemType SystemType { get; set; }
Property Value
Type | Description |
---|---|
SelectionSystemType |
TableInfo
Get a TableInfo object for the selection table.
Declaration
public SelectionTableInfo TableInfo { get; }
Property Value
Type | Description |
---|---|
SelectionTableInfo |
Updated
Last updated when
Declaration
public DateTime Updated { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime |
UpdatedAssociate
Related object AssociateRow: Employees, resources and other users - except for External persons
Declaration
public AssociateRow UpdatedAssociate { get; set; }
Property Value
Type | Description |
---|---|
AssociateRow |
UpdatedCount
Declaration
public short UpdatedCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int16 |
UserGroup
Related object UserGroupRow: Secondary user groups
Declaration
public UserGroupRow UserGroup { get; set; }
Property Value
Type | Description |
---|---|
UserGroupRow |
Visibility
OBSOLETE - now uses the VisibleFor table
Declaration
public short Visibility { get; set; }
Property Value
Type | Description |
---|---|
System.Int16 |
VisibleForHelper
Get the helper class for working with the visible-for of the entity.
Declaration
public EntityVisibleForHelper VisibleForHelper { get; }
Property Value
Type | Description |
---|---|
EntityVisibleForHelper |
Methods
CreateNew()
Create a new instance of the Selection entity.
Declaration
public static Selection CreateNew()
Returns
Type | Description |
---|---|
Selection | A new instance of the Selection entity. |
CreateNew(Selection.SelectionIdxBase)
Create a new instance of the Selection entity, by reading from the database using the specified index (represented by a nested index class).
Declaration
public static Selection CreateNew(Selection.SelectionIdxBase idx)
Parameters
Type | Name | Description |
---|---|---|
SuperOffice.CRM.Entities.Selection.SelectionIdxBase | idx | Index search, represented by a subclass if the SuperOffice.CRM.Entities.Selection.SelectionIdxBase nested index class |
Returns
Type | Description |
---|---|
Selection | A new instance of the Selection entity. |
Delete()
Delete the row.
Declaration
public override void Delete()
Overrides
ForceEntityUpdate()
Force Updated and UpdatedAssociate to be updated with current time and Currently logged in associate. This will again be overridden in the Database update operation by a query processor.
Declaration
protected override void ForceEntityUpdate()
Overrides
FromSelectionRow(SelectionRow)
Operator asigning a Selection from a SelectionRow.
Declaration
public static Selection FromSelectionRow(SelectionRow row)
Parameters
Type | Name | Description |
---|---|---|
SelectionRow | row | SelectionRow object |
Returns
Type | Description |
---|---|
Selection | Selection Entity |
FromSelectionRow(SelectionRow, Selection.SelectionIdxBase)
Declaration
public static Selection FromSelectionRow(SelectionRow row, Selection.SelectionIdxBase idx)
Parameters
Type | Name | Description |
---|---|---|
SelectionRow | row | |
SuperOffice.CRM.Entities.Selection.SelectionIdxBase | idx |
Returns
Type | Description |
---|---|
Selection |
GetAdditionalRelatedNestedPersist(List<INestedPersist>, Boolean)
Declaration
protected override void GetAdditionalRelatedNestedPersist(List<INestedPersist> relatedObjects, bool lacyFetchIfNeeded)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<INestedPersist> | relatedObjects | |
System.Boolean | lacyFetchIfNeeded |
Overrides
GetFromCustomSearch(Selection.CustomSearch)
Create a new instance of the Selection object, and populate it with data from a custom search. If the search returns no results, an empty entity will be returned; if the result contains rows, one Selection object representing the first row will be returned. Any further rows in the result will be ignored.
Declaration
public static Selection GetFromCustomSearch(Selection.CustomSearch query)
Parameters
Type | Name | Description |
---|---|---|
Selection.CustomSearch | query | The custom search to execute against the database |
Returns
Type | Description |
---|---|
Selection | A new instance of the Selection object, reflecting the result of the query. |
GetFromIdxSelectionId(Int32)
Create a new instance of the Selection object, by querying the database table via the index 'IDXSelId'. This method is intended to make it easy to use efficient queries that match a database index.
Declaration
public static Selection GetFromIdxSelectionId(int selectionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | selectionId | Primary key |
Returns
Type | Description |
---|---|
Selection | Row object that represents the result of the search. IsNew will be true if the query did not match any row in the table |
Remarks
This method represents one of the unique indexes on the Selection table. Non-unique indexes have corresponding inner classes and methods in the SelectionCollection collection, since they may return more than one row.
GetRelatedNestedPersist(List<INestedPersist>, Boolean)
Append all the related objects to a list of INestedPersist.
Declaration
protected override void GetRelatedNestedPersist(List<INestedPersist> relatedObjects, bool lacyFetchIfNeeded)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<INestedPersist> | relatedObjects | List to append related objects to. |
System.Boolean | lacyFetchIfNeeded |
Overrides
OnIdUpdate()
Update related objects with correct id's to make sure that relations are consistent before saving to the database.
Declaration
protected override void OnIdUpdate()
Overrides
OnPostSaveMe()
Handle actions needed to be taken after this object has been saved, but before saving objects depending upon this one.
Declaration
protected virtual void OnPostSaveMe()
OnPreIdUpdate()
Allow for "fake id's" to be forced upon related objects.
Declaration
protected override void OnPreIdUpdate()
Overrides
Remarks
In order to figure out which objects taking part of the nested save operation that actually needs to be saved, this method allows for "fake id's" to be forced upon related objects. Upon receiving the "fake id", the objects receiving such an id can determine if they needs to be persisted (e.g. saved) to the database. However, the fake id's forced upon related objects must be set to correct id's in the OnIdUpdate method taking place later in the save operation.
OnPreSaveMe()
Handle actions needed to be taken after objects this object depends on have been saved, but before this object is saved.
Declaration
protected virtual void OnPreSaveMe()
OnRowLoad(SoDataReader, TableRowBase)
Event raised when the row is loaded from the database
Declaration
protected override void OnRowLoad(SoDataReader reader, TableRowBase row)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | reader | |
TableRowBase | row |
Overrides
OnRowLoaded()
Declaration
protected override void OnRowLoaded()
Overrides
SetDefaults()
Set default values for the entity.
Declaration
public void SetDefaults()
SetDefaults(DefaulterStrategy)
Set default values for the entity.
Declaration
public void SetDefaults(DefaulterStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
DefaulterStrategy | strategy | Strategy used when appliying default values. |
Validate()
Check the entity and related objects for consistency and required fields, and return fields and error messages.
Declaration
public override Dictionary<string, string> Validate()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | Field names and error messages |
Overrides
Operators
Explicit(SelectionRow to Selection)
Operator assigning a Selection from a SelectionRow.
Declaration
public static explicit operator Selection(SelectionRow row)
Parameters
Type | Name | Description |
---|---|---|
SelectionRow | row | SelectionRow object |
Returns
Type | Description |
---|---|
Selection | Selection Entity |