WinHistory.xaml.cs
2.43 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System.Windows;
using System.Windows.Input;
namespace RCS.WinClient.Views.Pages
{
/// <summary>
/// WinHistory.xaml 的交互逻辑
/// </summary>
public partial class WinHistory : Window
{
public WinHistory()
{
InitializeComponent();
}
private void BtnQuery_Click(object sender, RoutedEventArgs e)
{
Grid_History.ItemsSource = null;
string CmSt =
"SELECT strTaskNo as '任务号'" +
", taskType as '任务类型'" +
",strTaskAgv as '小车号'" +
",StartCharge as '小车开始电量'" +
",strStartTime as '任务开始时间'" +
",EndCharge as '小车结束电量'" +
",strEndTime as '任务结束时间'" +
"FROM T_Charge_Record";
string DataFilter = "";
string CmString = CmSt;
if (tBoxAgvNo.Text != "")
{
DataFilter += string.Format(" and strTaskAgv='{0}'", tBoxAgvNo.Text);
}
if (cBoxTaskType.Text != "")
{
DataFilter += string.Format(" and taskType='{0}'", cBoxTaskType.Text);
}
if (CalendarStart.ToString() != "" && CalendarEnd.ToString() == "")
{
DataFilter += string.Format(" and strStartTime>='{0}'", CalendarStart.ToString());
}
else if (CalendarStart.ToString() == "" && CalendarEnd.ToString() != "")
{
DataFilter += string.Format(" and strStartTime<='{0}'", CalendarEnd.ToString());
}
else if (CalendarStart.ToString() != "" && CalendarEnd.ToString() != "")
{
DataFilter += string.Format(" and strStartTime>='{0}' and strEndTime<='{1}'",
CalendarStart.ToString(), CalendarEnd.ToString());
}
if (DataFilter.IndexOf(" and") == 0)
{
DataFilter = DataFilter.Remove(0, 4);
}
if (DataFilter != "")
{
DataFilter = " where " + DataFilter;
CmString += DataFilter;
}
}
private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
}
}