Example #1
0
        public ActionResult Grafico(int?pIdVisao, string pGrafico)
        {
            int idVisao = pIdVisao ??
                          (db.Tr_CabViscao.Count(x => x.CAB_STATUS == (int)Enums.Ativo.Liberado) > 0 ? db.Tr_CabViscao.Where(x => x.CAB_STATUS != (int)Enums.Ativo.EmEdicao).FirstOrDefault().CAB_ID : 0);

            //Defini layout
            #region ViewDataLayout
            ViewData["body_class"]        = "sidebar-collapse";
            ViewData["pagetopbar_class"]  = "sidebar_shift";
            ViewData["pagesidebar_class"] = "collapseit";
            #endregion ViewDataLayout

            #region ViewBags
            ViewBag.pIdVisao = new SelectList(db.Tr_CabViscao.Where(x => x.CAB_STATUS == (int)SGI.Enums.Ativo.Liberado), "CAB_ID", "CAB_DESC", idVisao);
            #endregion ViewBags
            var dre = new Dre();
            //Busca dados da DRE
            dre.Tr_Visoes = db.Tr_Visoes.ToList();
            dre.DreView   = Util.ExtratorDre.DrePadrao(idVisao, "2017");

            //Busca unidade de medida
            #region AgrupaUnidades
            var uniAgrupadas   = dre.DreView.Select(x => new { x.MOV_UNID, x.UNI_DESCRICAO }).GroupBy(x => new { UNI_ID = x.MOV_UNID, UNI_DESCRICAO = x.UNI_DESCRICAO }).ToList();
            var uniLocalizadas = db.Tr_Unidade.ToList();
            dre.Unidades = uniLocalizadas.Where(x => uniAgrupadas.Any(j => j.Key.UNI_ID == x.UNI_ID)).ToList();
            #endregion AgrupaUnidades
            return(View(dre));
        }
 public MontarHistoricoEscolarQuery(Dre dre, Ue ue, IEnumerable <AreaDoConhecimento> areasConhecimento,
                                    IEnumerable <IGrouping <string, ComponenteCurricularPorTurma> > componentesCurricularesTurmas,
                                    IEnumerable <AlunoTurmasHistoricoEscolarDto> alunosTurmas,
                                    IEnumerable <MediaFrequencia> mediasFrequencia,
                                    IEnumerable <IGrouping <string, NotasAlunoBimestre> > notas,
                                    IEnumerable <IGrouping <string, FrequenciaAluno> > frequencias,
                                    IEnumerable <TipoNotaCicloAno> tiposNota,
                                    IEnumerable <TransferenciaDto> transferencias,
                                    string[] turmasCodigo, CabecalhoDto cabecalho, LegendaDto legenda,
                                    DadosDataDto dadosData, FuncionarioDto dadosDiretor, FuncionarioDto dadosSecretario,
                                    IEnumerable <IGrouping <long, UeConclusaoPorAlunoAno> > historicoUes,
                                    bool preencherDataImpressao, bool imprimirDadosResponsaveis)
 {
     Dre = dre;
     Ue  = ue;
     AreasConhecimento             = areasConhecimento;
     ComponentesCurricularesTurmas = componentesCurricularesTurmas;
     AlunosTurmas              = alunosTurmas;
     TurmasCodigo              = turmasCodigo;
     Cabecalho                 = cabecalho;
     HistoricoUes              = historicoUes;
     Notas                     = notas;
     Frequencias               = frequencias;
     MediasFrequencia          = mediasFrequencia;
     TiposNota                 = tiposNota;
     Transferencias            = transferencias;
     Legenda                   = legenda;
     DadosData                 = dadosData;
     DadosDiretor              = dadosDiretor;
     DadosSecretario           = dadosSecretario;
     PreencherDataImpressao    = preencherDataImpressao;
     ImprimirDadosResponsaveis = imprimirDadosResponsaveis;
 }
