ColumnBaseOnChangeMarkRowAsChanged Property
Namespace: Firefly.Box.Data.AdvancedAssembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
public bool OnChangeMarkRowAsChanged { get; set; }
Public Property OnChangeMarkRowAsChanged As Boolean
Get
Set
member OnChangeMarkRowAsChanged : bool with get, set
Property Value
Boolean When set to false, a change to this column will constitute a change to the row, and will not cause a lock when the locking is set to OnUserEdit
For more information see
UIController.
RowChanged and
SavingRowThis example demonstrates the usage of RowChangedDemo
This example is based on test data. The code for the entities included in this test data can be found in the documentation of
EntityThis example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of
Formusing Firefly.Box;
using Firefly.Box.UI;
namespace TestFirefly.Box.Documentation
{
class RowChangedDemo
{
public void Run()
{
var jobs = new Pubs.Jobs();
jobs.InitializeWithTestData();
var uic = new UIController()
{
From = jobs,
View = UITools.GenerateFormWithGridFor(
"RowChanged and SavingRow Demo",
"This example demonstrates the deferent scenarios regarding the RowChanged property.\n" +
"\nA. Initial State:\n" +
" Click the \"Check If Row Was Changed\" button and you'll see that the row was NOT changed.\n" +
"\nB. User Changed a Value:\n" +
" 1. Change the job's description.\n" +
" 2. Click the \"Check If Row Was Changed\" button and you'll see that the row was changed.\n" +
" 3. Click the \"Undo Changes In Row\" and you'll see that the change was reverted.\n" +
" 4. Click the \"Check If Row Was Changed\" button and you'll see that the row was NOT changed.\n" +
"\nC. Value Changes Done In Code:\n" +
" 1. Click the \"Add 1 to Min Level\" you'll see that the value of Min Level was changed.\n" +
" 2. Click the \"Check If Row Was Changed\" button and you'll see that the row was changed.\n" +
" 3. Click the \"Undo Changes In Row\" and you'll see that the change was reverted.\n" +
" 4. Click the \"Check If Row Was Changed\" button and you'll see that the row was NOT changed.\n" +
"\nD. Changes to a column set to \"OnChangeMarkRowAsChanged = false\".\n"+
" A change to a value of such a column, doesn't set the RowChanged property.\n" +
" 1. Change the job's Max Level Value.\n" +
" 2. Click the \"Check If Row Was Changed\" button and you'll see that the row was NOT changed.\n" +
" 3. Leave the row and reenter it, you'll see that the value of max level, returned to it's original one.\n" +
" Because the RowChanged property was not set, the SavingRow event didn't happen, and the\n" +
" changes were not saved to the database.\n" +
" 4. Click the \"Add 1 to Max Level\" you'll see that the value of Max Level was changed.\n" +
" 5. Click the \"Check If Row Was Changed\" button and you'll see that the row was NOT changed.\n" +
"\nE. Setting a value using the \"SilentSet\" method:\n" +
" 1. Click the \"Add 1 to Min Level Without Marking Row As Changed\".\n" +
" 2. Click the \"Check If Row Was Changed\" button and you'll see that the row was NOT changed.\n\n"+
"Thank you for your patience. ",
jobs.Id,
jobs.Description,
jobs.MinLevel,
jobs.MaxLevel)
};
jobs.MaxLevel.OnChangeMarkRowAsChanged = false;
var btnSetMinLevel = new Button
{
Text = "Add 1 to Min Level",
Width = 150
};
btnSetMinLevel.Click += (a, b) => jobs.MinLevel.Value++;
var btnSetMinLevelWithoutMarkingRowAsChanged = new Button
{
Text =
"Add 1 to Min Level Without Marking Row As Changed",
Width = 305
};
// btnSetMinLevelWithoutMarkingRowAsChanged.Click +=
// (a, b) => jobs.MinLevel.SilentSet(jobs.MinLevel + 1);
var btnSetMaxLevel = new Button
{
Text = "Add 1 To Max Level",
Width = 150
};
btnSetMaxLevel.Click += (a, b) => jobs.MaxLevel.Value++;
var btnCheckRowChanged = new Button
{
Text = "Check If Row Was Changed",
Width = 150
};
btnCheckRowChanged.Click += (a, b) =>
System.Windows.Forms.MessageBox.Show("Row was " +
(uic.RowChanged ? "Changed" : "NOT Changed"));
var btnUndoChangesInRow = new Button
{
Text = "Undo Changes In Row",
Width = 150
};
btnUndoChangesInRow.Click += (a, b) => uic.Raise(Command.UndoChangesInRow);
uic.SavingRow += ( b) => System.Windows.Forms.MessageBox.Show("Changes are being saved to the database");
UITools.AddControlsToForm(uic.View, btnCheckRowChanged, btnUndoChangesInRow);
UITools.AddControlsToForm(uic.View, btnSetMinLevel, btnSetMaxLevel);
UITools.AddControlsToForm(uic.View, btnSetMinLevelWithoutMarkingRowAsChanged);
uic.Run();
}
}
}