/// <summary> /// 获取出勤人员的信息 /// </summary> /// <param name="year"></param> /// <param name="month"></param> /// <returns></returns> private List <AttendSlodWorkerModel> GetAttendSlodWorkers(int year, int month) { List <AttendSlodWorkerModel> attendSlodWorkers = null; AttendSlodWorkerModel aswMdl = null; int days = DateTime.DaysInMonth(year, month); DateTime dtStart = new DateTime(year, month, 1, 0, 0, 0); DateTime dtEnd = new DateTime(year, month, days, 0, 0, 0); //获取离职人员信息 List <LeaveOfficeMapEntity> LeavedWorkers = ArchiveService.ArchivesManager.LeaveOffManager.GetLeavedWorkers(dtStart, dtEnd); attendSlodWorkers = this.ConvertToAttendWorkerList(LeavedWorkers, aswMdl, dtStart, dtEnd, true); List <LeaveOfficeMapEntity> WorkingWorkers = ArchiveService.ArchivesManager.GetAttendWorkers(); if (attendSlodWorkers != null) { //合并在职人员信息 attendSlodWorkers.AddRange(this.ConvertToAttendWorkerList(WorkingWorkers, aswMdl, dtStart, dtEnd, false)); } return(attendSlodWorkers); }
private List <AttendSlodWorkerModel> ConvertToAttendWorkerList(List <LeaveOfficeMapEntity> attendWorkers, AttendSlodWorkerModel aswMdl, DateTime dtStart, DateTime dtEnd, bool isLeave) { List <AttendSlodWorkerModel> attendSlodWorkerList = new List <AttendSlodWorkerModel>(); if (attendWorkers != null && attendWorkers.Count > 0) { attendWorkers.ForEach(worker => { aswMdl = new Attendance.AttendSlodWorkerModel() { WorkerId = worker.WorkerId, WorkerName = worker.WorkerName, Department = worker.Department, AttendDateStart = dtStart, AttendDateEnd = isLeave == true ? worker.LeaveDate.AddDays(-1) : dtEnd }; attendSlodWorkerList.Add(aswMdl); }); } return(attendSlodWorkerList); }