FrmHistory.cs
2.3 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TSA_V
{
public partial class FrmHistory : Form
{
public FrmHistory()
{
InitializeComponent();
}
private void FrmHistory_Load(object sender, EventArgs e)
{
DtpTimeFront.Value = DateTime.Now;
DtpTimeBack.Value = DateTime.Now;
}
private void BtnQuery_Click(object sender, EventArgs e)
{
string timeFront = null, timeBack = null;
if (DtpTimeFront.Checked) timeFront = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DtpTimeFront.Value);
if (DtpTimeBack.Checked) timeBack = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DtpTimeBack.Value);
bool rtn = DeviceLibrary.DB.db.QueryHistory(TxtCode.Text, timeFront, timeBack, out string[][] data);
if (rtn)
{
DgvOperateInfo.Rows.Clear();
if (data.Length == 0)
MessageBox.Show("没有找到记录");
else
for (int i = 0; i < data.Length; i++)
DgvOperateInfo.Rows.Add(data[i]);
}
else
{
MessageBox.Show("查询出错", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void DgvOperateInfo_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (DgvOperateInfo.CurrentCell == null) return;
string id = DgvOperateInfo.Rows[DgvOperateInfo.CurrentCell.RowIndex].Cells[0].Value.ToString();
bool rtn = DeviceLibrary.DB.db.QueryPointInfo(id, out string[][] data);
if (rtn)
{
DgvPointInfo.Rows.Clear();
if (data.Length == 0)
MessageBox.Show("没有找到记录");
else
for (int i = 0; i < data.Length; i++)
DgvPointInfo.Rows.Add(data[i]);
}
else
{
MessageBox.Show("查询出错", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}