/// <summary> /// 修改资料 /// </summary> private void UpdateInfo() { if (this.CheckUpdatInput()) { Employee emp = new Employee(); // emp.ID = this.txtId.Text; emp.EmpNo = int.Parse(this.txtEmpNo.Text); emp.Name = txtName.Text; emp.Sex = rabBoy.Checked ? "男" : "女"; emp.departId = int.Parse(this.cbxDepart.SelectedValue.ToString()); if (EmployeeMgr.Update(emp)) { this.InitDbgEmp(); this.InitTree(); //修改成功以后改变相关空间的状态 this.txtName.Text = ""; this.txtEmpNo.Text = ""; this.btnSave.Enabled = false; this.tctrEmp.SelectedIndex = 0; } else { untCommon.InfoMsg("修改失败"); } } }
private static void UpdateEmp() { Employee emp = GetEmployeeByConsole(false); if (emp == null) { Console.WriteLine("无法完成更新操作!"); return; } if (EmployeeMgr.Update(emp)) { Console.WriteLine("更新成功!"); ShowEmpList(); } else { Console.WriteLine("无法更新,请检查!"); } }