Ejemplo n.º 1
0
        public static EmpPayRate AddEmpPayRate(string empNo, string name, int year, int month)
        {
            EmpPayRate item = GetEmpPayRate(empNo, year, month);

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

                item.标识   = Guid.NewGuid();
                item.员工编号 = empNo;
                item.姓名   = name;
                item.年    = year;
                item.月    = month;

                item.Save();
            }
            return(item);
        }
Ejemplo n.º 2
0
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.姓名))
            {
                throw new Exception("姓名不能为空.");
            }
            if (this.录入时间 == DateTime.MinValue)
            {
                this.录入时间 = DateTime.Now;
            }
            //判断已经审核的薪资组不能修改
            SalaryResult salResult = SalaryResult.GetFromCache(this.员工编号, this.年, this.月);

            if (salResult == null)
            {
                throw new Exception("未发现" + this.姓名 + "的工资记录.");
            }
            else
            {
                SalaryAuditingResult auditingResult = SalaryAuditingResult.GetSalaryAuditingResult(salResult.薪资组, this.年, this.月);
                if (auditingResult == null)
                {
                    throw new Exception("未发现" + this.姓名 + "的工资审核情况表");
                }
                else
                {
                    if (auditingResult.已审核)
                    {
                        throw new Exception(this.姓名 + "的工资已经审核,不能添加或修改。");
                    }
                }
            }

            EmpPayRate found = GetEmpPayRate(this.员工编号, this.年, this.月);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("每个员工每月只有一个工资系数.");
            }
            else
            {
                base.OnSaving();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 通过 Id 获取线路
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static EmpPayRate GetEmpPayRate(int id)
        {
            EmpPayRate obj = (EmpPayRate)Session.DefaultSession.GetObjectByKey(typeof(EmpPayRate), id);

            return(obj);
        }