/// <summary> /// 通过账号ID,时间范围得到相应的加班,外出,请假情况,包括未审核的,转化为员工的日考勤列表返回 /// </summary> /// <param name="accountID"></param> /// <param name="fromDate"></param> /// <param name="toDate"></param> /// <returns></returns> public List <DayAttendance> GetAllCalendarByEmployee(int accountID, DateTime fromDate, DateTime toDate) { List <DayAttendance> iRet = new List <DayAttendance>(); //找出所有符合条件的请假单及其符合条件的子项 List <LeaveRequest> LeaveRequest = GetLeaveRequestByAccountAndRelatedDate(accountID, fromDate, toDate); foreach (LeaveRequest request in LeaveRequest) { foreach (LeaveRequestItem item in request.LeaveRequestItems) { CalculateCostHour cal = new CalculateCostHour(item.FromDate, item.ToDate, item.Status, accountID, request.LeaveRequestType.LeaveRequestTypeID); cal.Excute(); iRet.AddRange(cal.DayAttendanceList); } } return(iRet); }
/// <summary> /// 通过账号ID,时间范围得到相应的加班,外出,请假情况,转化为员工的日考勤列表返回 /// </summary> /// <param name="accountID"></param> /// <param name="fromDate"></param> /// <param name="toDate"></param> /// <returns></returns> public List <DayAttendance> GetCalendarByEmployee(int accountID, DateTime fromDate, DateTime toDate) { List <DayAttendance> iRet = new List <DayAttendance>(); #region 找出所有符合条件的请假单及其符合条件的子项 //0 新增;1 提交;2 审核不通过;3 审核通过;4 取消请假;5 拒绝取消假期;6 批准取消假期;7 审核中;8 审核取消中 //根据账号找出所有审核通过、取消请假、拒绝取消假期、审核取消中的请假单 List <LeaveRequest> LeaveRequest = _DalLeaveRequest.GetLeaveRequestByAccountIDForCalendar(accountID); foreach (LeaveRequest request in LeaveRequest) { DateTime fromDt = Convert.ToDateTime("1900-1-1"); if (request.FromDate != null) { fromDt = Convert.ToDateTime(request.FromDate); } DateTime toDt = Convert.ToDateTime("2999-12-31"); if (request.FromDate != null) { toDt = Convert.ToDateTime(request.ToDate); } //判断这张请假单是否在时间范围内 if (AdjustTime(fromDt, toDt, fromDate, toDate)) { List <LeaveRequestItem> leaveRequestItemList = new List <LeaveRequestItem>(); foreach (LeaveRequestItem item in request.LeaveRequestItems) { //判断子项是否在时间范围内 if (AdjustTime(item.FromDate, item.ToDate, fromDate, toDate)) { //如果是取消或是审核取消中的,判断是否曾经审核通过过 if (item.Status.Id == RequestStatus.Cancelled.Id || item.Status.Id == RequestStatus.CancelApproving.Id) { if (AdjustIfApprovePass(item)) { leaveRequestItemList.Add(item); } } else { leaveRequestItemList.Add(item); } } } request.LeaveRequestItems = leaveRequestItemList; } } #endregion foreach (LeaveRequest request in LeaveRequest) { foreach (LeaveRequestItem item in request.LeaveRequestItems) { CalculateCostHour cal = new CalculateCostHour(item.FromDate, item.ToDate, accountID, request.LeaveRequestType.LeaveRequestTypeID); cal.Excute(); iRet.AddRange(cal.DayAttendanceList); } } return(iRet); }