| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1493 人关注过本帖
标题:希望前辈们帮我重构一下这段代码
只看楼主 加入收藏
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
帖 子:2546
专家分:9359
注 册:2007-11-3
收藏
得分:20 
你看看 代码重构 或者代码的艺术 这类书吧 我也不会

出来混,谁不都要拼命的嘛。 。拼不赢?那就看谁倒霉了。 。有机会也要看谁下手快,快的就能赢,慢。 。狗屎你都抢不到。 。还说什么拼命?
2014-05-28 08:32
快速回复:希望前辈们帮我重构一下这段代码
数据加载中...
 
   



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

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