Beispiel #1
0
 public override void NextQuestion()
 {
     try
     {
         CurrentComparisonQuestionIndex++;
         currentComparisonQuestion = comparisonQuestionsStorage[CurrentComparisonQuestionIndex];
     }
     catch (IndexOutOfRangeException ex)
     {
         string message = "Holland test. Comparison question index error.";
         ExceptionHandler.CriticalException(ex, message);
     }
     catch (Exception ex)
     {
         ExceptionHandler.CriticalException(ex);
     }
 }
Beispiel #2
0
 public override void PrevQuestion()
 {
     try
     {
         CurrentComparisonQuestionIndex--;
         currentComparisonQuestion = comparisonQuestionsStorage[CurrentComparisonQuestionIndex];
     }
     catch (IndexOutOfRangeException ex)
     {
         string message = "Holland test. Comparison question index error.";
         ExceptionHandler.CriticalException(ex, message);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         ExceptionHandler.CriticalException(ex);
     }
 }
Beispiel #3
0
 public override void CreateTest()
 {
     try
     {
         comparisonQuestionsStorage     = GenerateComparisonQuestions();
         CurrentComparisonQuestionIndex = 0;
         currentComparisonQuestion      = comparisonQuestionsStorage[CurrentComparisonQuestionIndex];
         answerStack.Clear();
     }
     catch (IndexOutOfRangeException ex)
     {
         string message = "Holland test. Comparison question index error.";
         ExceptionHandler.CriticalException(ex, message);
     }
     catch (Exception ex)
     {
         ExceptionHandler.CriticalException(ex);
     }
 }
        public ProfessionPairStorage GeneratePairs()
        {
            ProfessionStrorage professionStrorage;

            try
            {
                professionStrorage = JsonSerializer.Deserialize <ProfessionStrorage>(jsonString);

                for (int pairIndex = 0; pairIndex < Constants.HOLLAND_QUESTION_COUNT;)
                {
                    int typeArrCount = 6;

                    for (int mainArrIndex = 0, anotherArrStartIndex = 1;
                         mainArrIndex < 5;
                         mainArrIndex++, anotherArrStartIndex++)

                    {
                        for (int anotherArrIndex = anotherArrStartIndex;
                             anotherArrIndex < typeArrCount;
                             anotherArrIndex++)

                        {
                            ProfesionPair tempPair = new ProfesionPair
                            {
                                firstProfession  = GetProfession(mainArrIndex, professionStrorage),
                                secondProfession = GetProfession(anotherArrIndex, professionStrorage)
                            };

                            professionPairStorage.pairs.Add(tempPair);

                            pairIndex++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = "Pair generator. Json deserialization error";
                ExceptionHandler.CriticalException(ex, message);
            }

            return(professionPairStorage);
        }