-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMySearchController.cs
21 lines (20 loc) · 1.01 KB
/
MySearchController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using dxTestSolution.Module.BusinessObjects;
using MySolution.Module.BusinessObjects;
namespace dxTestSolution.Module.Controllers {
public class MySearchController : ObjectViewController<DetailView, MySearchClass> {
public MySearchController() {
var myAction1 = new SimpleAction(this, "MySearch", "MySearchCategory");
myAction1.Execute += MyAction1_Execute;
}
private void MyAction1_Execute(object sender, SimpleActionExecuteEventArgs e) {
var mySearchObject = (MySearchClass)View.CurrentObject;
var persistentOS = Application.CreateObjectSpace(typeof(Contact));
var criterion = CriteriaOperator.FromLambda<Contact>(x => x.FirstName.Contains(mySearchObject.FirstName) || x.Age == mySearchObject.Age);
var results = persistentOS.GetObjects<Contact>(criterion);
mySearchObject.SetContacts(results);
}
}
}