public void BuildCompiledQuestionsResult(TblQuestions q, int userId)
    {
        var compiledQuestion      = ServerModel.DB.Load <TblCompiledQuestions>((int)q.CompiledQuestionRef);
        var answersForCurrentUser = StudentRecordFinder.GetUserAnswersForQuestion(q, userId);

        SetHeader(q.TestName, compiledQuestion);
        SetTableHeader();

        if (answersForCurrentUser != null && answersForCurrentUser.Count != 0)
        {
            var lastUserAnswer = FindLatestUserAnswer(answersForCurrentUser);
            var compileAnswer  = StudentRecordFinder.GetCompiledAnswersForAnswer(lastUserAnswer);

            if (compileAnswer != null && compileAnswer.Count != 0)
            {
                SetResults(compileAnswer);
            }
            else
            {
                SetNoResultStatus(q);
            }
        }
        else
        {
            SetNoResultStatus(q);
        }
    }
 private void SetResults(IList <TblCompiledAnswers> compileAnswer)
 {
     foreach (var ca in compileAnswer)
     {
         SetTestCaseResult(StudentRecordFinder.GetCompiledQuestionDataForCompiledAnswer(ca), ca);
     }
 }
예제 #3
0
        public static void MarkNotIncludedPages(IList <TblPages> usedPages)
        {
            foreach (var page in usedPages)
            {
                if (page.PageTypeRef == (int?)FX_PAGETYPE.Practice)
                {
                    var questions = StudentRecordFinder.GetQuestionsForPage(page);

                    foreach (var q in questions)
                    {
                        var ua = new TblUserAnswers
                        {
                            QuestionRef      = q.ID,
                            Date             = DateTime.Now,
                            UserRef          = ((CustomUser)Membership.GetUser()).ID,
                            UserAnswer       = string.Empty,
                            IsCompiledAnswer = false,
                            AnswerTypeRef    = FxAnswerType.NotIncludedAnswer.ID
                        };

                        ServerModel.DB.Insert(ua);
                    }
                }
            }
        }
예제 #4
0
        public void ReCompileButtonClick(object sender, EventArgs e)
        {
            IList <TblUsers> users = GetUsersForReCompilation();

            throw new NotImplementedException();

            if (ThemeDropDownList.SelectedItem != null)
            {
                var items = StudentRecordFinder.GetItemsForTheme(int.Parse(ThemeDropDownList.SelectedItem.Value));

                var answersForReCompilation = new List <TblUserAnswers>();

                foreach (var item in items)
                {
                    //AddAnswersFromPageToReCompilationList(item, users, answersForReCompilation);
                }

                ReCompile(answersForReCompilation);

                Description.Value = Translations.ReCompilePageController_ReCompileButtonClick_ReCompilation_is_started;
            }
            else
            {
                Description.Value = Translations.ReCompilePageController_ReCompileButtonClick_Theme_not_selected____;
            }
        }
예제 #5
0
        private ControlInfo BuildTree(DateTime?date)
        {
            CurriculumnTreeView.Nodes.Clear();

            var userCurriculums = StudentRecordFinder.GetCurriculumnsForUser(_userId);

            var controlInfo = new ControlInfo();

            foreach (TblCurriculums curriculum in userCurriculums)
            {
                var node = new IdendtityNode(curriculum);

                if (StudentPermissionsHelper.IsDateAllowed(date, _userId, node.ID, node.Type, GetOperationType))
                {
                    controlInfo = BuildStages(curriculum, node, date);

                    if (controlInfo != null && controlInfo.IsControlStartsNow)
                    {
                        return(controlInfo);
                    }

                    if (node.ChildNodes.Count != 0)
                    {
                        CurriculumnTreeView.Nodes.Add(node);
                    }
                }
            }

            CurriculumnTreeView.ExpandAll();

            return(controlInfo);
        }
예제 #6
0
        private ControlInfo BuildStages(TblCurriculums curriculum, TreeNode node, DateTime?date)
        {
            IList <TblStages> stages = StudentRecordFinder.GetStagesForCurriculum(curriculum);

            ControlInfo controlInfo = new ControlInfo();

            foreach (TblStages stage in stages)
            {
                var child = new IdendtityNode(stage);

                if (StudentPermissionsHelper.IsDateAllowed(date, _userId, stage.ID, NodeType.Stage, GetOperationType))
                {
                    controlInfo = BuildThemes(stage, child);

                    if (controlInfo.IsControlStartsNow)
                    {
                        controlInfo.AddCurriculumnToInfo(curriculum);
                        return(controlInfo);
                    }
                    if (child.ChildNodes.Count != 0)
                    {
                        node.ChildNodes.Add(child);
                    }
                }
            }

            return(controlInfo);
        }
