private void btnAddEmp_Click(object sender, EventArgs e) { //更新员工 if (this.Text.Equals(TITLE_UPDATE_EMPLOYEE_INFO)) { if (!Tool.isNull(txtId.Text) && !Tool.isNull(txtName.Text) && !Tool.isNull(txtEmail.Text)) { Employee emp = new Employee(); emp.Id = txtId.Text.ToUpper().Trim(); emp.Name = txtName.Text.Trim(); emp.Email = txtEmail.Text.Trim() + "@pactera.com"; emp.Telephone = txtTelephone.Text.Trim(); emp.Mobile = txtMobile.Text.Trim(); if (empBll.UpdateEmp(emp)) { MessageBox.Show(SHOW_UPDATE_SUCESS); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; MessageBox.Show(SHOW_UPDATE_DEFEAT); } } else { MessageBox.Show(SHOW_PLEASE_CHECK_MUST_NEED); return; } } //增加员工 else { if (!Tool.isNull(txtId.Text) && !Tool.isNull(txtName.Text) && !Tool.isNull(txtEmail.Text)) { Employee emp = new Employee(); emp.Id = txtId.Text.ToUpper().Trim(); emp.Name = txtName.Text.Trim(); emp.Email = txtEmail.Text.Trim() + EMAIL_POSTFIX; emp.Telephone = txtTelephone.Text.Trim(); emp.Mobile = txtMobile.Text.Trim(); if (empBll.AddEmployee(emp)) { MessageBox.Show(SHOW_ADD_SUCESS); DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { MessageBox.Show(SHOW_ADD_DEFEAT); } } else { MessageBox.Show(SHOW_PLEASE_CHECK_MUST_NEED); return; } } }