Ejemplo n.º 1
0
 /// <summary>
 /// Resets list of questions after filtering.
 /// </summary>
 public void ResetQuestionList()
 {
     foreach (var subject in SubjectQuestions)
     {
         if (!QuestionsToFilter.Contains(subject))
         {
             QuestionsToFilter.Add(subject);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Used to display questions thats only related to the given course
        /// </summary>
        /// <param name="course"></param>
        public async void GetQuestionsForTest(string course)
        {
            QuestionsToFilter.Clear();

            SubjectQuestions = await ApiHelper.Instance.GetQuestion(course);

            foreach (Question questionTofilter in SubjectQuestions)
            {
                QuestionsToFilter.Add(questionTofilter);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// We filter our list with questions by a questions QuestionType depending on the parameters given by the user
        /// </summary>
        /// <param name="type"></param>
        /// <param name="point"></param>
        public void FilterQuestionByType(string type, string point)
        {
            ResetQuestionList();

            foreach (var filtered in QuestionsToFilter.ToList())
            {
                if (type == "Alla") //If the user choose to se all questions then we dont remove anything.
                {
                }
                else if (filtered.QuestionType != type) //If the questions QuestionType doesnt match, we remove it.
                {
                    QuestionsToFilter.Remove(filtered);
                }
                if (point != "" && point != "Alla")
                {
                    if (filtered.PointValue != int.Parse(point))
                    {
                        QuestionsToFilter.Remove(filtered);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// We filter our list with questions by a questions PointValue depending on the parameters given by the user
        /// </summary>
        /// <param name="point"></param>
        /// <param name="type"></param>
        public void FilterQuestionByPoint(string point, string type)
        {
            ResetQuestionList();

            foreach (var filtered in QuestionsToFilter.ToList())
            {
                if (point == "Alla")
                {
                }
                else if (filtered.PointValue.ToString() != point)
                {
                    QuestionsToFilter.Remove(filtered);
                }
                if (type != "" && type != "Alla")
                {
                    if (filtered.QuestionType != type)
                    {
                        QuestionsToFilter.Remove(filtered);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Removing question that the user picked
 /// </summary>
 /// <param name="question"></param>
 public void RemoveQuestionFromTest(Question question)
 {
     CreatedTest.Questions.Remove(question);
     QuestionsToFilter.Add(question);
     CreatedTest.MaxPoints -= question.PointValue;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Adding question that the user picked
 /// </summary>
 /// <param name="question"></param>
 public void AddQuestionToTest(Question question)
 {
     CreatedTest.Questions.Add(question);
     QuestionsToFilter.Remove(question);
     CreatedTest.MaxPoints += question.PointValue;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Method to reset the object after posting the Test to DB
 /// </summary>
 public void ResetTest()
 {
     CreatedTest.Questions.Clear();
     QuestionsToFilter.Clear();
     CreatedTest.Questions.Clear();
 }