protected void LoadData(string key)
        {
            List <EmpSalaryStep> list = EmpSalaryStep.GetAll();

            //根据权限过滤
            list = list.FindAll(a => AccessController.CheckPayGroup(a.薪资组) && AccessController.CheckGrade(a.薪等标识));
            list = list.OrderBy(a => a.员工信息.员工序号).ToList();
            if (string.IsNullOrEmpty(key) == false)
            {
                list = list.FindAll(a => a.姓名.Contains(key));
            }
            //如果不显示历史记录
            if (chk显示历史记录.Checked == false)
            {
                List <EmpSalaryStep> tempList = new List <EmpSalaryStep>();
                foreach (EmpSalaryStep item in list)
                {
                    EmpSalaryStep effectiveItem = EmpSalaryStep.GetEffective(item.员工编号, DateTime.Today);
                    if (effectiveItem != null && effectiveItem.标识 == item.标识)
                    {
                        tempList.Add(item);
                    }
                }
                list = tempList;
            }
            gridControl1.DataSource = list;
            gridControl1.RefreshDataSource();
            gridView1.ExpandAllGroups();
        }
        void GetPayInfo()
        {
            //取月初薪等薪级
            DateTime      date = new DateTime(工资计算器.期间_开始.Year, 工资计算器.期间_开始.Month, 15);
            EmpSalaryStep 月初职级 = EmpSalaryStep.GetEffective(员工编号, date);
            EmpSalaryStep 月底职级 = EmpSalaryStep.GetEffective(员工编号, 工资计算器.期间_结束);

            if (月初职级 != null)
            {
                薪等_月初 = 月初职级.薪等标识;
                薪级_月初 = 月初职级.薪级标识;
            }
            if (月底职级 != null)
            {
                薪等_月底 = 月底职级.薪等标识;
                薪级_月底 = 月底职级.薪级标识;
            }
        }
        private void btn设置截止日期_Click(object sender, EventArgs e)
        {
            ColumnView colView = (ColumnView)gridControl1.MainView;

            if (colView != null)
            {
                EmpSalaryStep currEmpSalaryStep = (EmpSalaryStep)colView.GetFocusedRow();
                if (currEmpSalaryStep != null)
                {
                    if (dateEdit1.DateTime != DateTime.MinValue && (dateEdit1.DateTime < MyHelper.GetPrevMonth1Day().AddMonths(-1) || dateEdit1.DateTime < currEmpSalaryStep.执行日期))
                    {
                        MessageBox.Show("错误:截止日期不能小于执行日期或上上月1号。");
                    }
                    else
                    {
                        EmpSalaryStep latestItem = EmpSalaryStep.GetLatest(currEmpSalaryStep.员工编号);
                        if (currEmpSalaryStep.标识 != latestItem.标识)
                        {
                            MessageBox.Show("错误:只能设置最后录入的那条记录。");
                        }
                        else
                        {
                            string s = String.Format("设置为【{0:yyyy-M-d}】", dateEdit1.DateTime);
                            if (dateEdit1.DateTime == DateTime.MinValue)
                            {
                                s = "清除";
                            }
                            if (MessageBox.Show(String.Format("确实将【{0}】当前职级的截止日期" + s + "吗?", currEmpSalaryStep.姓名), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
                            {
                                currEmpSalaryStep.截止日期 = dateEdit1.DateTime;
                                currEmpSalaryStep.Save();

                                MessageBox.Show(String.Format("已将【{0}】当前职级的截止日期" + s + "。", currEmpSalaryStep.姓名), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                LoadData();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("错误:没有选中的记录。");
                }
            }
        }
Esempio n. 4
0
        private void BecomeEffective(EmpSalaryStepInput input)
        {
            EmpSalaryStep m     = new EmpSalaryStep();
            EmpSalaryStep found = EmpSalaryStep.GetEmpSalaryStep(input.员工编号, input.执行日期);

            if (found != null)
            {
                m = found;
            }
            EmployeeInfo emp = EmployeeInfo.GetEmployeeInfo(input.员工编号);

            m.薪资组 = emp.薪资组;
            input.CopyWatchMember(m);

            EmpSalaryStepInput anotherInput = input.另一人录入的记录 as EmpSalaryStepInput;

            m.录入人  = !input.是验证录入 ? input.录入人 : anotherInput.录入人;
            m.录入时间 = !input.是验证录入 ? input.录入时间 : anotherInput.录入时间;
            m.验证人  = input.是验证录入 ? input.录入人 : anotherInput.录入人;
            m.验证时间 = input.是验证录入 ? input.录入时间 : anotherInput.录入时间;
            m.Save();
        }