private void BtnStaffDelete_Click(object sender, EventArgs e) { if (DgvStaffData.SelectedRows.Count == 1) { int index = DgvStaffData.SelectedRows[0].Index; Staff = staffs[index]; StringBuilder sb = new StringBuilder(); sb.Append("确定删除当前员工?\n"); sb.Append("员工编号:" + Staff.StaffID.ToString() + "\n"); sb.Append("员工姓名:" + Staff.StaffName + "\n"); sb.Append("联系方式:" + Staff.StaffPhone + "\n"); sb.Append("员工职称:" + Staff.Role); if (DialogResult.OK == MsgBoxUtil.QuestionMsgBox(sb.ToString())) { StaffDao.DeleteByStaffID(Staff.StaffID); staffs.RemoveAt(index); DgvStaffData.Rows.RemoveAt(index); Staff = null; } } else { MsgBoxUtil.ErrMsgBox("请选择要删除的员工!"); } }