物业客户管理信息系统(七)之员工主窗体~4

该部分是主窗体中代码的第四部分,因为前面说了,代码一共有一万多字节,所以,如果放到一篇文章里的话那就太多了,到时候加载网页也会变得极其的慢,不过,在最后的话我应该还会将整个软件包源代码发布出来吧。不过我要先将这些代码发布完成之后才做那些事。下图是我的主窗体的界面所使用到的图片,我从网上找来的,这张是没有经过处理,之前也发了一张类似的,不过那张是经过简单处理的用来作为主界面背景的图片。
物业客户管理信息系统(七)之员工主窗体~4

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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
private void 退款迁出toolStripMenuItem_Click(object sender, EventArgs e)  
{
if (listview_right.SelectedItems[0].SubItems[5].Text == “已入住”)
{
if (DialogResult.OK == MessageBox.Show(“确定设置(” + treeview_left.SelectedNode.Text + “的” + listview_right.SelectedItems[0].SubItems[1].Text + “号住房)的业主迁出吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
DataSet zfDSet = SQLClass.getDataSet(“select yezhuid,shoufei from zhufang where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”,“住房信息表”);
DataTable zfdt = zfDSet.Tables[“住房信息表”];
if(zfdt.Rows.Count > 0)
{
DataSet yzDSet = SQLClass.getDataSet(“select feiyong from yezhu where id = ‘” + zfdt.Rows[0][0].ToString() + “‘”, “业主信息表”);
DataTable yzdt = yzDSet.Tables[“业主信息表”];
if(yzdt.Rows.Count > 0)
{
int yzfy = Convert.ToInt32(yzdt.Rows[0][0].ToString()) – Convert.ToInt32(zfdt.Rows[0][1].ToString());
SQLClass.getsqlcom(“update yezhu set feiyong = ‘” + yzfy + “‘ where id = ‘” + zfdt.Rows[0][0].ToString() + “‘”);
SQLClass.getsqlcom(“update zhufang set yezhuid = ”,zhuangtai = ‘0’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“设置迁出成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show(“业主好像消失了,找不到了呀!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
MessageBox.Show(“不用迁啦,好像真没人住耶!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
else
{
MessageBox.Show(“暂无用户入住,无需迁出!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 添加业主toolStripMenuItem_Click(object sender, EventArgs e)
{
Reg_Form yz = new Reg_Form();
yz.Text = “添加业主”;
yz.Form_Type = 0;
yz.ShowDialog();
if (yz.Form_OK == 1)
{
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“添加业主成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 修改业主toolStripMenuItem_Click(object sender, EventArgs e)
{
Reg_Form yz = new Reg_Form();
yz.yzid = listview_right.SelectedItems[0].SubItems[1].Text;
yz.Form_Type = 1;
yz.Text = “修改业主信息”;
yz.ShowDialog();
if (yz.Form_OK == 1)
{
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“修改业主信息成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 删除业主toolStripMenuItem_Click(object sender, EventArgs e)
{
//DataSet
if (DialogResult.OK == MessageBox.Show(“确定删除(” + listview_right.SelectedItems[0].SubItems[2].Text + “)的所有信息吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
DataSet DSet = SQLClass.getDataSet(“select id from zhufang where yezhuid = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”, “住房信息表”);
DataTable dt = DSet.Tables[“住房信息表”];
if(dt.Rows.Count > 0)
{
MessageBox.Show(“该业主尚入住,请等待业主迁出后再试!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
//for (int i = 0; i < dt.Rows.Count; i++)
//{
// SQLClass.getsqlcom(“update zhufang set zhuangtai = ‘0’, yezhuid = ” where id = ‘” + dt.Rows[i][0].ToString() + “‘”);
//}
}
else
{
//SqlDataReader DR = SQLClass.getcom(“select id from yezhu where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘ and feiyong = ‘” + listview_right.SelectedItems[0].SubItems[8].Text + “‘”);
if(listview_right.SelectedItems[0].SubItems[8].Text.ToString().Trim() != “0元”)
{
MessageBox.Show(“业主费用尚未结清,不能进行删除!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
SQLClass.getsqlcom(“delete from yezhu where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
}
//DataSet yzDSet = SQLClass.getDataSet(“select feiyong from zhufang where yezhuid = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”, “业主信息表”);
//DataTable yzdt = DSet.Tables[“业主信息表”];
//if(dt.Rows.Count > 0)
//{
// if (Convert.ToInt32(dt.Rows[0][0].ToString()) > 0)
// {
// MessageBox.Show(“该业主费用状态不为0元,不能进行删除!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
// }
// else
// {
// SQLClass.getsqlcom(“delete from yezhu where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
// }
//}
//else
//{
// MessageBox.Show(“发生未知错误!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
// return;
//}

}
treeview_left_AfterSelect(sender, e);
SQLClass.con_close(); //关闭数据库连接,释放资源
MessageBox.Show(“删除业主成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
//SQLClass.getsqlcom(“update yezhu set quanxian = ‘2’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
//MessageBox.Show(“删除业主成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show(“删除操作已取消!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 审核通过toolStripMenuItem_Click(object sender, EventArgs e)
{
if(listview_right.SelectedItems[0].SubItems[7].Text == “未审核”)
{
if (DialogResult.OK == MessageBox.Show(“确定审核(” + listview_right.SelectedItems[0].SubItems[2].Text + “)的所有信息吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
SQLClass.getsqlcom(“update yezhu set quanxian = ‘1’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“审核通过成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
MessageBox.Show(“该用户已审核通过,无需再次审核!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 取消审核toolStripMenuItem_Click(object sender, EventArgs e)
{
if(listview_right.SelectedItems[0].SubItems[7].Text == “已审核”)
{
if (DialogResult.OK == MessageBox.Show(“确定取消(” + listview_right.SelectedItems[0].SubItems[2].Text + “)的审核吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
SQLClass.getsqlcom(“update yezhu set quanxian = ‘0’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“取消审核成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
MessageBox.Show(“该用户已为未审核状态,无需再次取消!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 添加员工toolStripMenuItem_Click(object sender, EventArgs e)
{
Yuangong_Form yg = new Yuangong_Form();
if(treeview_left.SelectedNode == null)
{

}
else
{
DataSet DSet = SQLClass.getDataSet(“select bumen from gangwei where gangwei = ‘” + treeview_left.SelectedNode.Text + “‘”, “岗位信息表”);
DataTable dt = DSet.Tables[“岗位信息表”];
if(dt.Rows.Count > 0)
{
yg.bmname = dt.Rows[0][0].ToString();
yg.gwname = treeview_left.SelectedNode.Text;
}
else
{
yg.bmname = treeview_left.SelectedNode.Text;
}
}
yg.Text = “添加员工”;
yg.Form_Type = 0;
yg.ShowDialog();
if (yg.Form_OK == 1)
{
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“添加员工成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 修改员工toolStripMenuItem_Click(object sender, EventArgs e)
{
Yuangong_Form yg = new Yuangong_Form();
if (treeview_left.SelectedNode == null)
{

}
else
{
DataSet DSet = SQLClass.getDataSet(“select bumen from gangwei where gangwei = ‘” + treeview_left.SelectedNode.Text + “‘”, “岗位信息表”);
DataTable dt = DSet.Tables[“岗位信息表”];
if (dt.Rows.Count > 0)
{
yg.bmname = dt.Rows[0][0].ToString();
yg.gwname = treeview_left.SelectedNode.Text;
}
else
{
yg.bmname = treeview_left.SelectedNode.Text;
yg.gwname = listview_right.SelectedItems[0].SubItems[4].Text;
}
}
yg.ygid = listview_right.SelectedItems[0].SubItems[1].Text;
yg.Text = “修改员工”;
yg.Form_Type = 1;
yg.ShowDialog();
if (yg.Form_OK == 1)
{
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“修改员工成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 删除员工toolStripMenuItem_Click(object sender, EventArgs e)
{
if (listview_right.SelectedItems[0].SubItems[7].Text == “超级管理员”)
{
MessageBox.Show(“超级管理员不能被删除!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (listview_right.SelectedItems[0].SubItems[7].Text == “管理员”)
{
MessageBox.Show(“请设置为普通员工再尝试!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (DialogResult.OK == MessageBox.Show(“确定删除(” + listview_right.SelectedItems[0].SubItems[2].Text + “)的所有信息吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
//确认删除数据
SQLClass.getsqlcom(“delete from yuangong where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
SQLClass.con_close(); //关闭数据库连接,释放资源
MessageBox.Show(“删除员工成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

private void 设为管理员toolStripMenuItem_Click(object sender, EventArgs e)
{
if (glyqx == 2)
{
if (listview_right.SelectedItems[0].SubItems[7].Text == “超级管理员”)
{
MessageBox.Show(“超级管理员不能被更改!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (listview_right.SelectedItems[0].SubItems[7].Text == “管理员”)
{
MessageBox.Show(“该员工已是管理员,无需修改!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (DialogResult.OK == MessageBox.Show(“确定设置([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)为管理员吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
SQLClass.getsqlcom(“update yuangong set quanxian = ‘1’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“设置操作成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
else
{
MessageBox.Show(“只有超级管理员才可进行此操作!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}

private void 设为普通员工toolStripMenuItem_Click(object sender, EventArgs e)
{
if (glyqx == 2)
{
if (listview_right.SelectedItems[0].SubItems[7].Text == “超级管理员”)
{
MessageBox.Show(“超级管理员不能被更改!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (listview_right.SelectedItems[0].SubItems[7].Text == “普通员工”)
{
MessageBox.Show(“该员工已是普通员工,无需修改!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (DialogResult.OK == MessageBox.Show(“确定设置([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)为普通员工吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
SQLClass.getsqlcom(“update yuangong set quanxian = ‘0’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“设置操作成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
else
{
MessageBox.Show(“只有超级管理员才可进行此操作!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}


private void 添加日常toolStripMenuItem_Click(object sender, EventArgs e)
{
Richang_Form rc = new Richang_Form();
rc.Text = “添加日常任务”;
rc.Form_Type = 0;
rc.ShowDialog();
if (rc.Form_OK == 1)
{
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“添加日常任务成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 修改日常toolStripMenuItem_Click(object sender, EventArgs e)
{
Richang_Form rc = new Richang_Form();
rc.rcid = listview_right.SelectedItems[0].SubItems[1].Text;
rc.Text = “修改日常任务”;
rc.Form_Type = 1;
rc.ShowDialog();
if (rc.Form_OK == 1)
{
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“修改日常任务成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 删除日常toolStripMenuItem_Click(object sender, EventArgs e)
{
if (DialogResult.OK == MessageBox.Show(“确定删除([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)的所有信息吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
//确认删除数据
SQLClass.getsqlcom(“delete from richang where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
SQLClass.con_close(); //关闭数据库连接,释放资源
MessageBox.Show(“删除日常任务成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void 设为已完成toolStripMenuItem_Click(object sender, EventArgs e)
{
if (listview_right.SelectedItems[0].SubItems[4].Text == “未完成”)
{
if (DialogResult.OK == MessageBox.Show(“确定已完成([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)的日常任务吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
SQLClass.getsqlcom(“update richang set zhuangtai = ‘1’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“设置操作成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
MessageBox.Show(“该日常已为完成状态,无需修改!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}