Example #3
0
        public async Task <string> Executar(FiltroRelatorioSincronoDto request)
        {
            var filtros = request.ObterObjetoFiltro <FiltroRelatorioSondagemPortuguesCapacidadeLeituraDto>();

            Dre     dre     = null;
            Ue      ue      = null;
            Usuario usuario = null;

            if (!string.IsNullOrEmpty(filtros.UeCodigo))
            {
                ue = await mediator.Send(new ObterUePorCodigoQuery(filtros.UeCodigo));

                if (ue == null)
                {
                    throw new NegocioException("Não foi possível obter a UE.");
                }
            }

            if (filtros.DreCodigo > 0)
            {
                dre = await mediator.Send(new ObterDrePorCodigoQuery()
                {
                    DreCodigo = filtros.DreCodigo.ToString()
                });

                if (dre == null)
                {
                    throw new NegocioException("Não foi possível obter a DRE.");
                }
            }

            if (!string.IsNullOrEmpty(filtros.UsuarioRf))
            {
                usuario = await mediator.Send(new ObterUsuarioPorCodigoRfQuery()
                {
                    UsuarioRf = filtros.UsuarioRf
                });

                if (usuario == null)
                {
                    throw new NegocioException("Não foi possível obter o usuário.");
                }
            }

            var relatorio = await mediator.Send(new ObterRelatorioSondagemPortuguesCapLeituraPorTurmaQuery()
            {
                AnoLetivo   = filtros.AnoLetivo,
                Dre         = dre,
                Ue          = ue,
                TurmaAno    = int.Parse(filtros.Ano),
                Usuario     = usuario,
                TurmaCodigo = filtros.TurmaCodigo,
                Bimestre    = filtros.Bimestre
            });

            return(await mediator.Send(new GerarRelatorioHtmlParaPdfCommand("RelatorioSondagemPortuguesCapacidadeLeituraPorTurma", relatorio, Guid.NewGuid(), envioPorRabbit : false)));
        }
 private AbrangenciaDreRetorno TransformaDreEmDto(Dre dre)
 {
     return(new AbrangenciaDreRetorno()
     {
         Abreviacao = dre.Abreviacao,
         Codigo = dre.CodigoDre,
         Nome = dre.Nome
     });
 }
 public RelatorioCompensacaoAusenciaObterResultadoFinalQuery(FiltroRelatorioCompensacaoAusenciaDto filtros, Ue ue, Dre dre, IEnumerable <ComponenteCurricularPorTurma> componentesCurriculares, IEnumerable <RelatorioCompensacaoAusenciaRetornoConsulta> compensacoes, IEnumerable <AlunoHistoricoEscolar> alunos, IEnumerable <FrequenciaAluno> frequencias)
 {
     Filtros = filtros;
     Ue      = ue;
     Dre     = dre;
     ComponentesCurriculares = componentesCurriculares;
     Compensacoes            = compensacoes;
     Alunos      = alunos;
     Frequencias = frequencias;
 }
Example #6
0
        private RelatorioImpressaoCalendarioDto MontarCabecalho(Dre dre, Ue ue, TipoCalendarioDto tipoCalendarioDto)
        {
            var retorno = new RelatorioImpressaoCalendarioDto();

            retorno.DreNome            = dre == null ? "TODAS" : dre.Abreviacao;
            retorno.TipoCalendarioNome = tipoCalendarioDto.Nome;
            retorno.UeNome             = ue == null ? "TODAS" : ue.NomeComTipoEscola;

            return(retorno);
        }
Example #7
0
 private BoletimEscolarCabecalhoDto ObterCabecalhoInicial(Dre dre, Ue ue, Turma turma)
 {
     return(new BoletimEscolarCabecalhoDto()
     {
         Data = DateTime.Now.ToString("dd/MM/yyyy"),
         NomeDre = dre.Abreviacao,
         NomeUe = ue.NomeRelatorio,
         NomeTurma = turma.NomeRelatorio
     });
 }
