Beispiel #1
0
        public List <int> GetEmpIdList(string ConnectionString, SendFormPageVM model, string Culture)
        {
            HrUnitOfWork unitofwork = new HrUnitOfWork(new HrContextFactory(ConnectionString));

            List <int> EmpIdList = new List <int>();

            //Get Employees in the department
            if (model.Departments != null)
            {
                var EmployeesListByDept = unitofwork.EmployeeRepository.GetActiveEmployees(Culture, 0, model.CompanyId)
                                          .Where(e => model.Departments.Contains((int)e.DepartmentId))
                                          .Select(e => new { id = e.Id }).ToList();
                foreach (var item in EmployeesListByDept)
                {
                    EmpIdList.Add(item.id);
                }
            }


            //Get Employees in the job
            if (model.Jobs != null)
            {
                var EmployeesListByJob = unitofwork.EmployeeRepository.GetActiveEmployees(Culture, 0, model.CompanyId)
                                         .Where(e => model.Jobs.Contains((int)e.JobId))
                                         .Select(e => new { id = e.Id }).ToList();
                foreach (var item in EmployeesListByJob)
                {
                    EmpIdList.Add(item.id);
                }
            }

            if (model.Employees != null)
            {
                EmpIdList.AddRange(model.Employees);
            }

            return(EmpIdList);
        }