[This is preliminary documentation and is subject to change.]

Occurs when A Row is left, and before it is saved to the database.

Namespace:  Firefly.Box
Assembly:  Firefly.Box (in Firefly.Box.dll) Version: 3.4.23.6473 (3.4.23.6473)

Syntax

C#
public event Action LeaveRow
Visual Basic (Declaration)
Public Event LeaveRow As Action
Visual C++
public:
 event Action^ LeaveRow {
	void add (Action^ value);
	void remove (Action^ value);
}

Remarks

See the Run()()() method for the complete event flow.

Examples

The event flow of a BusinessProcess
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
CopyC#
using 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 BusinessProcessEventFlow
    {
        [Test]
        public void Demo()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();

            var bp = new BusinessProcess
                         {
                             From = jobs
                         };
            bp.Where.Add(jobs.Id.IsLessOrEqualTo(5));

            string result = "";
            bp.Load += () => result += "Load\n";
            bp.Start += () => result += "Start\n";
            bp.EnterRow += () => result += "EnterRow for job #" + jobs.Id + "\n";
            bp.LeaveRow += () =>
                {
                    result += "LeaveRow for job #" + jobs.Id + "\n";
                    if (jobs.Id==3)
                    {
                        bp.RowChanged.ShouldBe(false);
                        jobs.Description.Value += "xx";//to demonstrate a changed row
                        bp.RowChanged.ShouldBe(true);
                    }
                };
            bp.SavingRow += cancelEventArgs => result += "SavingRow for job #" + jobs.Id + "\n";
            bp.End += () => result += "End\n";
            bp.Run();
            result.ShouldBe("Load\n" +
                            "Start\n" +
                            "EnterRow for job # 1\n" +
                            "LeaveRow for job # 1\n" +
                            "EnterRow for job # 2\n" +
                            "LeaveRow for job # 2\n" +
                            "EnterRow for job # 3\n" +
                            "LeaveRow for job # 3\n" +
                            "SavingRow for job # 3\n" +//Because the row was changed
                            "EnterRow for job # 4\n" +
                            "LeaveRow for job # 4\n" +
                            "EnterRow for job # 5\n" +
                            "LeaveRow for job # 5\n" +
                            "End\n"
                            );


        }
    }
}

See Also