public Types.QuestionariosType select(int id_associacao, int id_empresa)
        {
            MySqlConnection con = new MySqlConnection(Dados.StringConexao);

            string SQL = "SELECT * FROM questionario q WHERE id_associacao = @id_associacao";

            MySqlCommand cmd = new MySqlCommand(SQL, con);
            cmd.Parameters.AddWithValue("@id_associacao",id_associacao);

            con.Open();
            MySqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            Types.QuestionariosType types = new Types.QuestionariosType();
            QuestionarioRespostaDAL dalResposta = new QuestionarioRespostaDAL();
            while (dr.Read())
            {
                Types.QuestionarioType type = new Types.QuestionarioType();
                type.idQuestionario = Int32.Parse(dr["id_questionario"].ToString());
                type.IdAssociacao = Int32.Parse(dr["id_associacao"].ToString());
                type.Tipo = dr["tipo"].ToString();
                type.Descricao = dr["descricao"].ToString();
                if (id_empresa > 0)
                {
                    type.Respostas = dalResposta.select(Convert.ToInt32(id_empresa), type.idQuestionario);
                }
                types.Add(type);
            }
            return types;
        }
        public Types.QuestionariosType select(int id_associacao, int id_empresa)
        {
            MySqlConnection con = new MySqlConnection(Dados.StringConexao);

            string SQL = "SELECT * FROM questionario q WHERE id_associacao = @id_associacao";

            MySqlCommand cmd = new MySqlCommand(SQL, con);

            cmd.Parameters.AddWithValue("@id_associacao", id_associacao);

            con.Open();
            MySqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            Types.QuestionariosType types       = new Types.QuestionariosType();
            QuestionarioRespostaDAL dalResposta = new QuestionarioRespostaDAL();

            while (dr.Read())
            {
                Types.QuestionarioType type = new Types.QuestionarioType();
                type.idQuestionario = Int32.Parse(dr["id_questionario"].ToString());
                type.IdAssociacao   = Int32.Parse(dr["id_associacao"].ToString());
                type.Tipo           = dr["tipo"].ToString();
                type.Descricao      = dr["descricao"].ToString();
                if (id_empresa > 0)
                {
                    type.Respostas = dalResposta.select(Convert.ToInt32(id_empresa), type.idQuestionario);
                }
                types.Add(type);
            }
            return(types);
        }
 public bool save(QuestionarioType questionario, int idEmpresa)
 {
     QuestionarioRespostaDAL dal = new QuestionarioRespostaDAL();
     return dal.save(questionario, idEmpresa);
 }