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

Gets or sets the value determining if the user is allowed to insert rows

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

Syntax

C#
public bool AllowInsert { get; set; }
Visual Basic (Declaration)
Public Property AllowInsert As Boolean
Visual C++
public:
property bool AllowInsert {
	bool get ();
	void set (bool value);
}

Remarks

This property controls whether the InsertActivity property is valid when the UIController is run, and if the user can use the SwitchToInsertActivityCommand.
If the AllowInsertInUpdateActivity property is set to true, the AllowInsert property controls that as well

Examples

Allow insert and insert in update activity
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
This example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of Form
CopyC#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Firefly.Box;

namespace TestFirefly.Box.Documentation
{
    class InsertInUpdate
    {
        public void Run()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();

            var uic = new UIController
            {
                From = jobs,
                AllowInsert = true,//the default
                AllowInsertInUpdateActivity = true,//the default
                View = UITools.GenerateFormWithGridFor(
                    "Insert In Update Demo",
                    "To insert a new row, click on the \"Insert Row\" button,\n or navigate to the " +
                    "last row, and then press the down key.",
                    jobs.Id,
                    jobs.Description,
                    jobs.MinLevel)
            };

            var allowInsertCB = new CheckBox()
            {
                Text = "Allow Insert",
                Checked = uic.AllowInsert,
                Width = 100
            };

            allowInsertCB.CheckedChanged +=
                (a, b) => uic.AllowInsert = allowInsertCB.Checked;

            var allowInsertInUpdateCB = new CheckBox()
            {
                Text = "Allow Insert In Update Activity",
                Checked = uic.AllowInsertInUpdateActivity,
                Width = 200
            };

            allowInsertInUpdateCB.CheckedChanged +=
                (a, b) => uic.AllowInsertInUpdateActivity = allowInsertInUpdateCB.Checked;

            var insertRowButton = new Button()
            {
                Text = "Insert Row"
            };
            insertRowButton.Click += (a, b) => uic.Raise(Command.InsertRow);

            var switchToInsert = new Button
            {
                Text = "Switch to Insert Activity",
                Width = 150
            };
            switchToInsert.Click += (a, b) => uic.Raise(Command.SwitchToInsertActivity);

            var switchToUpdate = new Button
            {
                Text = "Switch To Update Activity",
                Width = 150
            };
            switchToUpdate.Click += (a, b) => uic.Raise(Command.SwitchToUpdateActivity);

            UITools.AddControlsToForm(uic.View, allowInsertCB, allowInsertInUpdateCB);
            UITools.AddControlsToForm(uic.View, insertRowButton,switchToInsert,switchToUpdate);

            uic.Run();
        }
    }
}

Examples

Deferent Activities
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
This example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of Form
CopyC#
using Firefly.Box;
using Firefly.Box.UI;

namespace TestFirefly.Box.Documentation
{
    public class DemoSwitchActivities
    {
        public void Run()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();

            var uic = new UIController
            {
                From = jobs,
                AllowBrowse = true,//the default
                AllowDelete = true,//the default
                AllowInsert = true,//the default
                AllowUpdate = true,//the default

                View = UITools.GenerateFormWithGridFor("Jobs and activities",
                                                       "Press the buttons below to switch between the deferent activities, notice that the title displays the current activity",
                                                       jobs.Columns.ToArray())
            };
            //Set the form title according to the activity
            uic.ActivityChanged += () => uic.View.Text = "The Activity is " + uic.Activity.ToString();

            var switchToInsert = new Button
            {
                Text = "Switch To Insert",
                Width = 100
            };
            switchToInsert.Click += (a, b) => uic.Raise(Command.SwitchToInsertActivity);

            var switchToBrowse = new Button
            {
                Text = "Switch To Browse",
                Width = 100
            };
            switchToBrowse.Click += (a, b) => uic.Raise(Command.SwitchToBrowseActivity);

            var switchToUpdate = new Button
            {
                Text = "Switch To Update",
                Width = 100
            };
            switchToUpdate.Click += (a, b) => uic.Raise(Command.SwitchToUpdateActivity);

            var insertRow = new Button { Text = "Insert Row" };
            insertRow.Click += (a, b) => uic.Raise(Command.InsertRow);

            var deleteRow = new Button { Text = "Delete Row" };
            deleteRow.Click += (a, b) => uic.Raise(Command.DeleteRow);

            UITools.AddControlsToForm(uic.View, switchToInsert, switchToBrowse, switchToUpdate, insertRow, deleteRow);

            uic.Run();
        }
    }
}

See Also