Example #8
0
 public ObterRelatorioImpressaoCalendarioQuery(Dre dre, Ue ue, TipoCalendarioDto tipoCalendario, bool ehSME, string usuarioRF, Guid usuarioPerfil, bool consideraPendenteAprovacao, bool podeVisualizarEventosOcorrenciaDre)
 {
     Dre                                = dre;
     Ue                                 = ue;
     TipoCalendario                     = tipoCalendario;
     EhSME                              = ehSME;
     UsuarioRF                          = usuarioRF;
     UsuarioPerfil                      = usuarioPerfil;
     ConsideraPendenteAprovacao         = consideraPendenteAprovacao;
     PodeVisualizarEventosOcorrenciaDre = podeVisualizarEventosOcorrenciaDre;
 }
Example #9
0
        public IActionResult Post([FromBody] Dre dre)
        {
            try
            {
                _dreRepository.Adicionar(dre);

                return(Created("api/Dre", dre));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
Example #10
0
        private FechamentoReabertura TransformarDtoEmEntidadeParaPersistencia(FechamentoReaberturaPersistenciaDto fechamentoReaberturaPersistenciaDto)
        {
            Dre dre = null;
            Ue  ue  = null;

            if (!string.IsNullOrEmpty(fechamentoReaberturaPersistenciaDto.DreCodigo))
            {
                dre = repositorioDre.ObterPorCodigo(fechamentoReaberturaPersistenciaDto.DreCodigo);
                if (dre == null)
                {
                    throw new NegocioException("Não foi possível localizar a Dre.");
                }
            }

            if (!string.IsNullOrEmpty(fechamentoReaberturaPersistenciaDto.UeCodigo))
            {
                ue = repositorioUe.ObterPorCodigo(fechamentoReaberturaPersistenciaDto.UeCodigo);
                if (ue == null)
                {
                    throw new NegocioException("Não foi possível localizar a UE.");
                }
            }

            var tipoCalendario = repositorioTipoCalendario.ObterPorId(fechamentoReaberturaPersistenciaDto.TipoCalendarioId);

            if (tipoCalendario == null)
            {
                throw new NegocioException("Não foi possível localizar o Tipo de Calendário.");
            }

            var fechamentoReabertura = new FechamentoReabertura()
            {
                Descricao = fechamentoReaberturaPersistenciaDto.Descricao,
                Fim       = fechamentoReaberturaPersistenciaDto.Fim,
                Inicio    = fechamentoReaberturaPersistenciaDto.Inicio
            };

            fechamentoReabertura.AtualizarDre(dre);
            fechamentoReabertura.AtualizarUe(ue);
            fechamentoReabertura.AtualizarTipoCalendario(tipoCalendario);

            fechamentoReaberturaPersistenciaDto.Bimestres.ToList().ForEach(bimestre =>
            {
                fechamentoReabertura.Adicionar(new FechamentoReaberturaBimestre()
                {
                    Bimestre = bimestre
                });
            });

            return(fechamentoReabertura);
        }
Example #11
0
        private (Dre, Ue) ObterDreEUe(string codigoDre, string codigoUe)
        {
            Dre dre = null;

            if (!string.IsNullOrWhiteSpace(codigoDre))
            {
                dre = repositorioDre.ObterPorCodigo(codigoDre.ToString());
            }
            Ue ue = null;

            if (!string.IsNullOrWhiteSpace(codigoUe))
            {
                ue = repositorioUe.ObterPorCodigo(codigoUe.ToString());
            }
            return(dre, ue);
        }
Example #12
0
 private async Task <BoletimEscolarDto> MontarBoletins(Dre dre, Ue ue, IEnumerable <Turma> turmas, IEnumerable <IGrouping <string, ComponenteCurricularPorTurma> > componentesCurricularesPorTurma,
                                                       IEnumerable <IGrouping <string, Aluno> > alunosPorTurma, IEnumerable <IGrouping <string, NotasAlunoBimestre> > notasAlunos,
                                                       IEnumerable <IGrouping <string, FrequenciaAluno> > frequenciasAlunos, IDictionary <string, string> tiposNota,
                                                       IEnumerable <MediaFrequencia> mediasFrequencias)
 {
     return(await mediator.Send(new MontarBoletinsQuery()
     {
         Dre = dre,
         Ue = ue,
         Turmas = turmas,
         ComponentesCurricularesPorTurma = componentesCurricularesPorTurma,
         AlunosPorTuma = alunosPorTurma,
         Notas = notasAlunos,
         Frequencias = frequenciasAlunos,
         TiposNota = tiposNota,
         MediasFrequencia = mediasFrequencias
     }));
 }
Example #13
0
        public async Task Executar(FiltroRelatorioDto request)
        {
            var filtros = request.ObterObjetoFiltro <RelatorioImpressaoCalendarioFiltroDto>();

            Dre dre = null;

            if (!string.IsNullOrEmpty(filtros.DreCodigo))
            {
                dre = await mediator.Send(new ObterDrePorCodigoQuery()
                {
                    DreCodigo = filtros.DreCodigo
                });

                if (dre == null)
                {
                    throw new NegocioException("Não foi possível localizar a Dre");
                }
            }
            Ue ue = null;

            if (!string.IsNullOrEmpty(filtros.UeCodigo))
            {
                ue = await mediator.Send(new ObterUePorCodigoQuery(filtros.UeCodigo));

                if (ue == null)
                {
                    throw new NegocioException("Não foi possível localizar a Ue");
                }
            }

            var tipoCalendario = await mediator.Send(new ObterTipoCalendarioPorIdQuery(filtros.TipoCalendarioId));

            if (tipoCalendario == null)
            {
                throw new NegocioException("Não foi possível localizar o Tipo de Calendário.");
            }

            var relatorio = await mediator.Send(new ObterRelatorioImpressaoCalendarioQuery(dre, ue, tipoCalendario,
                                                                                           filtros.EhSME, filtros.UsuarioRF, filtros.UsuarioPerfil, filtros.ConsideraPendenteAprovacao, filtros.PodeVisualizarEventosOcorrenciaDre));

            await mediator.Send(new GerarRelatorioHtmlParaPdfCommand("RelatorioImpressaoCalendario", relatorio, request.CodigoCorrelacao));
        }
Example #14
0
        //
        // GET: /Dre/

        public ActionResult Index(int?pIdVisao, string pGrafico, string pAno)
        {
            int idVisao = pIdVisao ??
                          (db.Tr_CabViscao.Count(x => x.CAB_STATUS == (int)Enums.Ativo.Liberado) > 0 ? db.Tr_CabViscao.Where(x => x.CAB_STATUS != (int)Enums.Ativo.EmEdicao).FirstOrDefault().CAB_ID : 0);

            //Defini layout
            #region ViewDataLayout
            ViewData["mainmenu_scroll"]      = ""; //pagescroll , fixedscroll
            ViewData["body_class"]           = "sidebar-collapse";
            ViewData["html_class"]           = "";
            ViewData["pagetopbar_class"]     = "sidebar_shift";
            ViewData["maincontent_class"]    = "sidebar_shift";
            ViewData["maincontent_type"]     = "";
            ViewData["pagesidebar_class"]    = "collapseit";
            ViewData["pagechatapi_class"]    = "";
            ViewData["chatapiwindows_demo"]  = "";
            ViewData["chatapiwindows_class"] = "";
            #endregion ViewDataLayout

            #region ViewBags
            ViewBag.pIdVisao = new SelectList(db.Tr_CabViscao.Where(x => x.CAB_STATUS == (int)SGI.Enums.Ativo.Liberado), "CAB_ID", "CAB_DESC", idVisao);
            var anos = db.Tr_Movimentos.Select(x => new { Ano = x.MOV_DATA.Substring(0, 4) }).GroupBy(x => new { x.Ano }).OrderByDescending(x => x.Key.Ano).ToList();
            pAno             = (pAno == "" || pAno == null ? anos.FirstOrDefault().Key.Ano : pAno);
            ViewBag.anoAtual = pAno;
            ViewBag.pAno     = new SelectList(anos, "Key.Ano", "Key.Ano", pAno);
            #endregion ViewBags
            var dre = new Dre();
            //Busca dados da DRE
            dre.Tr_Visoes = db.Tr_Visoes.ToList();
            dre.DreView   = ExtratorDre.DrePadrao(idVisao, pAno);

            //Busca unidade de medida
            #region AgrupaUnidades
            var uniAgrupadas   = dre.DreView.Select(x => new { x.MOV_UNID, x.UNI_DESCRICAO }).GroupBy(x => new { UNI_ID = x.MOV_UNID, UNI_DESCRICAO = x.UNI_DESCRICAO }).ToList();
            var uniLocalizadas = db.Tr_Unidade.ToList();
            dre.Unidades = uniLocalizadas.Where(x => uniAgrupadas.Any(j => j.Key.UNI_ID == x.UNI_ID)).ToList();
            #endregion AgrupaUnidades
            return(View(dre));
        }
        public async Task <string> Executar(FiltroRelatorioSincronoDto request)
        {
            var filtros = request.ObterObjetoFiltro <FiltroRelatorioSondagemComponentesMatematicaAditivoMultiplicativoConsolidadoDto>();

            Dre     dre     = null;
            Ue      ue      = null;
            Usuario usuario = null;

            if (!string.IsNullOrEmpty(filtros.UeCodigo))
            {
                ue = await mediator.Send(new ObterUePorCodigoQuery(filtros.UeCodigo));

                if (ue == null)
                {
                    throw new NegocioException("Não foi possível obter a UE.");
                }
            }

            if (filtros.DreCodigo > 0)
            {
                dre = await mediator.Send(new ObterDrePorCodigoQuery()
                {
                    DreCodigo = filtros.DreCodigo.ToString()
                });

                if (dre == null)
                {
                    throw new NegocioException("Não foi possível obter a DRE.");
                }
            }


            if (!string.IsNullOrEmpty(filtros.UsuarioRf))
            {
                usuario = await mediator.Send(new ObterUsuarioPorCodigoRfQuery()
                {
                    UsuarioRf = filtros.UsuarioRf
                });

                if (usuario == null)
                {
                    throw new NegocioException("Não foi possível obter o usuário.");
                }
            }
            var dataReferencia = await mediator.Send(new ObterDataPeriodoFimSondagemPorSemestreAnoLetivoQuery(filtros.Semestre, filtros.AnoLetivo));

            var quantidadeTotalAlunosUeAno = await mediator.Send(new ObterTotalAlunosPorUeAnoSondagemQuery(filtros.Ano, ue?.Codigo, filtros.AnoLetivo, dataReferencia, filtros.DreCodigo));

            var relatorio = await mediator.Send(new ObterSondagemMatAditMultiConsolidadoQuery()
            {
                AnoLetivo             = filtros.AnoLetivo,
                Dre                   = dre,
                Ue                    = ue,
                Semestre              = filtros.Semestre,
                TurmaAno              = int.Parse(filtros.Ano),
                Usuario               = usuario,
                QuantidadeTotalAlunos = quantidadeTotalAlunosUeAno,
                Proficiencia          = filtros.ProficienciaId
            });

            return(await mediator.Send(new GerarRelatorioHtmlParaPdfCommand("RelatorioSondagemComponentesMatematicaAditivoMultiplicativoConsolidado", relatorio, Guid.NewGuid(), envioPorRabbit : false)));
        }
 private void MontarCabecalho(RelatorioSondagemComponentesMatematicaNumerosAutoralConsolidadoDto relatorio, Dre dre, Ue ue, string anoTurma, int anoLetivo, int semestre, string rf, string usuario)
 {
     relatorio.Ano                  = anoTurma;
     relatorio.AnoLetivo            = anoLetivo;
     relatorio.ComponenteCurricular = "Matemática";
     relatorio.DataSolicitacao      = DateTime.Now.ToString("dd/MM/yyyy");
     relatorio.Dre                  = dre != null ? dre.Abreviacao : "Todas";
     relatorio.Periodo              = $"{semestre}º Semestre";
     relatorio.Proficiencia         = int.Parse(anoTurma) > 3 ? "" : "Números";
     relatorio.RF      = rf;
     relatorio.Turma   = "Todas";
     relatorio.Ue      = ue != null ? ue.NomeComTipoEscola : "Todas";
     relatorio.Usuario = usuario;
 }
Example #17
0
        private async Task VerificaPendenciaFechamentoFinal(IGrouping <int, PeriodoFechamentoBimestre> periodosEncerramentoUes, ModalidadeTipoCalendario modalidade, Dre dre, double percentualFechamentoInsuficiente)
        {
            var listaUes = new List <(bool notificar, Ue ue, int quantidadeTurmasPendentes)>();

            foreach (var periodoEncerramentoUe in periodosEncerramentoUes)
            {
                var turmas = await mediator.Send(new ObterTurmasComFechamentoOuConselhoNaoFinalizadosQuery(periodoEncerramentoUe.PeriodoFechamento.UeId.Value,
                                                                                                           DateTime.Now.Year,
                                                                                                           null,
                                                                                                           modalidade.ObterModalidadesTurma(),
                                                                                                           DateTime.Now.Semestre()));

                if (turmas != null && turmas.Any())
                {
                    listaUes.Add(await VerificaTurmasComPendenciaFechamentoNaUe(turmas, periodoEncerramentoUe.PeriodoFechamento.Ue, percentualFechamentoInsuficiente));
                }
            }

            if (listaUes.Any(c => c.notificar))
            {
                await NotificarUesInsuficientes(listaUes, null, dre, percentualFechamentoInsuficiente);
            }
        }
Example #18
0
 private void MontarCabecalho(RelatorioSondagemComponentesMatematicaAditMulConsolidadoDto relatorio, ProficienciaSondagemEnum proficiencia, Dre dre, Ue ue, string anoTurma, int anoLetivo, int semestre, string rf, string usuario)
 {
     relatorio.Ano                  = anoTurma;
     relatorio.AnoLetivo            = anoLetivo;
     relatorio.ComponenteCurricular = "Matemática";
     relatorio.DataSolicitacao      = DateTime.Now.ToString("dd/MM/yyyy");
     relatorio.Dre                  = dre != null ? dre.Abreviacao : "Todas";
     relatorio.Periodo              = $"{semestre}º Semestre";
     relatorio.Proficiencia         = proficiencia == ProficienciaSondagemEnum.CampoAditivo ? "Aditivo" : "Multiplicativo";
     relatorio.RF      = rf;
     relatorio.Turma   = "Todas";
     relatorio.Ue      = ue != null ? ue.NomeComTipoEscola : "Todas";
     relatorio.Usuario = usuario;
 }
Example #19
0
        public async Task <FechamentoDto> ObterPorTipoCalendarioDreEUe(long tipoCalendarioId, Dre dre, Ue ue)
        {
            var usuarioLogado = await servicoUsuario.ObterUsuarioLogado();

            var dreIdFiltro = !(dre == null) || usuarioLogado.EhPerfilUE() ? dre?.Id : null;

            var fechamentoSME = repositorioPeriodoFechamento.ObterPorFiltros(tipoCalendarioId, null, null, null);

            var fechamentoSMEDre = repositorioPeriodoFechamento.ObterPorFiltros(tipoCalendarioId, dreIdFiltro, null, null);

            if (fechamentoSMEDre == null)
            {
                LimparCamposNaoUtilizadosRegistroPai(fechamentoSME);
                fechamentoSMEDre = fechamentoSME;

                if (fechamentoSMEDre == null)
                {
                    fechamentoSMEDre = new PeriodoFechamento(null, null);

                    var tipoCalendario = await repositorioTipoCalendario.ObterPorIdAsync(tipoCalendarioId);

                    if (tipoCalendario == null)
                    {
                        throw new NegocioException("Tipo de calendário não encontrado.");
                    }

                    var periodoEscolar = await repositorioPeriodoEscolar.ObterPorTipoCalendario(tipoCalendarioId);

                    if (periodoEscolar == null || !periodoEscolar.Any())
                    {
                        throw new NegocioException("Período escolar não encontrado.");
                    }

                    foreach (var periodo in periodoEscolar)
                    {
                        periodo.AdicionarTipoCalendario(tipoCalendario);
                        fechamentoSMEDre.AdicionarFechamentoBimestre(new PeriodoFechamentoBimestre(fechamentoSMEDre.Id, periodo, periodo.PeriodoInicio, periodo.PeriodoFim));
                    }
                }
            }

            var fechamentoDreUe = repositorioPeriodoFechamento.ObterPorFiltros(tipoCalendarioId, dre?.Id, ue?.Id, null);

            if (fechamentoDreUe == null)
            {
                LimparCamposNaoUtilizadosRegistroPai(fechamentoSMEDre);
                fechamentoDreUe     = fechamentoSMEDre;
                fechamentoDreUe.Dre = dre;
                fechamentoDreUe.Ue  = ue;
            }

            var fechamentoDto    = MapearParaDto(fechamentoDreUe);
            var fechamentoSMEDto = MapearParaDto(fechamentoSME);

            foreach (var bimestreSME in fechamentoSMEDre.FechamentosBimestre)
            {
                FechamentoBimestreDto bimestreFechamentoSME = null;

                if (fechamentoSMEDto != null)
                {
                    bimestreFechamentoSME = fechamentoSMEDto.FechamentosBimestres.FirstOrDefault(c => c.Bimestre == bimestreSME.PeriodoEscolar.Bimestre);
                }

                var bimestreDreUe = fechamentoDto.FechamentosBimestres.FirstOrDefault(c => c.Bimestre == bimestreSME.PeriodoEscolar.Bimestre);
                if (bimestreDreUe != null)
                {
                    bimestreDreUe.PeriodoEscolar = bimestreSME.PeriodoEscolar;
                    if (fechamentoSMEDre.Id > 0 && !(dre == null) || !(ue == null))
                    {
                        if (bimestreFechamentoSME != null)
                        {
                            bimestreDreUe.InicioMinimo =
                                bimestreFechamentoSME.InicioDoFechamento < bimestreSME.InicioDoFechamento ?
                                bimestreFechamentoSME.InicioDoFechamento.Value : bimestreSME.InicioDoFechamento;

                            bimestreDreUe.FinalMaximo =
                                bimestreFechamentoSME.FinalDoFechamento > bimestreSME.FinalDoFechamento ?
                                bimestreFechamentoSME.FinalDoFechamento.Value : bimestreSME.FinalDoFechamento;
                        }
                        else
                        {
                            bimestreDreUe.InicioMinimo = bimestreSME.InicioDoFechamento;
                            bimestreDreUe.FinalMaximo  = bimestreSME.FinalDoFechamento;
                        }
                    }
                    else
                    {
                        bimestreDreUe.InicioMinimo = new DateTime(bimestreSME.InicioDoFechamento.Year, 01, 01);
                        bimestreDreUe.FinalMaximo  = new DateTime(bimestreSME.InicioDoFechamento.Year, 12, 31);
                    }
                }
            }
            return(fechamentoDto);
        }
 private void MontarCabecalho(RelatorioSondagemPortuguesCapacidadeLeituraPorTurmaDto relatorio, Dre dre, Ue ue, string anoTurma, string turmaNome, int anoLetivo, int bimestre, string codigoRf, string usuario)
 {
     relatorio.Cabecalho = new RelatorioSondagemPortuguesCapacidadeLeituraPorTurmaCabecalhoDto()
     {
         Ano                  = anoTurma,
         AnoLetivo            = anoLetivo,
         ComponenteCurricular = "Português",
         DataSolicitacao      = DateTime.Now.ToString("dd/MM/yyyy"),
         Dre                  = dre != null ? dre.Abreviacao : "Todas",
         Periodo              = $"{bimestre}º Bimestre",
         Proficiencia         = "Capacidade de Leitura",
         Rf      = codigoRf,
         Turma   = turmaNome,
         Ue      = ue != null ? ue.NomeComTipoEscola : "Todas",
         Usuario = usuario,
     };
 }