-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
96 lines (80 loc) · 2.83 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
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
87
88
89
90
91
92
93
94
95
96
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;
using MongoCSharpTest.Model;
namespace MongoCSharpTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnInsertMsg_Click(object sender, EventArgs e)
{
DAL.CreateMessage(tbPlant.Text, tbTruck.Text, tbPayLoad.Text, cbxStatus.Text);
}
private void btnRetrieve_Click(object sender, EventArgs e)
{
int limitRecords = Convert.ToInt32(qryLimit.Text);
dataGridView1.DataSource = DAL.GetMessages(tbQryPlant.Text, tbQryTruck.Text, qryStatus.Text, ckbxDescending.Checked, limitRecords);
lblRowCount.Text = dataGridView1.RowCount.ToString()+" Record(s)";
}
private void btnFindAndModify_Click(object sender, EventArgs e)
{
displayMessage("", //String _id,
"", //String plant,
"", //String truck,
"", //String payload,
"", //String status,
null, //Datetime createdate,
null //Datetime lastmodified
);
var record = DAL.FindFirstMessage(textBox1.Text, comboBox1.Text);
if (record != null)
{
displayMessage(record._id.ToString(),
record.plant,
record.truck,
record.payload,
record.status,
record.createdate,
record.lastmodified);
}
else
{
tb_id.Text = "*** No Record Found ***";
}
}
private void displayMessage(String _id,
String plant,
String truck,
String payload,
String status,
DateTime? createdate,
DateTime? lastmodified)
{
tb_id.Text = _id;
textBox2.Text = truck;
textBox4.Text = plant;
textBox3.Text = status;
textBox5.Text = payload;
textBox6.Text = "";
if (createdate != null)
{
textBox6.Text = createdate.ToString();
}
textBox7.Text = "";
if (lastmodified != null)
{
textBox7.Text = lastmodified.ToString();
}
}
}
}