示例#1
0
        public Question load(int id)
        {
            Question question = new Question();

            question.Id = id;
            question.QuestionsContent = EncryptWorker.getInstance().decrypt(
                DataSetConverter.fromDsToSingle.toString.convert(
                    SqlLiteSimpleExecute.execute(queryConfigurator.loadQuestionContent(id))));
            int[] unswersIds = DataSetConverter.fromDsToBuf.toIntBuf.convert(
                SqlLiteSimpleExecute.execute(queryConfigurator.loadQuestionUnswersIds(id)));

            question.Unswers = new List <Unswer>();
            for (int i = 0; i < unswersIds.Count(); i++)
            {
                question.Unswers.Add(unswerManipalator.load(unswersIds[i]));
            }

            int questionTypeId = DataSetConverter.fromDsToSingle.toInt.convert(
                SqlLiteSimpleExecute.execute(queryConfigurator.loadQuestionTypeId(id)));
            string questionType = DataSetConverter.fromDsToSingle.toString.convert(
                SqlLiteSimpleExecute.execute(queryConfigurator.getObjectName(questionTypeId)));

            if (questionType.Equals(QuestionTypes.multiplyAnswer.getType()))
            {
                question.QuestionsType = QuestionTypes.multiplyAnswer;
                return(question);
            }
            if (questionType.Equals(QuestionTypes.singleAnswer.getType()))
            {
                question.QuestionsType = QuestionTypes.singleAnswer;
                return(question);
            }

            throw new ParamsTypesExceptions();
        }