public sealed class BusinessProcess : ITaskPublic NotInheritable Class BusinessProcess
Implements ITask[<SealedAttribute>]
type BusinessProcess =
class
interface ITask
endusing System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;
namespace TestFirefly.Box.Documentation
{
[TestFixture]
public class DemoBusinessProcess
{
[Test]
public void IterateAllRows()
{
var employees = new Pubs.Employees();
employees.InitializeWithTestData();// Insert test data to the table
var bp = new BusinessProcess
{
From = employees,
Activity = Activities.Update // The default activity
};
int numberOfEmployeesWithoutMiddleInitials = 0;
bp.ForEachRow(() =>
{
if (employees.MiddleInitial == "")
numberOfEmployeesWithoutMiddleInitials++;
});
numberOfEmployeesWithoutMiddleInitials.ShouldBe(10);//Checks that there are 10 employees in the test data without a middle initial
}
[Test]
public void DeleteEmployeesWithJob5()
{
var employees = new Pubs.Employees();
employees.InitializeWithTestData();// Insert test data to the table
employees.CountRows().ShouldBe(43);// Verifies that the test data has 43 rows
var bp = new BusinessProcess
{
From = employees,
Activity = Activities.Delete
};
bp.Where.Add(employees.JobId.IsEqualTo(5));
bp.Run();
employees.CountRows().ShouldBe(36);// Verifies that after the delete, only 36 rows remain
}
[Test]
public void InsertAnEmployee()
{
var employees = new Pubs.Employees();
employees.InitializeWithTestData();// Insert test data to the table
employees.CountRows().ShouldBe(43); // Verifies that the test data has 43 rows
var bp = new BusinessProcess
{
From = employees,
Activity = Activities.Insert
};
bp.ForFirstRow(() =>
{
employees.Id.Value = "ID-1234";
employees.FirstName.Value = "John";
employees.LastName.Value = "Doe";
});
employees.CountRows().ShouldBe(44);// Verifies that after the insert, there are 44 rows in the test data
}
}
}| BusinessProcess | Initializes a new instance of the BusinessProcess class. |
| BusinessProcess(BusinessProcessAdvancedSettings) | Initializes a new instance of the BusinessProcess class. |
| Activity | Determines the main activity to be performed in this BusinessProcess |
| AllowUserAbort |
Gets or sets the value determining if the BusinessProcess will listen to certain inputs from the user that will cause it to terminate. |
| AutoCompute | |
| BindEntireDataviewRowBeforeWhereExpression | |
| Columns | Gets the columns that are used in this BusinessProcess |
| Counter | Returns the number of cycles started so far. |
| CurrentHandledCommand | Return the currently handled command |
| CurrentHandledControl | Return the currently handled control |
| CurrentHandledKey | Return the currently handled key combination |
| Entities | Gets entities that are associated to this BusinessProcess by the From property and Relations property |
| From | Determines the Entity who's rows the BusinessProcess will perform it's iteration on. |
| Groups | Gets the value determining the BusinessProcess's groups |
| Handlers | Gets the BusinessProcess's handlers |
| InTransaction | Gets the value determining if a transaction is currently open. |
| KeepViewVisibleAfterExit | Gets or sets the value determining if the BusinessProcess's form should remain visible after the BusinessProcess exits. |
| Module | Gets or sets the value determining the ModuleController to whom this BusinessProcess is associated |
| NonDbWhere | This Where will always be evaluated in memory and may have performance implications |
| OrderBy | Gets or sets the value determining order in which the rows are ordered |
| Relations | Get this BusinessProcess relations |
| ReloadRowBeforeGroupEnter | |
| RowChanged | Indicates if the current row has changed. |
| RowLocking | Gets or sets the value determining the BusinessProcess's row locking strategy |
| ShowView | Gets or sets the value determining if the view specified in the View property should be displayed when this BusinessProcess is executed. |
| Title | Gets or sets the BusinessProcess's title |
| TransactionScope | Gets or sets the value determining the BusinessProcess's transaction scope |
| TransactionScopeGroup | |
| TransactionType | |
| UserInterfaceRefreshInterval | sets the value determining the interval in milliseconds for the user interface refresh |
| UserInterfaceRefreshRowsInterval | |
| View | Determines the form to be displayed while this BusinessProcess is running |
| Where | Gets the value determining the filter that will be applied on the rows of this BusinessProcess. |
| AddAllColumns | Adds all the columns of the Entity determined in the From property, and all the entities specified in the Relations property to the Columns property collection. |
| BindKeepViewVisibleAfterExit | Sets an expression that will determine the value of the KeepViewVisibleAfterExit property. |
| DeleteRowAfterLeavingItIf | Sets an expression that determines if the current row will be deleted once left. |
| DeltaOf | Returns The delta between the value of expression before the EnterRow event, and the current value of expression |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Exit | Instructs the BusinessProcess to exit. |
| Exit(ExitTiming) | Instructs the BusinessProcess to exit. |
| Exit(ExitTiming, FuncBoolean) | Instructs the BusinessProcess to exit. |
| ForEachRow(Action) | Performs the specified action on each row that matches the Where property filter. |
| ForEachRow(FilterBase, Action) | Performs the specified action on each row that matches the Where property filter. |
| ForFirstRow(Action) | Performs the specified action on the first row that matches the Where property filter. |
| ForFirstRow(FilterBase, Action) | Performs the specified action on the first row that matches the Where property filter. |
| Get(FuncNumber) | |
| Get(FuncText) | |
| Get(FuncNumber, FilterBase) | |
| Get(FuncText, FilterBase) | |
| GetT(TypedColumnBaseT) | |
| GetT(TypedColumnBaseT, FilterBase) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) |
| GetType | Gets the Type of the current instance. (Inherited from Object) |
| Invoke(Action) | Invokes a action that will be handled by an Handler. |
| Invoke(CommandWithArgs) | Invokes a command that will be handled by an Handler. |
| Invoke(Command, Object) | Invokes a command that will be handled by an Handler. |
| Invoke(Keys, Object) | Invokes a keyCombination that will be handled by an Handler. |
| Invoke(String, Object) | Invokes a customCommandKey that will be handled by an Handler. |
| InvokeT(Command, ArrayColumnT) | |
| InvokeT(Keys, ArrayColumnT) | |
| InvokeT(String, ArrayColumnT) | |
| LockCurrentRow | Locks the current row for the Entity specified in the From property , and all the entities specified in the Relations property collection. |
| MarkRowAsChanged | |
| PerformCompute | |
| Raise(CommandWithArgs) | Raises a command that will be handled by an Handler. |
| Raise(Command, Object) | Raises a command that will be handled by an Handler. |
| Raise(Keys, Object) | Raises a keyCombination that will be handled by an Handler. |
| Raise(String, Object) | Raises a customCommandKey that will be handled by an Handler. |
| RaiseT(Command, ArrayColumnT) | |
| RaiseT(Keys, ArrayColumnT) | |
| RaiseT(String, ArrayColumnT) | |
| ReadAllRows | Used for quick, read-only pass over all the rows of the BusinessProcess. |
| Run | Runs the BusinessProcess |
| Sum(FuncNumber) | |
| Sum(NumberColumn) | |
| Sum(FuncNumber, FilterBase) | |
| Sum(NumberColumn, FilterBase) | |
| ToString | Returns a string that represents the current object. (Overrides ObjectToString) |
| AbortRowOccurred | |
| AfterSavingRow | |
| BeforeExit | |
| DatabaseErrorOccurred | Occurs when a database error occurs and after all the DatabaseErrorHandler processed the error. |
| End | Occurs when the BusinessProcess ends. Raised once for each Run method. Preserves the last row data. |
| EnterRow | Occurs when a row is entered by this BusinessProcess and after that row was loaded from the database. |
| LeaveRow | Occurs when A Row is left, and before it is saved to the database. |
| Load | Occurs when the BusinessProcess is executed, before the Start event and before the database query is constructed. Raised once for each Run method. |
| PreviewDatabaseError | Occurs when a database error occurs and before all the DatabaseErrorHandler process the error. |
| ProcessingCommand | |
| SavingRow | Occurs when the BusinessProcess is about to save the row |
| Start | Occurs when starts and after the Load event. Raised once for each Run method. |