Refinement of the model

For imposing restrictions on the list of employees needs to be clarified class diagram: introduced an enum type Должность and attribute Должность in class Сотрудник.

You also need to change ideas СотрудникL and СотрудникE to attribute Должность hit them. Then re-generate the objects and to align the database.

The imposition of restrictions on LookUp

In the terminology Flexberry button that causes a list of choices, is called lucapa (LookUp).

Purpose: to restrict the list of employees to select the employee who filled the order. In the list of employees there are employees with different positions. On the edit form of the order by clicking on lookup need to withdraw only managers (to avoid incorrect input from the user system).

In order to specify a restriction is necessary:

1.Go to the web page ZakazE.aspx where to find the control MasterEditorAjaxLookUp and remember it ID (in this case ctrlМенеджер).

2.Go to server-side code of the web page ZakazE.aspx.cs and change the parameter value flexberryautogenerated on false, otherwise at the next generation of the source code, your changes will be lost.

3.Add the following lines (to select options uses Ctrl-Space):

using ICSSoft.STORMNET.FunctionalLanguage;
using ICSSoft.STORMNET.FunctionalLanguage.SQLWhere;

4.To change the method PreApplyToControls() file ZakazE.aspx.cs as follows:

protected override void PreApplyToControls()
	Function lf = FunctionBuilder.BuildEquals<Сотрудник>(x => x.Должность), Должность.Менеджер);	

	ctrlМенеджер.LimitFunction = lf;

Method PreApplyToControls() called prior distribution of the object data to controls page. At the time of calling this method the object is already deducted from the database (or when PostBack'e values are already stored in the object), you can perform some additional manipulation of the object before its value gets to the page. In the code of this method is formed by special design LimitFunction which allows you to impose restrictions.

5.PstrfSolution` to recompile, start the app and confirm the changes (by clicking on the button opens a list of lucapa, in which only managers).