private void button4_Click(object sender, EventArgs e) //保存更改 { staff.Staff a = new staff.Staff(); if (a.staffexist(textBox1.Text)) { if (a.update_all(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text)) { MessageBox.Show("已更新完"); } else { MessageBox.Show("没更新"); } } else { MessageBox.Show("不存在这个人"); } }
private void button4_Click(object sender, EventArgs e) //保存更改 { staff.Leading a = new staff.Leading(); staff.Staff b = new staff.Staff(); if (b.staffexist(textBox7.Text)) { if (a.addlead(textBox1.Text, textBox7.Text)) { MessageBox.Show("已经新增"); } else { MessageBox.Show("没新增,原因可能为:此员工不是这个部门的"); } } else { MessageBox.Show("此员工不存在"); } }
private void button2_Click(object sender, EventArgs e) //修改 { if (textBox1.Text == String.Empty) //输入不能为空 { MessageBox.Show("输入不能为空!"); return; } staff.Staff staff = new staff.Staff(); if (staff.staffexist(textBox1.Text.ToString())) { staff.search(textBox1.Text.ToString()); staffForm3_update f3 = new staffForm3_update(); f3.showStaff(textBox1.Text.ToString(), staff.name, staff.age, staff.sex, staff.phone_number, staff.salary, staff.dept_name); this.Hide(); f3.ShowDialog(); this.Close(); } else { MessageBox.Show("该员工不存在"); } }
private void button3_Click(object sender, EventArgs e) //删除 { string staffid = textBox1.Text; staff.Staff a = new staff.Staff(); a.search(staffid); string dn = a.dept_name; if (a.staffexist(staffid)) { if (dn == "Merchant_Mgt_Dept") { if (a.detele_staffmerchant(staffid)) { if (a.is_response == true) { MessageBox.Show("此人是merchant负责人,并已成功删除"); a.is_response = false; } else { MessageBox.Show("此普通员工已经删除"); } } else { MessageBox.Show("未能删除"); } } else if (dn == "Stall_Mgt_Dept") { if (a.detele_staffstall(staffid)) { if (a.is_response == true) { MessageBox.Show("此人是stall的负责人,并已成功删除"); a.is_response = false; } else { MessageBox.Show("此人是stall的普通员工,已成功删除"); } } else { MessageBox.Show("未能删除"); } } else if (dn == "Personal_Adm_Dept") { if (a.detele_staffstaff(staffid)) { if (a.is_response == true) { MessageBox.Show("此人是人事的负责人,并已成功删除"); a.is_response = false; } else { MessageBox.Show("此人是人事的普通员工,已成功删除"); } } else { MessageBox.Show("未能删除"); } } else if (dn == "Material_Ctrl_Dept") { if (a.detele_staffwarehouse(staffid)) { if (a.is_response == true) { MessageBox.Show("此人是仓库的负责人,并已成功删除"); a.is_response = false; } else { MessageBox.Show("此人是仓库的普通员工,已成功删除"); } } else { MessageBox.Show("未能删除"); } } } else { MessageBox.Show("不存在,未能删除"); } }