public async Task <RetornoInfoPerfilDTO> GetProfileEmployeeInformation(string codeRF, string codeOccupations, string schoolYear, Guid?Perfil, string roleName = null) { try { var endPoint = new EndpointsAPI(); var profileApi = new PerfilSgpAPI(endPoint); var parseado = int.TryParse(codeOccupations, out int result); var profileInformation = new RetornoInfoPerfilDTO(); // Para coordenador pedagógico, assitente de diretor, diretor busca a abrangência no SGP if (!string.IsNullOrWhiteSpace(roleName) && (roleName.Equals("CP") || roleName.Equals("AD") || roleName.Equals("Diretor"))) { profileInformation = await ObterAbrangencia(codeRF, null, profileInformation); } else { profileInformation = await profileApi .getInformacoesPerfil(codeRF, parseado?result : 0, int.Parse(schoolYear), _token, Perfil); } if (profileInformation != null) { return(profileInformation); } else { return(null); } } catch (System.Exception ex) { return(null); } }
public async Task <IEnumerable <AlunosNaTurmaDTO> > ObterAlunosEOL(string schoolYear, string codigoTurmaEol, string term) { filtrosRelatorioDTO filtro = new filtrosRelatorioDTO() { AnoLetivo = int.Parse(schoolYear), PeriodoId = "" }; using (var contexto = new SMEManagementContextData()) { var periodo = contexto.Periodo.Where(x => x.Descricao == term).FirstOrDefault(); filtro.PeriodoId = periodo.Id; } var periodos = await ConsultaTotalDeAlunos.BuscaDatasPeriodoFixoAnual(filtro); if (periodos.Count() == 0) { throw new Exception("Período fixo anual não encontrado"); } var endpoits = new EndpointsAPI(); var alunoApi = new AlunosAPI(endpoits); return((await alunoApi.ObterAlunosAtivosPorTurmaEPeriodo(codigoTurmaEol, periodos.First().DataFim)).OrderBy(a => a.NomeAluno)); }
public static async Task <int> BuscaTotalDeAlunosEOl(filtrosRelatorioDTO filtro) { var DatasPeriodo = await BuscaDatasPeriodoFixoAnual(filtro); if (DatasPeriodo.Count() == 0) { return(0); } var endpointsApi = new EndpointsAPI(); var alunoApi = new AlunosAPI(endpointsApi); var filtroAlunos = new FiltroTotalAlunosAtivos() { AnoLetivo = filtro.AnoLetivo, AnoTurma = filtro.AnoEscolar, DreId = filtro.CodigoDre, UeId = filtro.CodigoUe, DataInicio = DatasPeriodo.First().DataInicio, DataFim = DatasPeriodo.First().DataFim }; var totalDeAlunos = await alunoApi.ObterTotalAlunosAtivosPorPeriodo(filtroAlunos); return(totalDeAlunos); }
public async Task <List <EscolasPorDREDTO> > GetListSchoolDre(string dreCodeEol, string schooYear) { try { var endPoint = new EndpointsAPI(); var schoolApi = new DREAPI(endPoint); var listSchools = await schoolApi.GetEscolasPorDRE(dreCodeEol, _token); if (listSchools != null) { return(listSchools); } else { return(null); } } catch (System.Exception ex) { throw ex; } }
public async Task <RetornoInfoPerfilDTO> GetProfileEmployeeInformation(string codeRF, string codeOccupations, string schoolYear) { try { var endPoint = new EndpointsAPI(); var profileApi = new PerfilSgpAPI(endPoint); var profileInformation = await profileApi.getInformacoesPerfil(codeRF, int.Parse(codeOccupations), int.Parse(schoolYear), _token); if (profileInformation != null) { return(profileInformation); } else { return(null); } } catch (System.Exception ex) { return(null); } }
public async Task <List <DREsDTO> > GetListDre() { try { var endPoint = new EndpointsAPI(); var dreApi = new DREAPI(endPoint); var listDres = await dreApi.GetDres(_token); if (listDres != null) { return(listDres); } else { return(null); } } catch (System.Exception ex) { throw ex; } }
public async Task <List <SalasPorUEDTO> > GetListClassRoomSchool(string schoolCodeEol, string schooYear) { try { var endPoint = new EndpointsAPI(); var schoolApi = new EscolasAPI(endPoint); var listClassRoom = await schoolApi.GetTurmasPorEscola(int.Parse(schoolCodeEol), schooYear, _token); if (listClassRoom != null) { return(listClassRoom); } else { return(null); } } catch (System.Exception ex) { throw ex; } }
public async Task <List <SalasPorUEDTO> > GetListClassRoomSchool(string schoolCodeEol, string schooYear) { try { var endPoint = new EndpointsAPI(); var schoolApi = new EscolasAPI(endPoint); var eolCodeParseado = int.TryParse(schoolCodeEol, out int result); var listClassRoom = await schoolApi.GetTurmasPorEscola(eolCodeParseado?result : 0, schooYear, _token); if (listClassRoom != null) { return(listClassRoom.OrderBy(x => x.NomeTurma).ToList()); } else { return(null); } } catch (System.Exception ex) { throw ex; } }
public DREAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI; }
public FuncionariosAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI; }
public CargosAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI; }
public PerfilSgpAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI; }
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; } }
public ProfessoresAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI; }
public AbrangenciaAPI() { endpointsAPI = new EndpointsAPI(); }
public AlunosAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI ?? throw new ArgumentNullException(nameof(endpointsAPI)); }
public async Task <RelatorioMatematicaPorTurmaDTO> ObterRelatorioPorTurma(filtrosRelatorioDTO filtro) { IncluiIdDoComponenteCurricularEhDoPeriodoNoFiltro(filtro); var periodos = await ConsultaTotalDeAlunos.BuscaDatasPeriodoFixoAnual(filtro); if (periodos.Count() == 0) { throw new Exception("Periodo fixo anual nao encontrado"); } var endpoits = new EndpointsAPI(); var alunoApi = new AlunosAPI(endpoits); var alunosEol = await alunoApi.ObterAlunosAtivosPorTurmaEPeriodo(filtro.CodigoTurmaEol, periodos.First().DataFim); var QueryAlunosRespostas = ConsultasRelatorios.QueryRelatorioPorTurmaMatematica(); var listaAlunoRespostas = await RetornaListaRespostasAlunoPorTurma(filtro, QueryAlunosRespostas); var AlunosAgrupados = listaAlunoRespostas.GroupBy(x => x.CodigoAluno); var relatorio = new RelatorioMatematicaPorTurmaDTO(); await RetornaPerguntasDoRelatorio(filtro, relatorio); var ListaAlunos = new List <AlunoPorTurmaRelatorioDTO>(); alunosEol.ForEach(alunoRetorno => { var aluno = new AlunoPorTurmaRelatorioDTO(); aluno.CodigoAluno = alunoRetorno.CodigoAluno; aluno.NomeAluno = alunoRetorno.NomeAlunoRelatorio; aluno.Perguntas = new List <PerguntaRespostaPorAluno>(); var alunoRespostas = AlunosAgrupados.Where(x => x.Key == aluno.CodigoAluno.ToString()).ToList(); foreach (var perguntaBanco in relatorio.Perguntas) { var pergunta = new PerguntaRespostaPorAluno() { Id = perguntaBanco.Id, Valor = string.Empty }; var respostaAluno = listaAlunoRespostas.Where(x => x.PerguntaId == perguntaBanco.Id && x.CodigoAluno == aluno.CodigoAluno.ToString()).FirstOrDefault(); if (respostaAluno != null) { pergunta.Valor = respostaAluno.RespostaDescricao; } aluno.Perguntas.Add(pergunta); } ListaAlunos.Add(aluno); }); relatorio.Alunos = ListaAlunos.OrderBy(aluno => aluno.NomeAluno); relatorio.Graficos = new List <GraficosRelatorioDTO>(); using (var contexto = new SMEManagementContextData()) { var perguntasBanco = await contexto.PerguntaResposta.Include(x => x.Pergunta).Include(y => y.Resposta).Where(pr => relatorio.Perguntas.Any(p => p.Id == pr.Pergunta.Id)).ToListAsync(); foreach (var pergunta in relatorio.Perguntas) { var grafico = new GraficosRelatorioDTO(); grafico.nomeGrafico = pergunta.Nome; grafico.Barras = new List <BarrasGraficoDTO>(); var listaRespostas = perguntasBanco.Where(x => x.Pergunta.Id == pergunta.Id).ToList(); listaRespostas.ForEach(resposta => { var barra = new BarrasGraficoDTO(); barra.label = resposta.Resposta.Descricao; barra.value = relatorio.Alunos.Count(x => x.Perguntas.Any(r => r.Id == pergunta.Id && r.Valor == resposta.Resposta.Descricao)); grafico.Barras.Add(barra); }); var barraAlunosSemPreenchimento = new BarrasGraficoDTO(); barraAlunosSemPreenchimento.label = "Sem Preenchimento"; barraAlunosSemPreenchimento.value = relatorio.Alunos.Count() - grafico.Barras.Sum(x => x.value); grafico.Barras.Add(barraAlunosSemPreenchimento); relatorio.Graficos.Add(grafico); } } return(relatorio); }
public TurmasAPI(EndpointsAPI endpointsAPI) { this.endpointsAPI = endpointsAPI; }