protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);

                QuestionarioBLL questionarioBLL = new QuestionarioBLL();
                QuestionarioType questionario = questionarioBLL.selectRecord(id);
                if (questionario.idQuestionario != null && questionario.idQuestionario > 0 && questionario.IdAssociacao == Int32.Parse(Session["AssociacaoID"].ToString()))
                {
                    QuestionarioOpcaoBLL opcaoBLL = new QuestionarioOpcaoBLL();
                    opcaoBLL.delete(questionario);
                    questionarioBLL.delete(questionario);
                    Session["FlashMsg"] = "Apagado com sucesso";
                    Session["FlashMsgType"] = "success";
                }
                else
                {
                    throw new Exception("Id invalido");
                }
            }
            catch (Exception ex)
            {
                Session["FlashMsg"] = "Ocorreu um erro ao apagar";
                Session["FlashMsgType"] = "danger";
            }

            Response.Redirect("~/Painel/Questionario.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _empresa = Master.getEmpresa();

            QuestionarioBLL bll = new QuestionarioBLL();
            questionarios = bll.select(_empresa.IdAssociacao, _empresa.IdEmpresa);

            if (IsPostBack)
            {
                save();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     QuestionarioBLL questBLL = new QuestionarioBLL();
     GridView1.DataSource = questBLL.select(Master.getAssociacaoSession().IdAssociacao, 0);
     GridView1.DataBind();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.url_list = "~/Painel/Questionario.aspx";

            this.questionarioBLL = new QuestionarioBLL();
            this.OpcoesQuestionario = new QuestionarioOpcoesType();

            int id = Convert.ToInt32(Request.QueryString["id"]);
            if (id != null && id > 0)
            {
                this.questionario = this.questionarioBLL.selectRecord(id);

                if (questionario.idQuestionario != null && questionario.idQuestionario > 0)
                {
                    if (!IsPostBack)
                    {
                        txtPergunta.Text = questionario.Descricao;
                        cmb_tipo.SelectedValue = questionario.Tipo;
                    }

                    string[] exploded = questionario.Tipo.Split('_');
                    if (exploded[1] == "S")
                    {
                        QuestionarioOpcaoBLL bllOpcoes = new QuestionarioOpcaoBLL();
                        this.OpcoesQuestionario = bllOpcoes.select(questionario);
                    }
                }
                else
                {
                    Session["FlashMsg"] = "Id invalido";
                    Session["FlashMsgType"] = "danger";
                    Response.Redirect(this.url_list);
                }

            }
            else
            {
                this.questionario = new QuestionarioType();
            }

            this.DataBind();
        }