예제 #7
0
        private static ResultStatus GetCompiledStatus(TblUserAnswers answer)
        {
            var userCompiledAnswers = StudentRecordFinder.GetCompiledAnswersForAnswer(answer);

            bool allAcepted = true;

            if (userCompiledAnswers.Count != 0)
            {
                foreach (var compiledAnswer in userCompiledAnswers)
                {
                    if (compiledAnswer.StatusRef == (int)Status.Enqueued)
                    {
                        return(ResultStatus.Enqueued);
                    }

                    allAcepted &= (compiledAnswer.StatusRef == (int)Status.Accepted);
                }

                return(allAcepted ? ResultStatus.Pass : ResultStatus.Fail);
            }
            else
            {
                return(ResultStatus.Fail);
            }
        }
예제 #8
0
 public void SelectedDateChanged(object sender, EventArgs e)
 {
     CurriculumnCalendar.SelectedDayStyle.BackColor = Color.Gray;
     OpenTestButton.Enabled = false;
     ShowDescriptionForDataSelection();
     BuildTree(CurriculumnCalendar.SelectedDate);
     UserDescription.Text = StudentRecordFinder.GetDateDescription(_userId, CurriculumnCalendar.SelectedDate);
 }
예제 #9
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));
        }
예제 #10
0
        public UserResultForQuestion(int userId, TblQuestions question, DateTime?date)
        {
            _date     = date;
            _question = question;
            _answers  = (List <TblUserAnswers>)StudentRecordFinder.GetUserAnswersForQuestion(question, userId);

            _answers.Sort(new UserAnswersComparer());
        }
예제 #11
0
        public UserResultForPageForDate(TblUserAnswers ua, int userId)
        {
            Date = (DateTime)ua.Date;

            _page = StudentRecordFinder.GetPageForQuestion((int)ua.QuestionRef);

            _userId = userId;
        }
예제 #12
0
 public void ShowDescriptionButtonClick(object sender, EventArgs e)
 {
     CurriculumnCalendar.SelectedDates.Clear();
     CurriculumnCalendar.SelectedDayStyle.BackColor = Color.Orange;
     foreach (DateTime date in StudentRecordFinder.GetAllDates(_userId))
     {
         CurriculumnCalendar.SelectedDates.Add(date);
     }
 }
    private void SetResults(IList <TblUserAnswers> userAnswers)
    {
        var compileAnswer = StudentRecordFinder.GetCompiledAnswersForAnswer(FindLatestUserAnswer(userAnswers));

        foreach (var ca in compileAnswer)
        {
            SetTestCaseResult(StudentRecordFinder.GetCompiledQuestionDataForCompiledAnswer(ca), ca);
        }
    }
예제 #14
0
        private static void AddAnswersFromPageToReCompilationList(TblPages page, IList <TblUsers> users, List <TblUserAnswers> answersForReCompilation)
        {
            var questions = StudentRecordFinder.GetQuestionsForPage(page);

            foreach (var u in users)
            {
                foreach (var q in questions)
                {
                    TblUserAnswers lstUserAnswer = GetLastUserAnswerForCompiledQuestion(q, u);

                    AddAnswerToReCompilationList(lstUserAnswer, answersForReCompilation);
                }
            }
        }
