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); } }
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); } } } }
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____; } }
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); }
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); }
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); } }
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); }
private static TblUserAnswers GetLastUserAnswerForCompiledQuestion(TblQuestions q, TblUsers u) { var userAnswers = StudentRecordFinder.GetUserAnswersForQuestion(q, u.ID); var compiledAnswers = StudentRecordFinder.ExtractCompiledAnswers(userAnswers); return(StatisticManager.FindLatestUserAnswer(compiledAnswers)); }
public UserResultForQuestion(int userId, TblQuestions question, DateTime?date) { _date = date; _question = question; _answers = (List <TblUserAnswers>)StudentRecordFinder.GetUserAnswersForQuestion(question, userId); _answers.Sort(new UserAnswersComparer()); }
public UserResultForPageForDate(TblUserAnswers ua, int userId) { Date = (DateTime)ua.Date; _page = StudentRecordFinder.GetPageForQuestion((int)ua.QuestionRef); _userId = userId; }
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); } }
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); } } }
public static bool IsContainCompiledQuestions(TblPages page) { var questions = StudentRecordFinder.GetQuestionsForPage(page); foreach (var question in questions) { if (question.IsCompiled) { return(true); } } return(false); }
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); }
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())); } } }
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())); } } }
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())); } } }
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); } } }
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); }
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); }
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); } } }
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; } }
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); }
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); }
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); }
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 !!!"; } }
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(); } }