UIControllerDeleteRowAfterLeavingItIf Method

Sets an expression that determines if the current row will be deleted once left.


Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public void DeleteRowAfterLeavingItIf(
	Func<bool> condition


condition  FuncBoolean


Notice that when the expression evaluates to true, the SavingRow event will execute a second time (the first one was when the row was left), this time with Delete Activity property


This example demonstrates the usage of DeleteRowAfterLeavingIt
This example is in the form of Unit Tests. It references the NUnit framework. This framework can be downloaded from www.NUnit.org. For more information about unit testing visit: www.NUnit.org.
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Firefly.Box;
using Firefly.Box.Testing;

namespace TestFirefly.Box.Documentation
    public class DeleteRowAfterLeavingIt
        public void Demo()
            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
            bp.DeleteRowAfterLeavingItIf(() => employees.MiddleInitial == "");// Settings the Delete row condition

            int numberOfLeaveRowInUpdateActivity = 0;
            int numberOfLeaveRowInDeleteActivity = 0;
            int numberOfLeaveRowExecutions = 0;
            bp.LeaveRow += ()=>
                                   if (bp.Activity == Activities.Update)//Counting executions for update activity
                                   if (bp.Activity == Activities.Delete)//Counting executions for Delete activity
            numberOfLeaveRowInUpdateActivity.ShouldBe(43);//The leave row was executed once for each employee in update mode
            numberOfLeaveRowInDeleteActivity.ShouldBe(10);//The leave row was executed again for the 10 employees that matches the condition
            numberOfLeaveRowExecutions.ShouldBe(53);//The leave row was executed a total of 53 times.

See Also