예제 #15
0
        public static bool IsContainCompiledQuestions(TblPages page)
        {
            var questions = StudentRecordFinder.GetQuestionsForPage(page);

            foreach (var question in questions)
            {
                if (question.IsCompiled)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #16
0
        public static IList <UserResultForItem> GetStatisticForThemeForUser(int userId, int themeId)
        {
            var items = StudentRecordFinder.GetItemsForTheme(themeId);

            var result = new List <UserResultForItem>();

            foreach (var item in items)
            {
                var ur = new UserResultForItem(userId, item, null);
                ur.Calc();
                result.Add(ur);
            }

            return(result);
        }
예제 #17
0
        private void CreateThemeList()
        {
            ThemeDropDownList.Items.Clear();

            if (StageDropDownList.SelectedItem != null)
            {
                var selectedStage = ServerModel.DB.Load <TblStages>(int.Parse(StageDropDownList.SelectedItem.Value));
                var themes        = StudentRecordFinder.GetThemesForStage(selectedStage);

                foreach (var s in themes)
                {
                    ThemeDropDownList.Items.Add(new ListItem(s.Name, s.ID.ToString()));
                }
            }
        }
예제 #18
0
        private void CreateStageList()
        {
            StageDropDownList.Items.Clear();
            ThemeDropDownList.Items.Clear();

            if (CurriculumnDropDownList.SelectedItem != null)
            {
                var selectedCurriculumn = ServerModel.DB.Load <TblCurriculums>(int.Parse(CurriculumnDropDownList.SelectedItem.Value));
                var stages = StudentRecordFinder.GetStagesForCurriculum(selectedCurriculumn);

                foreach (var s in stages)
                {
                    StageDropDownList.Items.Add(new ListItem(s.Name, s.ID.ToString()));
                }
            }
        }
예제 #19
0
        private void CreateUserList()
        {
            UserDropDownList.Items.Clear();

            if (GroupDropDownList.SelectedItem != null)
            {
                var users = StudentRecordFinder.GetUsersFromGroup(int.Parse(GroupDropDownList.SelectedItem.Value));

                UserDropDownList.Items.Add(new ListItem("All Users From Group", "0"));

                foreach (var u in users)
                {
                    UserDropDownList.Items.Add(new ListItem(u.Login, u.ID.ToString()));
                }
            }
        }
예제 #20
0
        private void CreateUserList()
        {
            UserDropDownList.Items.Clear();

            if (GroupDropDownList.SelectedItem != null)
            {
                var users = StudentRecordFinder.GetUsersFromGroup(int.Parse(GroupDropDownList.SelectedItem.Value));

                UserDropDownList.Items.Add(new ListItem(Translations.ReCompilePageController_CreateUserList_All_Users_From_Group, "0"));

                foreach (var u in users)
                {
                    UserDropDownList.Items.Add(new ListItem(u.Login, u.ID.ToString()));
                }
            }
        }
    private void BuildStatistic(int pageId, int userId)
    {
        var page      = ServerModel.DB.Load <TblPages>(pageId);
        var questions = StudentRecordFinder.GetQuestionsForPage(pageId);

        foreach (var question in questions)
        {
            if (question.IsCompiled)
            {
                _headerLabel.Text = string.Format("Compilation Details For Question From Page:{0}", page.PageName);
                var cqr = (CompiledQuestionResult)LoadControl("../Controls/CompiledQuestionResult.ascx");
                cqr.BuildCompiledQuestionsResult(question, userId);
                _placeHolder.Controls.Add(cqr);
            }
        }
    }
예제 #22
0
        private IList <TblUsers> GetUsersForReCompilation()
        {
            var users = new List <TblUsers>();

            int selectedUserId  = int.Parse(UserDropDownList.SelectedItem.Value);
            int selectedGroupId = int.Parse(GroupDropDownList.SelectedItem.Value);

            if (selectedUserId == 0)
            {
                users.AddRange(StudentRecordFinder.GetUsersFromGroup(selectedGroupId));
            }
            else
            {
                users.Add(ServerModel.DB.Load <TblUsers>(selectedUserId));
            }

            return(users);
        }
예제 #23
0
        public static IList <UserResultForPage> GetStatisticForThemeForUser(int userId, int themeId)
        {
            var pages = StudentRecordFinder.GetPagesForTheme(themeId);

            var result = new List <UserResultForPage>();

            foreach (var p in pages)
            {
                if (p.PageTypeRef == (int?)FX_PAGETYPE.Practice)
                {
                    var ur = new UserResultForPage(userId, p, null);
                    ur.Calc();
                    result.Add(ur);
                }
            }

            return(result);
        }
예제 #24
0
        public void TestImportCourse()
        {
            var coursesPath = Path.Combine(Path.GetDirectoryName(
                                               Path.GetDirectoryName(
                                                   Path.GetDirectoryName(Environment.CurrentDirectory))), "Courses");
            var courses = Directory.GetFiles(coursesPath, "*.zip", SearchOption.TopDirectoryOnly);

            foreach (var coursePath in courses)
            {
                Logger.WriteLine("[COURSE IMPORTER] Importing course: " + coursePath);
                int courseId = ImportTestCourse(coursePath);
                Logger.WriteLine("[COURSE IMPORTER] ID = " + courseId + ". Pages: ");
                var pages = StudentRecordFinder.GetCoursePages(courseId);
                foreach (var p in pages)
                {
                    var url = string.Format(@"[COURSE IMPORTER] ~/Student/IudicoPage{0}?PageId={1}", ((FX_PAGETYPE)p.PageTypeRef).GetHandlerExtention(), p.ID);
                    Logger.WriteLine(url);
                }
            }
        }
예제 #25
0
        public void Calc()
        {
            var questions = StudentRecordFinder.GetQuestionsForPage(_page.ID);

            foreach (var q in questions)
            {
                var status = (new UserResultForQuestion(_userId, q, _date)).Calc();

                if (status == ResultStatus.NotIncluded)
                {
                    SetNotIncluded();
                    return;
                }

                if (status == ResultStatus.Enqueued)
                {
                    SetEnqueued();
                    return;
                }

                if (status == ResultStatus.Empty)
                {
                    SetEmpty();
                    return;
                }

                if (status == ResultStatus.Pass)
                {
                    _userRank += (int)q.Rank;
                }
            }

            if (_userRank >= _pageRank)
            {
                _status = ResultStatus.Pass;
            }
            else
            {
                _status = ResultStatus.Fail;
            }
        }
예제 #26
0
        public static TblUserAnswers FindLatestUserAnswer(IList <TblUserAnswers> userAnswers)
        {
            if (userAnswers != null)
            {
                var includedAnswers = StudentRecordFinder.ExtractIncludedAnswers(userAnswers);

                if (includedAnswers.Count > 0)
                {
                    var latestUserAnswer = includedAnswers[0];
                    foreach (var o in includedAnswers)
                    {
                        if (o.Date > latestUserAnswer.Date)
                        {
                            latestUserAnswer = o;
                        }
                    }

                    return(latestUserAnswer);
                }
            }
            return(null);
        }
예제 #27
0
        public static IList <UserResultForPageForDate> GetUserLatestAnswers(int userId)
        {
            var answers = StudentRecordFinder.GetAnswersForUser(userId);

            var includedAnswers = StudentRecordFinder.ExtractIncludedAnswers(answers);

            var sortAnswers = new List <UserResultForPageForDate>();

            foreach (var answer in includedAnswers)
            {
                var currAnswer = new UserResultForPageForDate(answer, userId);

                if (!sortAnswers.Contains(currAnswer))
                {
                    sortAnswers.Add(currAnswer);
                }
            }

            sortAnswers.Sort();

            return(sortAnswers);
        }
예제 #28
0
        private ControlInfo BuildThemes(TblStages stage, TreeNode node)
        {
            var themes = StudentRecordFinder.GetThemesForStage(stage);

            ControlInfo controlInfo = new ControlInfo();

            foreach (TblThemes theme in themes)
            {
                controlInfo = StudentPermissionsHelper.IsTimeForControl(_userId, stage, theme);

                if (controlInfo.IsControlStartsNow)
                {
                    return(controlInfo);
                }

                if (!theme.IsControl)
                {
                    node.ChildNodes.Add(new IdendtityNode(theme));
                }
            }

            return(controlInfo);
        }
예제 #29
0
        public void ReCompileButtonClick(object sender, EventArgs e)
        {
            IList <TblUsers> users = GetUsersForReCompilation();

            if (ThemeDropDownList.SelectedItem != null)
            {
                var pages = StudentRecordFinder.GetPagesForTheme(int.Parse(ThemeDropDownList.SelectedItem.Value));

                var answersForReCompilation = new List <TblUserAnswers>();

                foreach (var page in pages)
                {
                    AddAnswersFromPageToReCompilationList(page, users, answersForReCompilation);
                }

                ReCompile(answersForReCompilation);

                Description.Value = "ReCompilation is started";
            }
            else
            {
                Description.Value = "Theme not selected !!!";
            }
        }
예제 #30
0
        public void PageLoad(object sender, EventArgs e)
        {
            if (ServerModel.User.Current != null)
            {
                _userId        = ServerModel.User.Current.ID;
                UserName.Value = ServerModel.User.Current.UserName;

                if (!((Page)sender).IsPostBack)
                {
                    ShowCommonDescription();
                    var controlInfo = BuildTree(null);

                    if (controlInfo != null && controlInfo.IsControlStartsNow)
                    {
                        DoPreControlPreparation();
                        BuildTreeForControl(controlInfo);
                        SelectDatesPeriods(controlInfo.DatePeriods);
                        UserDescription.Text = StudentRecordFinder.GetDateDescription(_userId, CurriculumnCalendar.SelectedDate);
                        _isControlInProgress = true;
                    }
                }
                BuildLatestResultTable();
            }
        }