示例#1
0
        /// <summary>
        /// 获得_StartDt-_EndDt时刻在departmentID中离退的人员
        /// </summary>
        /// <returns></returns>
        public List <Employee> LeaveEmployees(DateTime startDt, DateTime endDt, int departmentID, bool onlyBasicInfo, bool recursionDepartment)
        {
            List <Department> departmentList = new List <Department>();

            departmentList.Add(new Department(departmentID, ""));
            departmentList = recursionDepartment
                                 ? getDepartmentHistory.GetDepartmentListStructByDepartmentIDAndDateTime(departmentID,
                                                                                                         endDt)
                                 : departmentList;
            List <Employee> retEmployeeList = new List <Employee>();
            List <Employee> employeeList    = onlyBasicInfo
                                                ? getEmployee.GetAllEmployeeBasicInfo()
                                                : getEmployee.GetAllEmployee();

            for (int i = 0; i < employeeList.Count; i++)
            {
                //判断此时段内离职
                if (!employeeList[i].IsLeaveInTheTime(startDt, endDt))
                {
                    continue;
                }
                //判断是否在departmentID里离职的//todo wsl 是否离职在当前部门中的判断会有缺陷
                if (Department.FindDepartmentInTreeStruct(departmentList, employeeList[i].Account.Dept.Id) == null)
                {
                    continue;
                }
                retEmployeeList.Add(employeeList[i]);
            }
            return(retEmployeeList);
        }
        ///<summary>
        ///</summary>
        public void Excute()
        {
            //得到所有员工
            List <Employee> allEmployeeList = getEmployee.GetAllEmployeeBasicInfo();

            //如果是每年生成年假的固定日期
            if (_Date.Month == _CreateAnnualHolidayMonth && _Date.Day == _CreateAnnualHolidayDay)
            {
                CreateAllVacation(allEmployeeList);
            }
            else //找出试用期结束的员工生成第一年年假
            {
                CreatePartVacation(allEmployeeList);
            }
        }