Exemplo n.º 1
0
        public static EmpSalaryStep GetEffective(string empNo, DateTime date)
        {
            GroupOperator criteria = new GroupOperator(GroupOperatorType.And,
                                                       new BinaryOperator("员工编号", empNo, BinaryOperatorType.Equal),
                                                       new BinaryOperator("执行日期", date, BinaryOperatorType.LessOrEqual)
                                                       );

            XPCollection objset = new XPCollection(MyHelper.XpoSession, typeof(EmpSalaryStep), criteria, new SortProperty("执行日期", SortingDirection.Descending));

            if (objset.Count > 0)
            {
                EmpSalaryStep item = (EmpSalaryStep)objset[0];
                if (item.截止日期 == DateTime.MinValue || item.截止日期 >= date)
                {
                    return(item);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public static EmpSalaryStep AddEmpSalaryStep(string empNo, string name, DateTime effDate)
        {
            EmpSalaryStep item = GetEmpSalaryStep(empNo, effDate);

            if (item == null)
            {
                item = new EmpSalaryStep();

                item.标识   = Guid.NewGuid();
                item.员工编号 = empNo;
                item.姓名   = name;
                item.执行日期 = effDate;
                item.Save();
            }
            return(item);
        }
        void GetPayInfo()
        {
            //取月初薪等薪级
            DateTime      date = new DateTime(期间_开始.Year, 期间_开始.Month, 15);
            EmpSalaryStep 月初职级 = EmpSalaryStep.GetEffective(员工编号, date);
            EmpSalaryStep 月底职级 = EmpSalaryStep.GetEffective(员工编号, 期间_结束);

            if (月初职级 != null)
            {
                薪等_月初     = 月初职级.薪等标识;
                薪级_月初     = 月初职级.薪级标识;
                开始执行日期_月初 = 月初职级.执行日期;
            }
            if (月底职级 != null)
            {
                薪等_月底     = 月底职级.薪等标识;
                薪级_月底     = 月底职级.薪级标识;
                开始执行日期_月底 = 月底职级.执行日期;
            }
        }
Exemplo n.º 4
0
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.姓名))
            {
                throw new Exception("姓名不能为空.");
            }
            if (this.录入时间 == DateTime.MinValue)
            {
                this.录入时间 = DateTime.Now;
            }

            EmpSalaryStep found = GetEmpSalaryStep(this.员工编号, this.执行日期);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("同一员工同一日期只能存在一条记录,不能重复.");
            }
            else
            {
                base.OnSaving();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 通过 Id 获取线路
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static EmpSalaryStep GetEmpSalaryStep(Guid id)
        {
            EmpSalaryStep obj = (EmpSalaryStep)Session.DefaultSession.GetObjectByKey(typeof(EmpSalaryStep), id);

            return(obj);
        }