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

物业客户关系管理信息系统员工主窗体的第五部分代码,刚开始准备着手编写这个物业客户关系管理信息系统的时候,其实我是计划要写多个类,免得多做无用的工作,比如说敲重复代码,但是毕竟是第一次写系统,所以计划好的全部都被打乱了,而且也想不到要如何去编写类等来使代码变得更简单,这也使我的代码重复来重复去,最终使主界面的代码达到了一万多字。下图是我从网上找来的ICO文件,主要是用来作为ListView和Treeview的图标用的,有一个图片是ListView中未选中和选中的图标,蓝颜色的是修改过的用来代表已选中行。
物业客户管理信息系统(七)之员工主窗体~5

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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
private void 设为未完成toolStripMenuItem_Click(object sender, EventArgs e)  
{
if (listview_right.SelectedItems[0].SubItems[4].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 richang set zhuangtai = ‘0’ where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
MessageBox.Show(“设置操作成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
private void 添加申请toolStripMenuItem_Click(object sender, EventArgs e)
{
Fuwu_Form fw = new Fuwu_Form();
fw.Text = “添加服务申请”;
fw.Form_Type = 0;
fw.ShowDialog();
if (fw.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[5].Text == “未处理”)
{
Fuwu_Form fw = new Fuwu_Form();
fw.fwid = listview_right.SelectedItems[0].SubItems[1].Text;
fw.Text = “修改服务申请”;
fw.Form_Type = 1;
fw.ShowDialog();
if (fw.Form_OK == 1)
{
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[5].Text == “已受理” || listview_right.SelectedItems[0].SubItems[5].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))
{
//SqlDataReader dr = SQLClass.getcom(“select id from yezhu where xingming = ‘” + listview_right.SelectedItems[0].SubItems[3].Text + “‘”);
//bool ifcom = dr.Read();
//if (ifcom)
//{

//}
//else
//{
// if (DialogResult.OK == MessageBox.Show(“确定删除的信息所属业主已不存在,确定继续删除记录吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
// {
// }
// else
// {
// return;
// }
//}
//确认删除数据
SQLClass.getsqlcom(“delete from fuwu where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
SQLClass.con_close(); //关闭数据库连接,释放资源
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[5].Text == “未处理”)
{
if (DialogResult.OK == MessageBox.Show(“确定受理([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)的服务申请吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
Fuwu_Form fw = new Fuwu_Form();
fw.fwid = listview_right.SelectedItems[0].SubItems[1].Text;
fw.Text = “受理服务申请”;
fw.Form_Type = 2;
fw.ShowDialog();
if (fw.Form_OK == 1)
{
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);
}
}
private void 取消受理toolStripMenuItem_Click(object sender, EventArgs e)
{
if (listview_right.SelectedItems[0].SubItems[5].Text == “已完成”)
{
MessageBox.Show(“该服务申请已完成,无需再次受理!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if(listview_right.SelectedItems[0].SubItems[5].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 fuwu set yuangongid = ”, queren = ”, 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);
}
}
}
private void 完成申请toolStripMenuItem_Click(object sender, EventArgs e)
{
if (listview_right.SelectedItems[0].SubItems[5].Text == “已受理”)
{
if (DialogResult.OK == MessageBox.Show(“确定已完成([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)的服务申请吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
Fuwu_Form fw = new Fuwu_Form();
fw.fwid = listview_right.SelectedItems[0].SubItems[1].Text;
fw.Text = “完成服务申请”;
fw.Form_Type = 3;
fw.ShowDialog();
if (fw.Form_OK == 1)
{
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);
}
}
private void 取消完成toolStripMenuItem_Click(object sender, EventArgs e)
{
if (listview_right.SelectedItems[0].SubItems[5].Text == “已完成”)
{
if (DialogResult.OK == MessageBox.Show(“确定取消已完成的([“ + listview_right.SelectedItems[0].SubItems[1].Text + “]” + listview_right.SelectedItems[0].SubItems[2].Text + “)的服务申请吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
int yzfy;
DataSet fwDSet = SQLClass.getDataSet(“select yezhuid,shoufei from fuwu where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”, “服务信息表”);
DataTable fwdt = fwDSet.Tables[“服务信息表”];
DataSet yzDSet = SQLClass.getDataSet(“select feiyong from yezhu where id = ‘” + fwdt.Rows[0][0].ToString() + “‘”,“业主信息表”);
DataTable yzdt = yzDSet.Tables[“业主信息表”];
if(yzdt.Rows.Count > 0)
{
yzfy = Convert.ToInt32(yzdt.Rows[0][0].ToString()) – Convert.ToInt32(fwdt.Rows[0][1].ToString());
SQLClass.getsqlcom(“update yezhu set feiyong = ‘” + yzfy + “‘ where id = ‘” + fwdt.Rows[0][0].ToString() + “‘”);
}
else
{
if (DialogResult.OK == MessageBox.Show(“该记录的所属业主已被删除,确定取消完成该条记录吗?”, “询问”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{

}
else
{
return;
}
}
SQLClass.getsqlcom(“update fuwu set shoufei = ”, wancheng = ”, 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);
}
}
else
{
MessageBox.Show(“该服务申请尚未完成,无法进行取消完成操作!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}

private void 添加收费toolStripMenuItem_Click(object sender, EventArgs e)
{
Shoufei_Form sf = new Shoufei_Form();
if (splitcon1.Tag.ToString() == “yz”)
{
if (listview_right.SelectedItems.Count <= 0 || listview_right.SelectedItems[0].SubItems[1].Text == “”)
{
//MessageBox.Show(“添加收费项目成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
sf.yzid = listview_right.SelectedItems[0].SubItems[1].Text;
}
}
sf.Form_Type = 0;
sf.Text = “添加收费项目”;
sf.ShowDialog();
if (sf.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[4].Text == “未缴费”)
{
Shoufei_Form sf = new Shoufei_Form();
sf.sfid = listview_right.SelectedItems[0].SubItems[1].Text;
sf.Text = “修改收费项目”;
sf.Form_Type = 1;
sf.ShowDialog();
if (sf.Form_OK == 1)
{
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[4].Text == “未缴费”)
{
Shoufei_Form sf = new Shoufei_Form();
sf.sfid = listview_right.SelectedItems[0].SubItems[1].Text;
sf.Text = “设为已缴费”;
sf.Form_Type = 3;
sf.ShowDialog();
if (sf.Form_OK == 1)
{
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[4].Text == “未缴费”)
{
MessageBox.Show(“已为未缴费状态,无需重新设置!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
DataSet sfDSet = SQLClass.getDataSet(“select yezhuid,jine from shoufei where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”, “收费信息表”);
DataTable sfdt = sfDSet.Tables[“收费信息表”];
if(sfdt.Rows.Count > 0)
{
DataSet yzDSet = SQLClass.getDataSet(“select id,feiyong from yezhu where id = ‘” + sfdt.Rows[0][0].ToString() + “‘”,“业主信息表”);
DataTable yzdt = yzDSet.Tables[“业主信息表”];
if(yzdt.Rows.Count > 0)
{
int sfje = Convert.ToInt32(yzdt.Rows[0][1].ToString()) + Convert.ToInt32(sfdt.Rows[0][1].ToString());
SQLClass.getsqlcom(“update yezhu set feiyong = ‘” + sfje + “‘ where id = ‘” + yzdt.Rows[0][0].ToString() + “‘”);
SQLClass.getsqlcom(“update shoufei set leixing = ‘0’,yuangongid = ” 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);
}
}
}

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(“delete from shoufei where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
SQLClass.con_close(); //关闭数据库连接,释放资源
MessageBox.Show(“删除收费项目成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
if(listview_right.SelectedItems[0].SubItems[6].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(“delete from shoufei where id = ‘” + listview_right.SelectedItems[0].SubItems[1].Text + “‘”);
treeview_left_AfterSelect(sender, e);
SQLClass.con_close(); //关闭数据库连接,释放资源
MessageBox.Show(“删除收费项目成功!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
MessageBox.Show(“该项目处于成功缴费状态不可删除!”, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}

//关闭和最小化操作—————————————————————————–
private void picbox_close_MouseHover(object sender, EventArgs e)
{
picbox_close.Image = Image.FromFile(“images/close_mouse.png”);
}

private void picbox_close_MouseLeave(object sender, EventArgs e)
{
picbox_close.Image = Image.FromFile(“images/close.png”);
}

private void picbox_min_MouseHover(object sender, EventArgs e)
{
picbox_min.Image = Image.FromFile(“images/min_mouse.png”);
}

private void picbox_min_MouseLeave(object sender, EventArgs e)
{
picbox_min.Image = Image.FromFile(“images/min.png”);
}

private void picbox_min_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}

private void picbox_close_Click(object sender, EventArgs e)
{
Application.Exit();
}