BusinessProcessRowChanged Property

Indicates if the current row has changed.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public bool RowChanged { get; }

Property Value

Boolean

Remarks

This property indicates whether the current row has changed. In case it has, it will be save to the database on the SavingRow event.
  • Will Return "True" when the row has changed
  • Causes SavingRow event when leaving the row
  • RowChanged property becomes insignificant if OnChangeMarkRowAsChanged is set to "False"

Example

The following example show the iterations between RowChanged property and OnChangeMarkRowAsChanged
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
C#
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 RowChangedProperty
    {
        [Test]
        public void ChangedRowProperySetToTrue()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();
            var savingRowHappened = false;
            var bp = new BusinessProcess { From = jobs };
            bp.SavingRow += args => savingRowHappened = true;
            bp.ForFirstRow(() =>
            {
                bp.RowChanged.ShouldBe(false);
                jobs.Description.Value = "";
                bp.RowChanged.ShouldBe(true);
            });

            savingRowHappened.ShouldBe(true);
        }

        [Test]
        public void SetOnChangeMarkRowAsChanged()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();
            var savingRowHappened = false;
            var bp = new BusinessProcess { From = jobs };
            bp.SavingRow += args => savingRowHappened = true;
            jobs.Description.OnChangeMarkRowAsChanged = false;

            bp.ForFirstRow(() =>
            {
                bp.RowChanged.ShouldBe(false);
                jobs.Description.Value = "";
                bp.RowChanged.ShouldBe(false);
            });


            savingRowHappened.ShouldBe(false);
        }
    }
}

See Also