Exemplo n.º 1
0
        public async Task <List <int> > SelectResources(SelectEmployees emp)
        {
            var empTask = await _context.Tasks.ToListAsync();

            var IdList = new List <int>();

            if (empTask?.Any() == true)
            {
                foreach (var task in empTask)
                {
                    if (((emp.StartDate >= task.StartDate) && (emp.StartDate <= task.EndDate)) || ((emp.EndDate >= task.StartDate) && (emp.EndDate <= task.EndDate)) || ((emp.StartDate <= task.StartDate) && (emp.EndDate >= task.EndDate)))
                    {
                        IdList.Add(task.EmployeesId);
                    }
                }
            }

            return(IdList);
        }
Exemplo n.º 2
0
        public async Task <List <int> > SelectEmployees(SelectEmployees emp)
        {
            var empTask = await _context.Tasks.ToListAsync();

            var employees = await _context.Employees.Where(x => x.PMId == emp.ProjectManagerId).ToListAsync();

            var IdList = new List <int>();

            if (empTask?.Any() == true)
            {
                foreach (var task in empTask)
                {
                    if (((emp.StartDate >= task.StartDate) && (emp.StartDate <= task.EndDate)) || ((emp.EndDate >= task.StartDate) && (emp.EndDate <= task.EndDate)) || ((emp.StartDate <= task.StartDate) && (emp.EndDate >= task.EndDate)))
                    {
                        IdList.Add(task.EmployeesId);
                    }
                }
            }
            var list = employees.Where(x => !IdList.Contains(x.EmpId)).Select(y => y.EmpId).ToList();

            return(list);
        }