Class EntityManagementFunctions
Move, merge and copy contact, person and project; as well as replay such events on behalf of travel
Inherited Members
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.dll
Syntax
public static class EntityManagementFunctions
Remarks
The public Copy and Merge methods are the outside entrypoints, as well as the generic PerformOperationFromLog.
Operations are not logged to traveltransactionlog, but instead to mergemovelog, from where they can be replayed. Note that move/merge are not supported on child databases, only on central (once you got out of sync with crossing operations, there would be no way back).
Methods
CopyContact(Int32, String, String, Boolean)
Copy a contact. Activities and related data will be ignored
Declaration
public static int CopyContact(int sourceContactId, string destinationContactName, string destinationContactDepartment, bool copyPersons)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceContactId | |
String | destinationContactName | The name of the destination contact |
String | destinationContactDepartment | |
Boolean | copyPersons | If true, persons will be copied from source contact |
Returns
Type | Description |
---|---|
Int32 | Id of copied contact |
DisconnectPersonNoSave(Person, DateTime, Boolean)
Disconnect a person from its contact
Declaration
public static void DisconnectPersonNoSave(Person person, DateTime moveAfterDate, bool logOperation = true)
Parameters
Type | Name | Description |
---|---|---|
Person | person | A person entity with update rights, without ERP links |
DateTime | moveAfterDate | Only move activites after this date |
Boolean | logOperation |
MergeContacts(Int32, Int32, Boolean, Boolean, Boolean)
Merge two contacts. The destination contact will remain.
Declaration
public static void MergeContacts(int sourceContactId, int destinationContactId, bool mergeIdenticalPersons, bool replaceEmptyFieldsOnDestination, bool logOperation)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceContactId | Source contact to merge from |
Int32 | destinationContactId | Destination contact to merge into |
Boolean | mergeIdenticalPersons | Persons with identical names will be merged |
Boolean | replaceEmptyFieldsOnDestination | |
Boolean | logOperation |
MergePersons(Int32, Int32, DateTime, Boolean, Boolean, Boolean)
Merge two persons
Declaration
public static void MergePersons(int sourcePersonId, int destinationPersonId, DateTime moveAfterDate, bool deleteSource, bool replaceEmptyFieldsOnDestination, bool logOperation)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourcePersonId | |
Int32 | destinationPersonId | |
DateTime | moveAfterDate | Only move activities after this date |
Boolean | deleteSource | If true the source will be deleted instead of retired and activities before moveAfterDate will have their personId set to 0 |
Boolean | replaceEmptyFieldsOnDestination | |
Boolean | logOperation |
MergeProjects(Int32, Int32, Boolean, Boolean)
Merge two projects
Declaration
public static void MergeProjects(int sourceProjectId, int destinationProjectId, bool replaceEmptyFieldsOnDestination, bool logOperation)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceProjectId | |
Int32 | destinationProjectId | |
Boolean | replaceEmptyFieldsOnDestination | Fill in empty fields on destination from source |
Boolean | logOperation |
MovePerson(Int32, Int32, DateTime, Boolean)
Move a person to a specified contact
Declaration
public static void MovePerson(int personId, int destinationContactId, DateTime moveAfterDate, bool logOperation)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | |
Int32 | destinationContactId | |
DateTime | moveAfterDate | Only move activites after this date |
Boolean | logOperation |
PerformOperationFromLog(Int32)
Perform a move/merge operation from a MergeMoveLog entry Used for merging from a travel database
Declaration
public static void PerformOperationFromLog(int logId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | logId | The id of the log entry containing the move/merge operation |
UpdateConsentPersonForMerge(Int32, Int32, Boolean, Action<String>)
Declaration
public static void UpdateConsentPersonForMerge(int sourcePersonId, int destinationPersonId, bool deleteSource, Action<string> markAsManuallyHandled)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourcePersonId | |
Int32 | destinationPersonId | |
Boolean | deleteSource | |
Action<String> | markAsManuallyHandled |