public async Task GerarPendenciasFechamento(long disciplinaId, Turma turma, PeriodoEscolar periodoEscolar, FechamentoTurmaDisciplina fechamento, Usuario usuarioLogado, bool componenteSemNota = false, bool registraFrequencia = true) { var situacaoFechamento = SituacaoFechamento.ProcessadoComSucesso; if (!componenteSemNota) { await servicoPendenciaFechamento.ValidarAvaliacoesSemNotasParaNenhumAluno(fechamento.Id, turma.CodigoTurma, disciplinaId, periodoEscolar.PeriodoInicio, periodoEscolar.PeriodoFim); await servicoPendenciaFechamento.ValidarPercentualAlunosAbaixoDaMedia(fechamento); await servicoPendenciaFechamento.ValidarAlteracaoExtemporanea(fechamento.Id, turma.CodigoTurma, fechamento.CriadoRF); } await servicoPendenciaFechamento.ValidarAulasReposicaoPendente(fechamento.Id, turma, disciplinaId, periodoEscolar.PeriodoInicio, periodoEscolar.PeriodoFim); await servicoPendenciaFechamento.ValidarAulasSemPlanoAulaNaDataDoFechamento(fechamento.Id, turma, disciplinaId, periodoEscolar.PeriodoInicio, periodoEscolar.PeriodoFim); if (registraFrequencia) { await servicoPendenciaFechamento.ValidarAulasSemFrequenciaRegistrada(fechamento.Id, turma, disciplinaId, periodoEscolar.PeriodoInicio, periodoEscolar.PeriodoFim); } var quantidadePendencias = servicoPendenciaFechamento.ObterQuantidadePendenciasGeradas(); if (quantidadePendencias > 0) { situacaoFechamento = SituacaoFechamento.ProcessadoComPendencias; await GerarNotificacaoFechamento(fechamento, turma, quantidadePendencias, usuarioLogado, periodoEscolar); } fechamento.AtualizarSituacao(situacaoFechamento); await repositorioFechamentoTurmaDisciplina.SalvarAsync(fechamento); }
private FechamentoTurmaDisciplina MapearParaEntidade(long id, FechamentoTurmaDisciplinaDto fechamentoDto) { var fechamento = new FechamentoTurmaDisciplina(); if (id > 0) { fechamento = repositorioFechamentoTurmaDisciplina.ObterPorId(id); } fechamento.AtualizarSituacao(SituacaoFechamento.EmProcessamento); fechamento.DisciplinaId = fechamentoDto.DisciplinaId; fechamento.Justificativa = fechamentoDto.Justificativa; return(fechamento); }