Ejemplo n.º 1
0
        public async Task <GroupedChartDataDto> GetTotalConcludedTasksByDate()
        {
            GroupedChartDataDto result = null;

            var tasks = await taskRepository.GetAll();

            if (tasks == null || !tasks.Any())
            {
                return(result);
            }

            result = new GroupedChartDataDto();
            if (tasks.Any())
            {
                result.Name   = "Total de Tarefas Concluída Por Data";
                result.Series = new List <ChartDataDto>();
                foreach (var item in tasks.Where(x => x.ConcludedDate.HasValue)
                         .OrderByDescending(x => x.CreatedDate.Date)
                         .GroupBy(g => g.ConcludedDate.Value.Date))
                {
                    result.Series.Add(new ChartDataDto
                    {
                        Name  = item.Key.ToString("dd/MM/yyyy"),
                        Value = item.Count()
                    });
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <GroupedChartDataDto> > GetOpenAndOnGoingTasksByPersonInProject(Guid projectId)
        {
            List <GroupedChartDataDto> result = new List <GroupedChartDataDto>();

            var project = await projectRepository.GetProjectById(projectId);

            if (project == null)
            {
                return(result);
            }

            foreach (var item in project.Tasks.GroupBy(g => g.AttendantId))
            {
                var data = new GroupedChartDataDto
                {
                    Name = $"{item.First().Attendant.FirstName} {item.First().Attendant.LastName}"
                };

                data.Series = new List <ChartDataDto>
                {
                    new ChartDataDto {
                        Name = "Abertas", Value = item.Where(x => x.StatusId != 4).Count()
                    },
                    new ChartDataDto {
                        Name = "Concluídas", Value = item.Where(x => x.StatusId == 4).Count()
                    }
                };

                result.Add(data);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <GroupedChartDataDto> > GetNewAndClosedTasksByDateByProject(Guid projectId)
        {
            List <GroupedChartDataDto> result = new List <GroupedChartDataDto>();

            var project = await projectRepository.GetProjectById(projectId);

            if (project == null)
            {
                return(result);
            }

            var closedTasks = new GroupedChartDataDto()
            {
                Name = "Tarefas Fechadas"
            };

            closedTasks.Series = new List <ChartDataDto>();
            foreach (var item in project.Tasks.Where(x => x.ConcludedDate.HasValue).GroupBy(g => g.ConcludedDate.Value.Date))
            {
                closedTasks.Series.Add(new ChartDataDto {
                    Name = item.Key.ToString("dd/MM/yyyy"), Value = item.Count()
                });
            }
            result.Add(closedTasks);

            var newTasks = new GroupedChartDataDto()
            {
                Name = "Novas Tarefas"
            };

            newTasks.Series = new List <ChartDataDto>();
            foreach (var item in project.Tasks.GroupBy(g => g.CreatedDate.Date))
            {
                newTasks.Series.Add(new ChartDataDto {
                    Name = item.Key.ToString("dd/MM/yyyy"), Value = item.Count()
                });
            }
            result.Add(newTasks);

            return(result);
        }
Ejemplo n.º 4
0
        public async Task <GroupedChartDataDto> GetTotalCreatedProjectsByDate()
        {
            GroupedChartDataDto result = new GroupedChartDataDto();

            var projects = await projectRepository.GetAll();

            if (projects != null && projects.Any())
            {
                result.Name   = "Total de Projetos Criados Por Data";
                result.Series = new List <ChartDataDto>();
                foreach (var item in projects.OrderByDescending(x => x.CreatedDate.Date)
                         .GroupBy(g => g.CreatedDate.Date))
                {
                    result.Series.Add(new ChartDataDto
                    {
                        Name  = item.Key.ToString("dd/MM/yyyy"),
                        Value = item.Count()
                    });
                }
            }

            return(result);
        }
Ejemplo n.º 5
0
        public async Task <GroupedChartDataDto> GetCreatedUsers()
        {
            GroupedChartDataDto result = new GroupedChartDataDto();

            var users = await userRepository.GetAll();

            if (users.Any())
            {
                result.Name   = "Usuários Criados Por Data";
                result.Series = new List <ChartDataDto>();
                foreach (var item in users.OrderBy(x => x.CreatedDate.Value.Date)
                         .GroupBy(x => x.CreatedDate.Value.Date))
                {
                    result.Series.Add(new ChartDataDto
                    {
                        Name  = item.Key.ToString("dd/MM/yyyy"),
                        Value = item.Count()
                    });
                }
            }

            return(result);
        }