NotificationSended: TriState;
NotificationSended: Prognoz.Platform.Interop.ForeSystem.TriState
The NotificationSended property returns whether electronic message is sent after task execution.
Available values of the property:
Undefined. Default value. The status is available unless notification sending is not set up.
On. After executing the task electronic message is sent.
Off. After executing the task electronic message is not sent.
Executing the example requires a scheduled tasks container with the TASK_CONTAINER identifier and a task used to calculate regular report.
Add links to the Metabase, Fore system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Tasks: IMetabaseObjectDescriptors;
Task: IScheduledTask;
Results: IScheduledTaskResults;
Result: IScheduledTaskResult;
res, i: Integer;
Begin
MB := MetabaseClass.Active;
Cont := MB.ItemById("TASK_CONTAINTER").Bind As IScheduledTasksContainer;
Tasks := Cont.Tasks;
Task := Tasks.Item(0).Bind As IScheduledTask;
Results := Task.GetResults;
For i := 0 To Results.Count - 1 Do
Result := Results.Item(i);
Debug.Write(Result.StartDateTime.ToString + " | ");
Debug.Write(Result.FinishDateTime.ToString + " | ");
If Result.Succeeded Then
Debug.WriteLine("Successfully completed");
Else Debug.WriteLine("Completed with error");
End If;
Select Case Result.NotificationSent
Case TriState.OffOption:
Debug.WriteLine("Electronic message is not sent");
Case TriState.OnOption:
Debug.WriteLine("Electronic message is sent");
Case TriState.Undefined:
Debug.WriteLine("Results of task execution are reset to default");
End Select;
End For;
End Sub UserProc;
After executing the example the history of the executing of first task in the scheduled tasks container is displayed in the development environment console. Date and time of the start and completion of task execution, result of execution, and also information about whether electronic message is sent or not, are displayed.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Tasks: IMetabaseObjectDescriptors;
Task: IScheduledTask;
Results: IScheduledTaskResults;
Result: IScheduledTaskResult;
res, i: integer;
Begin
MB := Params.Metabase;
Cont := MB.ItemById["TASK_CONTAINTER"].Bind() As IScheduledTasksContainer;
Tasks := Cont.Tasks;
Task := Tasks.Item[0].Bind() As IScheduledTask;
Results := Task.GetResults();
For i := 0 To Results.Count - 1 Do
Result := Results.Item[i];
System.Diagnostics.Debug.Write(Result.StartDateTime.ToString() + " | ");
System.Diagnostics.Debug.Write(Result.FinishDateTime.ToString() + " | ");
If Result.Succeeded Then
System.Diagnostics.Debug.WriteLine("Successfully completed");
Else System.Diagnostics.Debug.WriteLine("Completed with error");
End If;
Select Case Result.NotificationSent
Case TriState.tsOffOption:
System.Diagnostics.Debug.WriteLine("Electronic message is not sent");
Case TriState.tsOnOption:
System.Diagnostics.Debug.WriteLine("Electronic message is sent");
Case TriState.tsUndefined:
System.Diagnostics.Debug.WriteLine("Results of task execution are reset to default");
End Select;
End For;
End Sub;
See also: