示例#1
0
        public Test load(int testId, bool loadAllQuestions, bool loadOnlyTestNames)
        {
            Test test = new Test();

            test.Id   = testId;
            test.Name = EncryptWorker.getInstance().decrypt(
                DataSetConverter.fromDsToSingle.toString.
                convert(SqlLiteSimpleExecute.execute(queryConfigurator.loadTestName(testId))));
            if (!loadOnlyTestNames)
            {
                test.QuestionsNumber = DataSetConverter.fromDsToSingle.toInt.
                                       convert(SqlLiteSimpleExecute.
                                               execute(queryConfigurator.loadTestQuestionCount(testId)));

                test.RequeredUnswersNumber = DataSetConverter.fromDsToSingle.toInt.
                                             convert(SqlLiteSimpleExecute.execute(queryConfigurator.
                                                                                  loadTestRequiredQuestionCount(testId)));

                int[] questionsIds = DataSetConverter.fromDsToBuf.toIntBuf.convert(
                    SqlLiteSimpleExecute.execute(queryConfigurator.loadTestQuestionIds(testId)));
                if (loadAllQuestions)
                {
                    test.Questions = questionsGetter.get(questionsIds);
                }
                else
                {
                    test.Questions = questionsGetter.get(questionsIds,
                                                         test.QuestionsNumber);
                }
            }

            return(test);
        }