public void BindData(List <Employee> employeesource, EmployeeComeAndLeave employeeComeAndLeave) { _IOtherStatisticsDataView.EmployeeComeAndLeave = employeeComeAndLeave ?? _IEmployeeStatisticsFacade. ComeAndLeaveStatisticsOnlyOneMonth( Convert.ToDateTime( _IStatisticsConditionView.StatisticsTime), _IStatisticsConditionView.DepartmentID, _Operator); _IOtherStatisticsDataView.EmployeeResidencePermitStatistics = _IEmployeeStatisticsFacade.ResidenceStatistics( Convert.ToDateTime(_IStatisticsConditionView.StatisticsTime), _IStatisticsConditionView.DepartmentID, _Operator, employeesource); _IOtherStatisticsDataView.EmployeeVacationStatistics = _IEmployeeStatisticsFacade.VocationStatistics( Convert.ToDateTime(_IStatisticsConditionView.StatisticsTime), _IStatisticsConditionView.DepartmentID, _Operator, employeesource); }
/// <summary> /// 统计人员流动情况 /// </summary> /// <param name="dt">统计时间,以该时间为基准,统计包括该月在内的近一年的情况</param> /// <param name="departmentID">部门编号</param> /// <returns>到统计时间为止,近一年的人员流动情况</returns> /// <param name="accountoperator"></param> /// <param name="endDtEmployeeList">可以为null</param> /// <param name="outEndDtEmployeeList">可以为null</param> /// <param name="allEmployeeSource">可以为null</param> public EmployeeComeAndLeave ComeAndLeaveStatisticsOnlyOneMonth(DateTime dt, int departmentID, Account accountoperator, List <Employee> endDtEmployeeList, out List <Employee> outEndDtEmployeeList, List <Employee> allEmployeeSource) { allEmployeeSource = allEmployeeSource ?? new GetEmployee().GetAllEmployeeBasicInfo(); dt = new DateTime(dt.Year, dt.Month, 1); //定位到dt当月第一天,如2009-3-1 DateTime lastMonthlastDate = dt.AddDays(-1); //上个月最后一天 DateTime thisMonthlastDate = dt.AddMonths(1).AddDays(-1); //这个月最后一天 List <Employee> startDtEmployeeList = endDtEmployeeList ?? _BllEmployeeHistory.GetEmployeeOnDutyByDepartmentAndDateTime(departmentID, lastMonthlastDate, true, accountoperator, HrmisPowers.A405, allEmployeeSource); endDtEmployeeList = //此值要被带入下一个循环中 _BllEmployeeHistory.GetEmployeeOnDutyByDepartmentAndDateTime(departmentID, thisMonthlastDate, true, accountoperator, HrmisPowers.A405, allEmployeeSource); EmployeeComeAndLeave employeeComeAndLeave = new EmployeeComeAndLeave(lastMonthlastDate.AddDays(1), startDtEmployeeList, endDtEmployeeList); outEndDtEmployeeList = endDtEmployeeList; return(employeeComeAndLeave); }
/// <summary> /// 统计人员流动情况 /// </summary> /// <param name="dt">统计时间,以该时间为基准,统计包括该月在内的近一年的情况</param> /// <param name="departmentID">部门编号</param> /// <returns>到统计时间为止,近一年的人员流动情况</returns> /// <param name="accountoperator"></param> public List <EmployeeComeAndLeave> ComeAndLeaveStatistics(DateTime dt, int departmentID, Account accountoperator) { List <Employee> allEmployeeSource = new GetEmployee().GetAllEmployeeBasicInfo(); List <EmployeeComeAndLeave> employeeComeAndLeaveList = new List <EmployeeComeAndLeave>(); dt = new DateTime(dt.Year, dt.Month, 1); //定位到dt当月第一天,如2009-3-1 List <Employee> endDtEmployeeList = null; for (int i = 11; i >= 0; i--) //从前面第11个月开始计算 { DateTime thisMonthlastDate = dt.AddMonths(-i).AddMonths(1).AddDays(-1); //这个月最后一天 List <Employee> outEndDtEmployeeList; EmployeeComeAndLeave employeeComeAndLeave = ComeAndLeaveStatisticsOnlyOneMonth(thisMonthlastDate, departmentID, accountoperator, endDtEmployeeList, out outEndDtEmployeeList, allEmployeeSource); endDtEmployeeList = outEndDtEmployeeList;//为了支持ComeAndLeaveStatisticsOnlyOneMonth被单独调用,且endDtEmployeeList不要重复读取数据 //endDtEmployeeList 此值要被带入下一个循环中 employeeComeAndLeaveList.Add(employeeComeAndLeave); } return(employeeComeAndLeaveList); }