标题:希望前辈们帮我重构一下这段代码
只看楼主
hebaobao2000
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-5-27
结帖率:0
已结贴  问题点数:20 回复次数:1 
希望前辈们帮我重构一下这段代码
#region 计算考勤扣款(请假)
        /// <summary>
        /// 计算考勤扣款(请假)
        /// </summary>
        /// <param name="empLoyeeId">员工</param>
        /// <param name="basicCount">社保基数</param>
        /// <param name="incomeTax">个调税</param>
        /// <param name="bigillHelp">大病救助</param>
        /// <param name="salarySum">核定总额</param>
        /// <param name="baseSalalry">基本工资</param>
        /// <returns></returns>
        public decimal GetSequestrateMoney(Guid empLoyeeId, decimal basicCount, decimal incomeTax, decimal bigillHelp, decimal salarySum, decimal baseSalalry)
        {
            decimal money = 0M;
            if (this.EmployeeAppraiseReportList == null || this.EmployeeAppraiseReportList.Count < 0)
            {
                return money;
            }
            foreach (EmployeeAppraiseReportInfo employeeAppraiseReport in this.EmployeeAppraiseReportList)
            {
                DateTime startDate = employeeAppraiseReport.StartDate;
                DateTime endDate = employeeAppraiseReport.EndDate;

                List<Guid> emp = new PaymentConditionsService().GetEmpCompareDate(startDate, endDate);
                foreach (Guid userids in emp)
                {
                    if (!userids.Equals(employeeAppraiseReport.EmployeeId))
                    {
                        continue;
                    }
                }

                if (!empLoyeeId.Equals(employeeAppraiseReport.EmployeeId))
                {
                    continue;
                }

                foreach (MicroCodeItemInfo micLevaeInfoitem in this.LevaeItemList)
                {
                    if (!employeeAppraiseReport.LeaveTimeDic.ContainsKey(micLevaeInfoitem.CodeItemValue) || employeeAppraiseReport.LeaveTimeDic[micLevaeInfoitem.CodeItemValue] <= 0)
                    {
                        continue;
                    }

                    CheckOnSetExpressionInfo checkonset = PaymentConditionsService.GetCheckonsetInfoByLeave(this.CheckOnSetList, AppraiseItem.Leave, micLevaeInfoitem.CodeItemValue);
                    if (checkonset == null)
                    {
                        continue;
                    }
                    decimal hours = CommonFun.StrToDecimal(employeeAppraiseReport.LeaveTimeDic[micLevaeInfoitem.CodeItemValue].ToString());//得到每种请假的小时

                    money += new CreateSalaryService().GetSalaryCheckoOnMoneyByLeaveOrOverTime(salarySum
                        , baseSalalry
                        , PaymentConditionsService.CheckDays(createOn)
                        , PaymentConditionsService.CheckDaysWithoutWeekend(createOn)
                        , GetPreWorkTime(empLoyeeId)
                        , basicCount
                        , incomeTax
                        , bigillHelp
                        , GetActualWorkTime(empLoyeeId)
                        , checkonset) * hours;
                }
                break;
            }
            return money;
        }

        #endregion

        #region 计算旷工
        /// <summary>
        /// 计算旷工
        /// </summary>
        /// <param name="empLoyeeId">员工</param>
        /// <param name="basicCount">社保基数</param>
        /// <param name="incomeTax">个调税</param>
        /// <param name="bigillHelp">大病救助</param>
        /// <param name="salarySum">核定总额</param>
        /// <param name="baseSalalry">基本工资</param>
        /// <returns></returns>
        public decimal GetAbsenceMoney(Guid empLoyeeId, decimal basicCount, decimal incomeTax, decimal bigillHelp, decimal salarySum, decimal baseSalalry)
        {
            decimal money = 0M;
            if (this.EmployeeAppraiseReportList == null || this.EmployeeAppraiseReportList.Count < 0)
            {
                return money;
            }
            foreach (EmployeeAppraiseReportInfo employeeAppraiseReport in this.EmployeeAppraiseReportList)
            {
                DateTime startDate = employeeAppraiseReport.StartDate;
                DateTime endDate = employeeAppraiseReport.EndDate;

                List<Guid> emp = new PaymentConditionsService().GetEmpCompareDate(startDate, endDate);

                foreach (Guid userids in emp)
                {
                    if (!userids.Equals(employeeAppraiseReport.EmployeeId))
                    {
                        continue;
                    }
                }

                if (!empLoyeeId.Equals(employeeAppraiseReport.EmployeeId))
                {
                    continue;
                }
                decimal hours = CommonFun.StrToDecimal(employeeAppraiseReport.AbsenceTime.ToString());//旷工时间

                money = new CreateSalaryService().GetSalaryCheckoOnMoney(salarySum
                    , baseSalalry
                    , PaymentConditionsService.CheckDays(createOn)
                    , PaymentConditionsService.CheckDaysWithoutWeekend(createOn)
                    , GetPreWorkTime(empLoyeeId)
                    , basicCount
                    , incomeTax
                    , bigillHelp
                    , GetActualWorkTime(empLoyeeId)
                    , (int)AppraiseItem.Absence) * hours;
                break;
            }
            return money;
        }
        #endregion
搜索更多相关主题的帖子: returns public 社保 
2014-05-27 18:50
wangnannan
Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18
等 级:贵宾
威 望:87
帖 子:2545
专家分:9359
注 册:2007-11-3
得分:20 
你看看 代码重构 或者代码的艺术 这类书吧 我也不会

出来混,谁不都要拼命的嘛。 。拼不赢?那就看谁倒霉了。 。有机会也要看谁下手快,快的就能赢,慢。 。狗屎你都抢不到。 。还说什么拼命?
2014-05-28 08:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-432151-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.090339 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved