Exemplo n.º 1
0
        /// <summary>
        /// Carrega os questionarios
        /// </summary>
        private void CarregaQuestionarios()
        {
            List <REL_GraficoAtendimento_FiltrosPersonalizados> lstFiltrosPersonalizados = REL_GraficoAtendimento_FiltrosPersonalizadosBO.SelectBy_gra_id(VS_gra_id);

            VS_listQuestionarioConteudoResposta = new List <QuestionarioConteudoResposta>();
            QuestionarioConteudoResposta qcr;

            foreach (REL_GraficoAtendimento_FiltrosPersonalizados gfp in lstFiltrosPersonalizados)
            {
                qcr = new QuestionarioConteudoResposta
                {
                    qtr_id = gfp.qtr_id
                };
                qcr       = CLS_QuestionarioRespostaBO.GetEntityQuestionarioConteudoResposta(qcr);
                qcr.IsNew = gfp.IsNew;
                VS_listQuestionarioConteudoResposta.Add(qcr);
            }

            gvQuestionario.DataSource = VS_listQuestionarioConteudoResposta.OrderBy(f => f.qst_titulo).ThenBy(f => f.qtc_texto).ThenBy(f => f.qtr_texto);
            gvQuestionario.DataBind();
        }
Exemplo n.º 2
0
        protected void btnAdicionarQuestionario_Click(object sender, EventArgs e)
        {
            try
            {
                if (UCComboQuestionario.Valor <= 0)
                {
                    throw new ValidationException("Selecione um questionário.");
                }

                if (Convert.ToInt32(ddlPergunta.SelectedValue) <= 0)
                {
                    throw new ValidationException("Selecione uma pergunta.");
                }

                if (Convert.ToInt32(ddlResposta.SelectedValue) <= 0)
                {
                    throw new ValidationException("Selecione uma resposta.");
                }

                QuestionarioConteudoResposta qcr = new QuestionarioConteudoResposta
                {
                    qst_id = UCComboQuestionario.Valor
                    ,
                    qtc_id = Convert.ToInt32(ddlPergunta.SelectedValue)
                    ,
                    qtr_id = Convert.ToInt32(ddlResposta.SelectedValue)
                    ,
                    qst_titulo = UCComboQuestionario.Combo.SelectedItem.Text
                    ,
                    qtc_texto = ddlPergunta.SelectedItem.Text
                    ,
                    qtr_texto = ddlResposta.SelectedItem.Text
                    ,
                    IsNew = true
                };

                if (VS_listQuestionarioConteudoResposta.Any(r => r.qtr_id == Convert.ToInt32(ddlResposta.SelectedValue)))
                {
                    throw new ValidationException("Este filtro personalizado já foi adicionado.");
                }

                VS_listQuestionarioConteudoResposta.Add(qcr);

                gvQuestionario.DataSource = VS_listQuestionarioConteudoResposta.OrderBy(f => f.qst_titulo).ThenBy(f => f.qtc_texto).ThenBy(f => f.qtr_texto);
                gvQuestionario.DataBind();

                UCComboQuestionario.Valor = -1;
                UCComboQuestionario_SelectedIndexChanged();
            }
            catch (ValidationException ex)
            {
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ScrollToTop", "setTimeout('window.scrollTo(0,0);', 0);", true);
                lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ScrollToTop", "setTimeout('window.scrollTo(0,0);', 0);", true);
                lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Configuracao", "RelatorioAtendimento.Cadastro.ErroAdicionarQuestionario").ToString(), UtilBO.TipoMensagem.Erro);
            }
        }