private void llbWorkerManager_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { pnlLook.Controls.Clear(); FrmTopChange frm1 = new FrmTopChange(); frm1.TopLevel = false; pnlLook.Controls.Add(frm1); frm1.Show(); wk_AdminGroup = AdminInfo.admingroup; pnlWorkerPage.Visible = false; }
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(), WorkerBirth = dtpBirthday.Value, WorkerSex = cboSex.Text, WorkerTel = NewTel, WorkerClub = cboClub.Text, WorkerAddress = txtAddress.Text, WorkerPosition = cboWorkerPosition.Text, CardId = NewID, WorkerPwd = Pwd.Text, WorkerTime = dtpTime.Value, WorkerFace = cboWorkerFace.Text, WorkerEduction = 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 + ",请提醒员工妥善保管!"); FrmTopChange.Reload(); #region 获取添加操作日志所需的信息 Operation o = new Operation(); o.OperationTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss")); o.Operationlog = AdminInfo.admingroup + AdminInfo.adminType + "于" + DateTime.Now + "进行了添加员工操作,员工编号为:" + WorkerNo.Text + "!"; o.OperationAccount = AdminInfo.admingroup + AdminInfo.adminType; OperationManager.InsertOperationLog(o); #endregion } #endregion else { MessageBox.Show("员工信息/履历添加失败,请检查数据格式或稍后再试!"); } } } else { MessageBox.Show("信息不能为空!"); } } catch { MessageBox.Show("服务器繁忙或数据格式为空!"); } finally { this.Close(); } }