This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
/
XtraForm1.cs
63 lines (57 loc) · 2.18 KB
/
XtraForm1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.Data.Filtering;
using DevExpress.XtraEditors;
using XpoTutorial3.DataModel;
namespace XpoTutorial3 {
public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm {
public XtraForm1() {
InitializeComponent();
}
private void XtraForm1_Load(object sender, EventArgs e) {
if (xpCollection1.Count == 0) {
var customer1 = new Customer(session1);
customer1.Name = "John";
customer1.Age = 21;
customer1.Save();
xpCollection1.Add(customer1);
var customer2 = new Customer(session1);
customer2.Name = "Bob";
customer2.Age = 37;
customer2.Save();
xpCollection1.Add(customer2);
var customer3 = new Customer(session1);
customer3.Name = "Sam";
customer3.Age = 26;
customer3.Save();
xpCollection1.Add(customer3);
var customer4 = new Customer(session1);
customer4.Name = "Bill";
customer4.Age = 30;
customer4.Save();
xpCollection1.Add(customer4);
}
}
private void simpleButton1_Click(object sender, EventArgs e) {
xpCollection1.Criteria = new BinaryOperator("Age", spinEdit1.Value, BinaryOperatorType.Greater);
gridControl1.RefreshDataSource();
}
private void simpleButton2_Click(object sender, EventArgs e) {
xpCollection1.Filter = new BinaryOperator("Age", spinEdit2.Value, BinaryOperatorType.Greater);
gridControl1.RefreshDataSource();
}
private void simpleButton3_Click(object sender, EventArgs e) {
xpCollection1.Criteria = null;
gridControl1.RefreshDataSource();
}
private void simpleButton4_Click(object sender, EventArgs e) {
xpCollection1.Filter = null;
gridControl1.RefreshDataSource();
}
}
}