-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
45 lines (41 loc) · 1.43 KB
/
Form1.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
using DevExpress.Data.Linq;
using DevExpress.XtraEditors;
using System;
namespace EntityFrameworkServerModeExample
{
public partial class Form1 : XtraForm
{
EntityServerModeSource entityServerModeSource;
bool serverMode = false;
public Form1()
{
InitializeComponent();
entityServerModeSource = new EntityServerModeSource
{
ElementType = typeof(EntityInvoice),
KeyExpression = "OrderId"
};
NWEntities context = new NWEntities();
context.Database.Log = Console.Write;
entityServerModeSource.QueryableSource = context.EntityInvoices;
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'nWDataSet.Invoices' table. You can move, or remove it, as needed.
this.invoicesTableAdapter.Fill(this.nWDataSet.Invoices);
SetPivotGridDataSource();
}
private void toggleSwitch1_Toggled(object sender, EventArgs e)
{
serverMode = ((ToggleSwitch)sender).IsOn;
SetPivotGridDataSource();
}
private void SetPivotGridDataSource()
{
if (serverMode)
pivotGridControl1.DataSource = entityServerModeSource;
else
pivotGridControl1.DataSource = invoicesBindingSource;
}
}
}