Beispiel #1
0
        private static string FindAnswer(int userId, TblQuestions question)
        {
            var answersForQuestion =
                ServerModel.DB.Load <TblUserAnswers>(ServerModel.DB.LookupIds <TblUserAnswers>(question, null));

            var answers = new List <TblUserAnswers>();

            foreach (var ans in answersForQuestion)
            {
                if (ans.UserRef == userId)
                {
                    answers.Add(ans);
                }
            }

            if (answers.Count > 0)
            {
                var lstUserAnswer = StatisticManager.FindLatestUserAnswer(answers);

                if (lstUserAnswer != null)
                {
                    return(lstUserAnswer.UserAnswer);
                }
            }

            return(string.Empty);
        }
Beispiel #2
0
        private static TblUserAnswers GetLastUserAnswerForCompiledQuestion(TblQuestions q, TblUsers u)
        {
            var userAnswers = StudentRecordFinder.GetUserAnswersForQuestion(q, u.ID);

            var compiledAnswers = StudentRecordFinder.ExtractCompiledAnswers(userAnswers);

            return(StatisticManager.FindLatestUserAnswer(compiledAnswers));
        }
Beispiel #3
0
        public void ReCompileButtonClick(object sender, EventArgs e)
        {
            var selectedGroup = ServerModel.DB.Load <TblGroups>(int.Parse(GroupDropDownList.SelectedItem.Value));
            var usersIds      = ServerModel.DB.LookupMany2ManyIds <TblUsers>(selectedGroup, null);
            var users         = ServerModel.DB.Load <TblUsers>(usersIds);

            if (ThemeDropDownList.SelectedItem != null)
            {
                var selectedTheme = ServerModel.DB.Load <TblThemes>(int.Parse(ThemeDropDownList.SelectedItem.Value));

                var pagesIds = ServerModel.DB.LookupIds <TblPages>(selectedTheme, null);
                var pages    = ServerModel.DB.Load <TblPages>(pagesIds);

                var answersForReCompilation = new List <TblUserAnswers>();



                foreach (var page in pages)
                {
                    var questionsIds = ServerModel.DB.LookupIds <TblQuestions>(page, null);

                    foreach (var u in users)
                    {
                        var userAnswerIds = ServerModel.DB.LookupIds <TblUserAnswers>(u, null);
                        var userAnswers   = ServerModel.DB.Load <TblUserAnswers>(userAnswerIds);

                        var compiledAnswers = new List <TblUserAnswers>();

                        foreach (var ua in userAnswers)
                        {
                            if (ua.IsCompiledAnswer)
                            {
                                compiledAnswers.Add(ua);
                            }
                        }

                        foreach (var q in questionsIds)
                        {
                            var answersForQuestion = new List <TblUserAnswers>();

                            foreach (var c in compiledAnswers)
                            {
                                if (c.QuestionRef == q)
                                {
                                    answersForQuestion.Add(c);
                                }
                            }

                            var lstUserAnswer = StatisticManager.FindLatestUserAnswer(answersForQuestion);

                            if (lstUserAnswer != null)
                            {
                                answersForReCompilation.Add(lstUserAnswer);
                            }
                        }
                    }
                }


                foreach (var n in answersForReCompilation)
                {
                    CompilationTestManager.GetNewManager(n).ReCompile();
                }

                Description.Value = "ReCompilation is started";
            }
            else
            {
                Description.Value = "Theme not selected !!!";
            }
        }