コード例 #1
0
        public async Task <IEnumerable <AlunoSondagemMatematicaDto> > ObterListagemAutoral(FiltrarListagemMatematicaDTO filtrarListagemDto)
        {
            var listaSondagem = await ObterSondagemAutoralMatematica(filtrarListagemDto);

            var listaAlunos = await TurmaApi.GetAlunosNaTurma(Convert.ToInt32(filtrarListagemDto.CodigoTurma), filtrarListagemDto.AnoLetivo, _token);

            var alunos = listaAlunos.Where(x => x.CodigoSituacaoMatricula == 10 || x.CodigoSituacaoMatricula == 1 || x.CodigoSituacaoMatricula == 6 || x.CodigoSituacaoMatricula == 13 || x.CodigoSituacaoMatricula == 5).ToList();

            if (alunos == null || !alunos.Any())
            {
                throw new Exception($"Não encontrado alunos para a turma {filtrarListagemDto.CodigoTurma} do ano letivo {filtrarListagemDto.AnoLetivo}");
            }

            var listagem = new List <AlunoSondagemMatematicaDto>();

            if (listaSondagem.Count > 0)
            {
                MapearAlunosListagemMatematica(listagem, listaSondagem);
            }

            AdicionarAlunosEOL(filtrarListagemDto, alunos, listagem);
            return(listagem.OrderBy(x => x.NumeroChamada));
        }
コード例 #2
0
        public async Task <List <StudentPollPortuguese> > ListStudentPollPortuguese(ClassRoomFilter classRoom)
        {
            try
            {
                var liststudentPollPortuguese = new List <StudentPollPortuguese>();
                using (Contexts.SMEManagementContext db = new Contexts.SMEManagementContext())
                {
                    //Pega alunos daquela turma que possuem sondagem
                    // ADD ano letivo no where
                    var listStudentsPollPortuguese = db.PortuguesePolls.Where(x => x.classroomCodeEol == classRoom.classroomCodeEol).ToList();

                    // Pega alunos da API
                    // tratar se ppor um acaso retornar uma lista vazia
                    var studentsClassRoom = new ClassRoom();
                    // var listStudentsClassRoom = studentsClassRoom.MockListaChamada();
                    var endpointsAPI = new EndpointsAPI();

                    var turmApi = new TurmasAPI(endpointsAPI);

                    var listStudentsClassRoom = await turmApi.GetAlunosNaTurma(Convert.ToInt32(classRoom.classroomCodeEol), Convert.ToInt32(classRoom.schoolYear), _token);

                    listStudentsClassRoom = listStudentsClassRoom.Where(x => x.CodigoSituacaoMatricula == 1).ToList();
                    if (listStudentsClassRoom == null)
                    {
                        return(null);
                    }

                    foreach (var studentClassRoom in listStudentsClassRoom)
                    {
                        var studentDTO = new StudentPollPortuguese();
                        if (listStudentsPollPortuguese != null)
                        {
                            var studentPollPortuguese = listStudentsPollPortuguese.Where(x => x.studentCodeEol == studentClassRoom.CodigoAluno.ToString()).FirstOrDefault();
                            studentDTO.name             = studentClassRoom.NomeAluno;
                            studentDTO.studentCodeEol   = studentClassRoom.CodigoAluno.ToString();
                            studentDTO.sequenceNumber   = studentClassRoom.NumeroAlunoChamada.ToString();
                            studentDTO.classroomCodeEol = classRoom.classroomCodeEol;
                            studentDTO.schoolYear       = classRoom.schoolYear;
                            studentDTO.dreCodeEol       = classRoom.dreCodeEol;
                            studentDTO.schoolCodeEol    = classRoom.schoolCodeEol;
                            studentDTO.yearClassroom    = classRoom.yearClassroom;

                            if (studentPollPortuguese != null)
                            {
                                studentDTO.t1e = studentPollPortuguese.writing1B;
                                studentDTO.t1l = studentPollPortuguese.reading1B;
                                studentDTO.t2e = studentPollPortuguese.writing2B;
                                studentDTO.t2l = studentPollPortuguese.reading2B;
                                studentDTO.t3e = studentPollPortuguese.writing3B;
                                studentDTO.t3l = studentPollPortuguese.reading3B;
                                studentDTO.t4e = studentPollPortuguese.writing4B;
                                studentDTO.t4l = studentPollPortuguese.reading4B;
                            }

                            else
                            {
                                AddStudentPollPortuguese(studentDTO);
                            }

                            liststudentPollPortuguese.Add(studentDTO);
                        }
                    }
                }

                return(liststudentPollPortuguese.OrderBy(x => Convert.ToInt32(x.sequenceNumber)).ToList());
            }
            catch (Exception ex)
            {
                throw;
            }
        }