-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainUserForm.cs
132 lines (114 loc) · 3.99 KB
/
MainUserForm.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using Npgsql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
namespace FireEquipment2
{
public partial class MainUserForm : Form
{
public MainUserForm()
{
InitializeComponent();
}
public int department;
public string Desc;
private List<string> postsql = new List<string>();
private void MainUserForm_Load(object sender, EventArgs e)
{
lName.Text += department.ToString();
lDesc.Text = Desc;
postsql.Add(" and \"Следующая проверка\" <= now()");
postsql.Add(" and \"Следующая проверка\" <= now() + interval '3 days' " +
"and \"Следующая проверка\" > now()");
postsql.Add(" and \"Следующая проверка\" <= now() + interval '7 days' " +
"and \"Следующая проверка\" > now() + interval '3 days'");
postsql.Add("");
SqlQuery.conn = new NpgsqlConnection(SqlQuery.connString);
try
{
var countList = new List<int>();
for (int i = 0; i < 4; i++)
{
SqlQuery.conn.Open();
SqlQuery.sql = @"select count (*) from eq_select()
where Подразделение = :_department" + postsql[i];
SqlQuery.cmd = new NpgsqlCommand(SqlQuery.sql, SqlQuery.conn);
SqlQuery.cmd.Parameters.AddWithValue("_department", department);
SqlQuery.dr = SqlQuery.cmd.ExecuteReader();
SqlQuery.dr.Read();
countList.Add (SqlQuery.dr.GetInt32(0));
SqlQuery.conn.Close();
}
NowCheck.Text += " (" + countList[0] + ")";
ThreeCheck.Text += " (" + countList[1] + ")";
SevenCheck.Text += " (" + countList[2] + ")";
AllEq.Text += " (" + countList[3] + ")";
}
catch (Exception ex)
{
SqlQuery.conn.Close();
MessageBox.Show(ex.Message);
}
}
private void NowCheck_Click(object sender, EventArgs e)
{
ShowForm f2 = new ShowForm
{
colIndex = 1,
curDepartment = department,
isManager = false,
desc = Desc,
};
this.Hide(); f2.Show();
}
private void ThreeCheck_Click(object sender, EventArgs e)
{
ShowForm f2 = new ShowForm
{
colIndex = 2,
curDepartment = department,
isManager = false,
desc = Desc,
};
this.Hide(); f2.Show();
}
private void SevenCheck_Click(object sender, EventArgs e)
{
ShowForm f2 = new ShowForm
{
colIndex = 3,
curDepartment = department,
isManager = false,
desc = Desc,
};
this.Hide(); f2.Show();
}
private void AllEq_Click(object sender, EventArgs e)
{
ShowForm f2 = new ShowForm
{
colIndex = 4,
curDepartment = department,
isManager = false,
desc = Desc,
};
this.Hide(); f2.Show();
}
private void MainUserForm_FormClosed(object sender, FormClosedEventArgs e)
{
LoginForm login = new LoginForm();
login.Show();
}
private void Checking_Click(object sender, EventArgs e)
{
ShowCheckForm f2 = new ShowCheckForm
{
curDepartment = department,
isManager = false,
desc = Desc,
};
this.Hide(); f2.Show();
}
}
}