Class ActivityStatusHelper
This class implements the logic behind the "toggle completed" checkboxes for activities. The public entrypoint ToggleCompleted will toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately.
Inherited Members
Namespace: SuperOffice.CRM
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public static class ActivityStatusHelper
Methods
ExtractKeyAndValue(string, out string, out int)
This class implements the logic behind the "toggle completed" checkboxes for activities. The public entrypoint ToggleCompleted will toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately.
Declaration
public static void ExtractKeyAndValue(string keyAndValue, out string key, out int value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyAndValue | |
| string | key | |
| int | value |
SetCompletedAsync(string, ActivityStatus, CancellationToken)
Sets the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately. If an invalid id is passed in (nonexistent record), no changes will be made. If there is no write access to the record being changed, a Sentry exception will be thrown in the usual manner.
Declaration
public static Task SetCompletedAsync(string keyAndValue, ActivityStatus activityStatus, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyAndValue | Activity identifier, in the form <key>=<value>, where the key is one of sale_id, appointment_id or document_id; and the value is an integer primary key. |
| ActivityStatus | activityStatus | The status to apply. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if an unknown key string is passed in. |
| SoSentryException | Thrown if you do not have WRITE access to the record you're trying to update |
SetCompletedAsync(string, int, ActivityStatus, CancellationToken)
Sets the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately. If an invalid id is passed in (nonexistent record), no changes will be made. If there is no write access to the record being changed, a Sentry exception will be thrown in the usual manner.
Declaration
public static Task SetCompletedAsync(string keyName, int id, ActivityStatus activityStatus, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyName | One of appointment_id, sale_id or document_id |
| int | id | Integer primary key of record to toggle |
| ActivityStatus | activityStatus | The status to apply |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if an unknown key string is passed in. |
| SoSentryException | Thrown if you do not have WRITE access to the record you're trying to update |
ToggleActivityAsync(string, bool, CancellationToken)
This class implements the logic behind the "toggle completed" checkboxes for activities. The public entrypoint ToggleCompleted will toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately.
Declaration
public static Task<(ActivityStatus, bool)> ToggleActivityAsync(string activityIdentifier, bool canSetComplete, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | activityIdentifier | |
| bool | canSetComplete | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<(ActivityStatus, bool)> |
ToggleCompletedAsync(string, bool, CancellationToken)
Toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately. If an invalid id is passed in (nonexistent record), no changes will be made and the value NotStarted will be returned. If there is no write access to the record being changed, a Sentry exception will be thrown in the usual manner.
Declaration
public static Task<ActivityStatus> ToggleCompletedAsync(string keyAndValue, bool canSetComplete, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyAndValue | Activity identifier, in the form <key>=<value>, where the key is one of sale_id, appointment_id or document_id; and the value is an integer primary key. |
| bool | canSetComplete | Specifies whether or not we should check if the activity you want to toggle triggers a suggestion. If the activity triggers a suggestion, and the toggle action is from an un-complete to a complete state, this action is not executed. If you are unsure what value this parameter should have, use the ToggleCompleted method without this parameter. The default value is true. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ActivityStatus> | The new status |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if an unknown key string is passed in. |
| SoSentryException | Thrown if you do not have WRITE access to the record you're trying to update |
ToggleCompletedAsync(string, int, bool, CancellationToken)
Toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately. If an invalid id is passed in (nonexistent record), no changes will be made and the value NotStarted will be returned. If there is no write access to the record being changed, a Sentry exception will be thrown in the usual manner.
Declaration
public static Task<ActivityStatus> ToggleCompletedAsync(string keyName, int id, bool canSetComplete, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyName | One of appointment_id, sale_id or document_id |
| int | id | Integer primary key of record to toggle |
| bool | canSetComplete | Specifies whether or not we should check if the activity you want to toggle triggers a suggestion. If the activity triggers a suggestion, and the toggle action is from an un-complete to a complete state, this action is not executed. If you are unsure what value this parameter should have, use the ToggleCompleted method without this parameter. The default value is true. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ActivityStatus> | New status |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if an unknown key string is passed in. |
| SoSentryException | Thrown if you do not have WRITE access to the record you're trying to update |
ToggleCompletedAsync(string, int, CancellationToken)
Toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately. If an invalid id is passed in (nonexistent record), no changes will be made and the value NotStarted will be returned. If there is no write access to the record being changed, a Sentry exception will be thrown in the usual manner.
Declaration
public static Task<ActivityStatus> ToggleCompletedAsync(string keyName, int id, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyName | One of appointment_id, sale_id or document_id |
| int | id | Integer primary key of record to toggle |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ActivityStatus> | New status |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if an unknown key string is passed in. |
| SoSentryException | Thrown if you do not have WRITE access to the record you're trying to update |
ToggleCompletedAsync(string, CancellationToken)
Toggle the completed status for an activity, i.e., a document, appointment or sale. Appointments may have three state logic enabled through a preference. The changes are saved immediately. If an invalid id is passed in (nonexistent record), no changes will be made and the value NotStarted will be returned. If there is no write access to the record being changed, a Sentry exception will be thrown in the usual manner.
Declaration
public static Task<ActivityStatus> ToggleCompletedAsync(string keyAndValue, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyAndValue | Activity identifier, in the form <key>=<value>, where the key is one of sale_id, appointment_id or document_id; and the value is an integer primary key. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ActivityStatus> | New status |
Exceptions
| Type | Condition |
|---|---|
| SoIllegalOperationException | Thrown if an unknown key string is passed in. |
| SoSentryException | Thrown if you do not have WRITE access to the record you're trying to update |