-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.cs
37 lines (34 loc) · 1.38 KB
/
MainForm.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
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using DevExpress.Data;
using DevExpress.XtraEditors;
using DxSample.Filtering;
namespace DxSample {
public partial class MainForm : XtraForm {
public MainForm() {
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e) {
DataSet ds = new DataSet();
ds.ReadXml("nwind.xml");
DataTable dt = ds.Tables["Customers"];
var customers = from r in dt.Rows.Cast<DataRow>()
let required = new string[] {
"ANTON", "BERGS", "BLONP", "BOLID", "COMMI",
"FOLKO", "GALED", "GODOS", "HILAA"
}
where required.Contains((string)r["CustomerID"])
select new {
CompanyName = (string)r["CompanyName"],
ContactName = (string)r["ContactName"],
ContactTitle = (string)r["ContactTitle"]
};
this.GridControl.DataSource = customers.ToList();
}
private void GridView_SubstituteFilter(object sender, SubstituteFilterEventArgs e) {
e.Filter = GridFilterSubstitutor.Substitute(e.Filter);
}
}
}