private void BecomeEffective(PersonPayRateInput input) { PersonPayRate m = new PersonPayRate(); PersonPayRate found = PersonPayRate.GetPersonPayRate(input.员工编号, input.生效日期); if (found != null) { m = found; } input.CopyWatchMember(m); PersonPayRateInput anotherInput = input.另一人录入的记录 as PersonPayRateInput; m.录入人 = !input.是验证录入 ? input.录入人 : anotherInput.录入人; m.录入时间 = !input.是验证录入 ? input.录入时间 : anotherInput.录入时间; m.验证人 = input.是验证录入 ? input.录入人 : anotherInput.录入人; m.验证时间 = input.是验证录入 ? input.录入时间 : anotherInput.录入时间; m.效 = true; m.Save(); //将前一个有效记录作废 PersonPayRate prev = PersonPayRate.GetEffective(input.员工编号, input.生效日期.AddDays(-1)); if (prev != null) { prev.效 = false; prev.Save(); } input.Save(); }
private void btn设置个人职级工资无效_Click(object sender, EventArgs e) { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { PersonPayRate currPersonPayRate = (PersonPayRate)colView.GetFocusedRow(); if (currPersonPayRate != null) { if (MessageBox.Show(String.Format("确实将【{0}】的职级工资设置为无效吗?", currPersonPayRate.姓名), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes) { //默认本月月底 DateTime expiredDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1).AddDays(-1); if (DateTime.Today.Day > 15) { expiredDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddDays(-1); } currPersonPayRate.失效日期 = expiredDate; currPersonPayRate.效 = false; currPersonPayRate.Save(); LoadData(); MessageBox.Show(String.Format("已将【{0}】的职级工资设置为无效。", currPersonPayRate.姓名), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("错误:没有选中的记录。"); } } }