protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         using (BP.Relatorios.RelatorioUsuarioMatriculadoPrograma relUsuaMatricula = new BP.Relatorios.RelatorioUsuarioMatriculadoPrograma())
         {
             WebFormHelper.PreencherLista(relUsuaMatricula.ObterProgramaTodos(), cbxPrograma, true, false);
             WebFormHelper.PreencherListaStatusMatricula(cbxStatusMatricula, true, false);
         }
     }
 }
        protected void btnPesquisar_Click(object sender, EventArgs e)
        {
            using (var relUsuaMatricula = new BP.Relatorios.RelatorioUsuarioMatriculadoPrograma())
            {
                var lstGrid =
                    relUsuaMatricula.ConsultarUsuarioMatriculaPrograma(
                        string.IsNullOrWhiteSpace(cbxPrograma.SelectedValue) ? 0 : int.Parse(cbxPrograma.SelectedValue),
                        string.IsNullOrWhiteSpace(cbxStatusMatricula.SelectedValue)
                            ? 0
                            : int.Parse(cbxStatusMatricula.SelectedValue));

                // Converter os resultados em dados totalizadores.
                var totalizadores = new List <DTOTotalizador>
                {
                    TotalizadorUtil.GetTotalizador(lstGrid, "Total da quantidade de alunos registros", "CPF",
                                                   enumTotalizacaoRelatorio.Contar, false),
                    TotalizadorUtil.GetTotalizador(lstGrid, "Total da quantidade de alunos CPF", "CPF",
                                                   enumTotalizacaoRelatorio.ContarDistintos, false),
                    TotalizadorUtil.GetTotalizador(lstGrid, "Total da quantidade por nível ocupacional",
                                                   "NivelOcupacional", enumTotalizacaoRelatorio.Contar),
                    TotalizadorUtil.GetTotalizador(lstGrid, "Total da quantidade por status", "StatusMatricula",
                                                   enumTotalizacaoRelatorio.Contar),
                    TotalizadorUtil.GetTotalizador(lstGrid, "Total da quantidade de alunos UF", "UF",
                                                   enumTotalizacaoRelatorio.ContarDistintos)
                };

                ucTotalizadorRelatorio.PreencherTabela(totalizadores);


                if (lstGrid != null && lstGrid.Any())
                {
                    componenteGeracaoRelatorio.Visible = true;
                    ucFormatoSaidaRelatorio.Visible    = true;
                    btnPesquisar.CssClass = "btn btn-default mostrarload";
                    Filtros.CssClass      = "panel-collapse collapse";
                }
                else
                {
                    ucTotalizadorRelatorio.LimparTotalizadores();
                    componenteGeracaoRelatorio.Visible = false;
                }

                Session.Add("dsRelatorio", lstGrid);

                dgRelatorio.DataSource = lstGrid;
                WebFormHelper.ValidarVisibilidadeCamposGrid(dgRelatorio, chkListaCamposVisiveis.Items);
            }
        }