Rules for the imposition of restrictions on the deducted objects

SQLWhereLanguageDef class Builder functions, the restrictions deducted on objects.

There is an extension of basic functional language SQLWhereLanguageDef, `ExternalLangDef.

Connection:

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

the Construction of function, method GetFunction

The construction of the function starts with calling the method ICSSoft.STORMNET.FunctionalLanguage.FunctionalLanguageDef.GetFucntion(string, params object[));

As the first parameter the method takes a function type (a list of available functions below). The method accepts a set of function parameters, number and types of parameters vary depending on the type of function, a detailed description thereof can be found in the article devoted to a particular type of function.

The method returns an object of type ICSSoft.STORMNET.FunctionalLanguage.Function.

Depending on the type of the function parameter of the function GetFunction can be passed a description of the variable specified in the class VariableDef.

the restrictions imposed on the enum type

[Enumerations Enumeration types) is stored in the database as strings. Accordingly, when constructing the variable description (VariableDef) you must use StringType. The argument for comparison is recommended to use Caption enumeration object, to Caption you can use class EnumCaption, which is part of ICSSoft.STORMNET.

For example:

To impose restrictions on the gender of the client, you should compile the following function:

using ICSSoft.STORMNET;
// ... 
var ld = SQLWhereLanguageDef.LanguageDef;
var onlyMenFunction = ld.GetFunction(ld.funcEQ, new VariableDef(ld.StringType, Information.ExtractPropertyPath<Клиент>(x => x.Пол)), EnumCaption.GetCaptionFor(tПол.Мужской));

the Imposition of limitations on the date components

To impose a restriction on the date part (year, month, or day), you can use the functions DayPart, MonthPart and YearPart for specifying constraints on components of the date.

Example

//ICSSoft.STORMNET.Windows.Forms.ExternalLangDef (ExternalLangDef.dll) 
//ICSSoft.STORMNET.Windows.Forms.ExternalLangDeflangdef = ExternalLangDef.LanguageDef; 
using ICSSoft.STORMNET.Windows.Forms;

var langdef = ExternalLangDef.LanguageDef;
var lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof (Кредит), Кредит.Views.КредитE);

lcs.LimitFunction = langdef.GetFunction(langdef.funcEQ,
                                         langdef.GetFunction("YearPart", new VariableDef(langdef.DateTimeType, "Datavideo")), "2013");

var only2013year = DataServiceProvider.DataService.LoadObjects(lcs);

lcs.LimitFunction = langdef.GetFunction(langdef.funcEQ,
                                         langdef.GetFunction("MonthPart", new VariableDef(langdef.DateTimeType, "Datavideo")), "12");

var onlyDecember = DataServiceProvider.DataService.LoadObjects(lcs);

lcs.LimitFunction = langdef.GetFunction(langdef.funcAND,
                langdef.GetFunction(langdef.funcEQ, 
                    langdef.GetFunction("YearPart", new VariableDef(langdef.DateTimeType, "Datavideo")), "2012"),
                langdef.GetFunction(langdef.funcEQ, 
                    langdef.GetFunction("MonthPart", new VariableDef(langdef.DateTimeType, "Datavideo")), "12"));

var onlyDecember2012 = DataServiceProvider.DataService.LoadObjects(lcs);

Examples of usage

Following are some examples of restrictions:

the Imposition of constraints on the string variable

var langdef = ExternalLangDef.LanguageDef;
var lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof (Личность), Личность.Views.ЛичностьE);
lcs.LimitFunction = langdef.GetFunction(langdef.funcEQ,
	            new VariableDef(langdef.StringType, Information.ExtractPropertyPath<Личность>(x => x.Фамилия)), Petrov);
var клиентыФамилияПетров = DataServiceProvider.DataService.LoadObjects(lcs);

the Imposition of limitations on workman the object (the key)

var langdef = ExternalLangDef.LanguageDef;
var lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof (Кредит), Кредит.Views.КредитE);
lcs.LimitFunction = langdef.GetFunction(langdef.funcEQ,
	            new VariableDef(langdef.GuidType, Information.ExtractPropertyPath<Кредит>(x => x.Личность)), "64F45BC3-339B-4FBA-A036-C5E9FE9EAE53");
var кредиты = DataServiceProvider.DataService.LoadObjects(lcs);

the Imposition of limitations on workman the object (field master)

var langdef = ExternalLangDef.LanguageDef;
var lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof (Кредит), Кредит.Views.КредитE);
lcs.LimitFunction = langdef.GetFunction(langdef.funcEQ,
	            new VariableDef(langdef.GuidType, Information.ExtractPropertyPath<Кредит>(x => x.Личность.Фамилия)), Petrov);
var кредиты = DataServiceProvider.DataService.LoadObjects(lcs);

List of functions