private void btnAdd_Click(object sender, EventArgs e) { try { if (WorkerName.Text != null /*&& ucHistory.txtCompany.Text != null*/ && cboSex.Text != null) { string NewID = Md5LockedUtil.MD5Encrypt32(WorkerID.Text.ToString()); string NewTel = Md5LockedUtil.MD5Encrypt32(WorkerTel.Text.ToString()); #region 员工信息添加代码块 Worker worker = new Worker { WorkerId = WorkerNo.Text.Trim(), WorkerName = WorkerName.Text.Trim(), WorkerBirthday = dtpBirthday.Value, WorkerSex = cboSex.SelectedIndex, WorkerTel = NewTel, WorkerClub = cboClub.Text, WorkerAddress = txtAddress.Text, WorkerPosition = cboWorkerPosition.Text, CardId = NewID, WorkerPwd = Pwd.Text, WorkerTime = dtpTime.Value, WorkerFace = cboWorkerFace.Text, WorkerEducation = cboEducation.Text }; int n = WorkerManager.AddWorker(worker); #endregion #region 履历添加代码块 if (ucHistory.txtCompany != null && ucHistory.txtPosition != null && ucHistory.dtpStartDate.Value != null && ucHistory.dtpEndDate.Value != null) { WorkerHistory workerHistory = new WorkerHistory { StartDate = ucHistory.dtpStartDate.Value, EndDate = ucHistory.dtpEndDate.Value, Postion = ucHistory.txtPosition.Text, Company = ucHistory.txtCompany.Text }; int j = WorkerHistoryManager.AddHistoryByWorkerId(workerHistory, WorkerNo.Text); #endregion #region 判断履历和信息代码块 if (n > 0 && j > 0) { MessageBox.Show("员工信息/履历添加成功!该员工登录密码为:" + Pwd.Text + ",请提醒员工妥善保管!"); FrmWorkerManager.Reload(); #region 获取添加操作日志所需的信息 OperationLog o = new OperationLog(); o.OperationTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss")); << << << < HEAD : SYS.FormUI / FrmAddWorker.cs << << << < HEAD : SYS.FormUI / FrmAddWorker.cs o.Operationlog = AdminInfo.admingroup + AdminInfo.adminType + "于" + DateTime.Now + "进行了添加员工操作,员工编号为:" + WorkerNo.Text + "!"; o.OperationAccount = AdminInfo.admingroup + AdminInfo.adminType; OperationManager.InsertOperationLog(o);