Beispiel #1
0
 public void create(Unswer unswer, int questionId)
 {
     if (unswer.IsRight)
     {
         SqlLiteSimpleExecute.execute(queryConfigurator.createUnswer(questionId));
         unswer.Id = DataSetConverter.fromDsToSingle.toInt.convert(SqlLiteSimpleExecute.
                                                                   execute(queryConfigurator.getObjectIdInDevelopStatus(DbTypes.unswer)));
         SqlLiteSimpleExecute.execute(queryConfigurator.setUnswerContent(unswer.Id,
                                                                         EncryptWorker.getInstance().encrypt(unswer.Content)));
         SqlLiteSimpleExecute.execute(queryConfigurator.setUnswerType(unswer.Id,
                                                                      UnswerTypes.rightUnswer));
     }
     else
     {
         SqlLiteSimpleExecute.execute(queryConfigurator.createUnswer(questionId));
         unswer.Id = DataSetConverter.fromDsToSingle.toInt.convert(SqlLiteSimpleExecute.
                                                                   execute(queryConfigurator.getObjectIdInDevelopStatus(DbTypes.unswer)));
         SqlLiteSimpleExecute.execute(queryConfigurator.setUnswerContent(unswer.Id,
                                                                         EncryptWorker.getInstance().encrypt(unswer.Content)));
         SqlLiteSimpleExecute.execute(queryConfigurator.setUnswerType(unswer.Id,
                                                                      UnswerTypes.unswer));
     }
     SqlLiteSimpleExecute.execute(queryConfigurator.setApproveStatusToObject(
                                      DbTypes.unswer));
 }
        public void create(Subject subject)
        {
            SqlLiteSimpleExecute.execute(queryConfigurator.createSubject(
                                             EncryptWorker.getInstance().encrypt(subject.Name)));
            for (int i = 0; i < subject.Tests.Count; i++)
            {
                testManipulator.create(subject.Tests.ElementAt(i), subject.Id);
            }

            SqlLiteSimpleExecute.execute(queryConfigurator.setApproveStatusToObject(
                                             DbTypes.subject));
        }
        public void create(Question question, int testId)
        {
            SqlLiteSimpleExecute.execute(queryConfigurator.createQuestion(testId));
            question.Id = DataSetConverter.fromDsToSingle.toInt.convert(SqlLiteSimpleExecute.
                                                                        execute(queryConfigurator.getObjectIdInDevelopStatus(DbTypes.question)));
            SqlLiteSimpleExecute.execute(queryConfigurator.setQuestionContent(question.Id,
                                                                              EncryptWorker.getInstance().encrypt(question.QuestionsContent)));
            SqlLiteSimpleExecute.execute(queryConfigurator.setQuestionType(question.Id,
                                                                           question.QuestionsType));


            for (int i = 0; i < question.Unswers.Count; i++)
            {
                unswerManipalator.create(question.Unswers.ElementAt(i), question.Id);
            }
            SqlLiteSimpleExecute.execute(queryConfigurator.setApproveStatusToObject(
                                             DbTypes.question));
        }
Beispiel #4
0
        public void create(Test test, int subjectId)
        {
            SqlLiteSimpleExecute.execute(queryConfigurator.createTest(
                                             EncryptWorker.getInstance().encrypt(test.Name), subjectId));

            int id = DataSetConverter.fromDsToSingle.toInt.convert(SqlLiteSimpleExecute.
                                                                   execute(queryConfigurator.getObjectIdInDevelopStatus(DbTypes.test)));

            SqlLiteSimpleExecute.execute(queryConfigurator.
                                         setTestsQuestionsNumber(id, test.QuestionsNumber));

            SqlLiteSimpleExecute.execute(queryConfigurator.
                                         setTestsRequeredUnswersNumber(id, test.RequeredUnswersNumber));

            for (int i = 0; i < test.Questions.Count; i++)
            {
                questionManipulator.create(test.Questions.ElementAt(i), id);
            }
            SqlLiteSimpleExecute.execute(queryConfigurator.setApproveStatusToObject(
                                             DbTypes.test));
        }