Beispiel #1
0
        public static void SychSalaryStep()
        {
            foreach (SalStep ss in SalStep.GetAll())
            {
                SalaryStep salStep = AddSalaryStep(ss.集合, ss.薪酬体系, ss.薪等编号, ss.薪级编号, ss.生效日期);
                if (salStep == null)
                {
                    continue;
                }

                salStep.薪级名称 = ss.薪级名称;

                salStep.次同步时间 = DateTime.Now;

                salStep.Save();
            }
            //冲突处理:有VS无 / 有VS变 / 无VS有
            foreach (SalaryStep step in GetAll())
            {
                SalStep found = SalStep.GetAll().Find(a => a.集合 == step.集合 && a.薪酬体系 == step.薪酬体系 && a.薪等编号 == step.薪等编号 && a.生效日期 == step.生效日期);
                if (found == null)
                {
                    step.Delete();
                }
            }
        }
Beispiel #2
0
        //获取所有工资标准
        public static List <PayRate> GetAll()
        {
            List <PayRate> list = new List <PayRate>();

            List <SalaryPlan>  allPlan   = SalaryPlan.薪酬体系表;
            List <SalaryGrade> allGrades = SalaryGrade.当前薪等表;
            List <SalaryStep>  allSteps  = SalaryStep.GetEffectedSteps(DateTime.Today, allGrades);

            var setids = from p in allPlan
                         group p by p.集合 into setid
                         select setid;

            //生成集合点
            foreach (var setid in setids)
            {
                PayRate payRate_SetId = new PayRate();
                payRate_SetId.父节点标识 = "";
                payRate_SetId.标识    = setid.Key;
                payRate_SetId.英文名   = setid.Key;
                payRate_SetId.中文名   = setid.Key;
                list.Add(payRate_SetId);
                //生成薪酬体系节点
                List <SalaryPlan> salPlans = allPlan.FindAll(a => a.集合 == setid.Key);
                foreach (SalaryPlan plan in salPlans)
                {
                    PayRate payRate_Plan = new PayRate();

                    payRate_Plan.父节点标识 = setid.Key;
                    payRate_Plan.标识    = plan.标识.ToString();
                    payRate_Plan.英文名   = plan.英文名;
                    payRate_Plan.中文名   = plan.中文名;

                    list.Add(payRate_Plan);

                    //生成薪等
                    List <SalaryGrade> myGrades = allGrades.FindAll(a => a.集合 == setid.Key && a.薪酬体系 == plan.英文名);
                    foreach (SalaryGrade grade in myGrades)
                    {
                        PayRate payRate_Grade = new PayRate();

                        payRate_Grade.父节点标识 = payRate_Plan.标识;
                        payRate_Grade.标识    = grade.标识.ToString();
                        payRate_Grade.英文名   = grade.薪等编号;
                        payRate_Grade.中文名   = grade.薪等名称;

                        payRate_Grade.基准工资标准 = grade.基准工资标准.ToString("c");
                        payRate_Grade.表工资标准  = grade.表工资标准.ToString("c");
                        payRate_Grade.设定工资标准 = grade.设定工资标准.ToString("c");
                        payRate_Grade.年休假工资  = grade.年休假工资.ToString("c");

                        list.Add(payRate_Grade);
                    }
                }
            }
            return(list);
        }
Beispiel #3
0
        public static string GetName(string setid, string salPlan, string gradeCode, int stepNumber)
        {
            SalaryStep stpe = 薪级表.Find(a => a.集合 == setid && a.薪酬体系 == salPlan && a.薪等编号 == gradeCode && a.薪级编号 == stepNumber);

            if (stpe == null)
            {
                return("");
            }
            else
            {
                return(stpe.薪级名称);
            }
        }
Beispiel #4
0
        public static SalaryStep AddSalaryStep(string setid, string salPlan, string grade, int step, DateTime effDate)
        {
            SalaryGrade salGrade = SalaryGrade.GetSalaryGrade(setid, salPlan, grade, effDate);

            if (salGrade != null)
            {
                SalaryStep plan = GetSalaryStep(salGrade.标识, step, effDate);
                if (plan == null)
                {
                    plan      = new SalaryStep();
                    plan.标识   = Guid.NewGuid();
                    plan.薪等标识 = salGrade.标识;
                    plan.薪级编号 = step;
                    plan.生效日期 = effDate;
                    plan.创建时间 = DateTime.Now;
                    plan.Save();
                }
                return(plan);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 通过 Id 获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static SalaryStep GetSalaryStep(Guid id)
        {
            SalaryStep obj = (SalaryStep)MyHelper.XpoSession.GetObjectByKey(typeof(SalaryStep), id);

            return(obj);
        }
Beispiel #6
0
 public static SalaryStep GetLastEffectiveSalaryStep(SalaryStep step)
 {
     return(GetEffectiveSalaryStep(step.薪等.标识, step.薪级编号, DateTime.Today));
 }