public string AnswerTheQuestion(DTO.InterviweeTest DtoInterviweeTest) { DTO.InterviweeTest _DtoInterviweeTest = DtoInterviweeTest; // Прохождение теста. DAO.InterviweeTests _DaoInterviweeTest = GetInterviweeTestByDtoId(ref _DtoInterviweeTest); // Текущий вопрос. DAO.Question _CurrentQuestion = m_QuestionManagement.GetQuestion(_DtoInterviweeTest.CurrentQuestion.Id); // Ответ на вопрос. DAO.Answer _Answer = m_AnswerManagement.GetAnswer(_DtoInterviweeTest.CurrentQuestion.SelectedAnswerId); m_Testing.AnswerToQuestion(_DaoInterviweeTest, _CurrentQuestion, _Answer); // Определим завершенность теста. m_Testing.DetermineStatusComplete(_DaoInterviweeTest); // Прохождение теста - обновление после ответа. _DaoInterviweeTest = GetInterviweeTestByDtoId(ref _DtoInterviweeTest); // Вопрос. _DtoInterviweeTest = GetNextQuestion(_DtoInterviweeTest, _DaoInterviweeTest, _CurrentQuestion); string _Json = Utils.JsonSerialize(_DtoInterviweeTest); return(_Json); }
public string GetStatisticTest(DTO.InterviweeTest InterviweeTest) { // Статистика прохождения теста. DTO.TestStatistic _TestStatistic = new DTO.TestStatistic(); // Количество прохождений теста. _TestStatistic.CountComplete = m_Statistic.GetCountCompleteTest(InterviweeTest.InterviweeId, InterviweeTest.TestId); // Статистика прохождений по вопросам. _TestStatistic.ArrayData = m_Statistic.GetArrayQuestionStatistic(InterviweeTest.TestId); string _Json = Utils.JsonSerialize(_TestStatistic); return(_Json); }
public string StartTest(DTO.InterviweeTest DtoInterviweeTest) { // Получим объекты параметры для старта прохождения теста. DAO.Interviwee _DaoInterviwee = m_InterviweeManagement.GetInterviwee(DtoInterviweeTest.InterviweeId); DAO.Test _DaoTest = m_TestManagement.GetTest(DtoInterviweeTest.TestId); // Создадим прохождение теста. DAO.InterviweeTests _DaoInterviweeTest = m_Testing.StartTesting(_DaoInterviwee, _DaoTest); // Заполним объект для клиента. DTO.InterviweeTest _DtoInterviweeTest = Utils.ConverObjectByJson <DTO.InterviweeTest>(_DaoInterviweeTest); _DtoInterviweeTest.ProgressText = GetTextProgressTesting(_DaoInterviweeTest); string _Json = GetNextQuestion(_DtoInterviweeTest); return(_Json); }
/// <summary> /// Получить прохождение теста. /// </summary> /// <param name="DtoInterviweeTest"></param> /// <returns></returns> private DAO.InterviweeTests GetInterviweeTestByDtoId(ref DTO.InterviweeTest DtoInterviweeTest) { if (DtoInterviweeTest.Id <= 0) { throw new ArgumentException("Не задан Id входящего параметра."); } DTO.InterviweeTest _DtoInterviweeTest = DtoInterviweeTest; DAO.InterviweeTests _DaoInterviweeTest = m_Testing.GetTesting(DtoInterviweeTest.Id); // Прогресс прохождения теста. Utils.CopyPropObects(_DtoInterviweeTest, _DaoInterviweeTest); _DtoInterviweeTest.ProgressText = GetTextProgressTesting(_DaoInterviweeTest); DtoInterviweeTest = _DtoInterviweeTest; return(_DaoInterviweeTest); }
public string GetNextQuestion(DTO.InterviweeTest DtoInterviweeTest) { DTO.InterviweeTest _DtoInterviweeTest = DtoInterviweeTest; // Прохождение теста. DAO.InterviweeTests _DaoInterviweeTest = GetInterviweeTestByDtoId(ref _DtoInterviweeTest); // Текущий вопрос. DAO.Question _CurrentQuestion = null; if (DtoInterviweeTest.CurrentQuestion != null) { _CurrentQuestion = m_QuestionManagement.GetQuestion(DtoInterviweeTest.CurrentQuestion.Id); } // Вопрос. _DtoInterviweeTest = GetNextQuestion(_DtoInterviweeTest, _DaoInterviweeTest, _CurrentQuestion); string _Json = Utils.JsonSerialize(_DtoInterviweeTest); return(_Json); }
/// <summary> /// Получить следующий вопрос. /// </summary> /// <returns></returns> private DTO.InterviweeTest GetNextQuestion( DTO.InterviweeTest DtoInterviweeTest, DAO.InterviweeTests DaoInterviweeTest, DAO.Question CurrentQuestion) { DTO.InterviweeTest _DtoInterviweeTest = DtoInterviweeTest; // Вопрос. DAO.Question _DaoQuestion = m_Testing.GetNextQuestion(DaoInterviweeTest, CurrentQuestion); if (_DaoQuestion == null) { _DtoInterviweeTest.CurrentQuestion = new DTO.Question(); return(_DtoInterviweeTest); } if (_DaoQuestion != null) { _DtoInterviweeTest.CurrentQuestion = Utils.ConverObjectByJson <DTO.Question>(_DaoQuestion); // Ответы на вопрос. DAO.QuestionAnswers[] _DaoQuestionAnswers = _DaoQuestion.Answers.ToArray(); List <DTO.QuestionAnswers> _ListAnswers = new List <DTO.QuestionAnswers>(); foreach (var _DaoQuestionAnswer in _DaoQuestionAnswers) { _ListAnswers.Add(new DTO.QuestionAnswers() { AnswerId = _DaoQuestionAnswer.Answer.Id, AnswerText = _DaoQuestionAnswer.Answer.Text, IsCorrect = false, QuestionId = _DaoQuestionAnswer.QuestionId }); } _DtoInterviweeTest.CurrentQuestion.Answers = _ListAnswers; } return(_DtoInterviweeTest); }