private static void CheckPageType(TblPages page) { if (page.PageTypeRef != (int?)FX_PAGETYPE.Theory) { throw new Exception("Wrong handler for page"); } }
public UserResultForPageForDate(TblUserAnswers ua, int userId) { Date = (DateTime)ua.Date; _page = StudentRecordFinder.GetPageForQuestion((int)ua.QuestionRef); _userId = userId; }
public UserResultForPage(int userId, TblPages page, DateTime? date) { _date = date; _userId = userId; _page = page; _pageRank = (int)_page.PageRank; }
public UserResultForPage(int userId, TblPages page, DateTime?date) { _date = date; _userId = userId; _page = page; _pageRank = (int)_page.PageRank; }
public static bool IsContainCompiledQuestions(TblPages page) { var questions = StudentRecordFinder.GetQuestionsForPage(page); foreach (var question in questions) if (question.IsCompiled) return true; return false; }
private static int Store(int themaRef, string name, byte[] file) { TblPages p = new TblPages { ThemeRef = themaRef, PageName = name, //PageFile = file, PageTypeRef = ((int)FX_PAGETYPE.Theory) }; ServerModel.DB.Insert(p); return(p.ID); }
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); } } }
private static TblPages StorePageWithoutPageFile(int themaRef, string name, int rank) { var p = new TblPages { ThemeRef = themaRef, PageName = name, PageTypeRef = (int)FX_PAGETYPE.Practice, PageRank = rank }; ServerModel.DB.Insert(p); return p; }
public static Control GetPracticeControl(TblPages page, Panel p) { p.ScrollBars = ScrollBars.Auto; string aspText = GetControlString(page); string aspTextWithCorrectImagesUrls = ChangeImageUrl(aspText, page); var control = p.Page.ParseControl(aspTextWithCorrectImagesUrls); var divFromPageControl = control.Controls[0]; return(divFromPageControl); }
private static int Store(int themaRef, string name, byte[] file) { TblPages p = new TblPages { ThemeRef = themaRef, PageName = name, //PageFile = file, PageTypeRef = ((int)FX_PAGETYPE.Theory) }; ServerModel.DB.Insert(p); return p.ID; }
public static Control GetPracticeControl(TblPages page, Panel p) { p.ScrollBars = ScrollBars.Auto; string aspText = GetControlString(page); string aspTextWithCorrectImagesUrls = ChangeImageUrl(aspText, page); var control = p.Page.ParseControl(aspTextWithCorrectImagesUrls); var divFromPageControl = control.Controls[0]; return divFromPageControl; }
public static bool IsContainCompiledQuestions(TblPages page) { var questions = StudentRecordFinder.GetQuestionsForPage(page); foreach (var question in questions) { if (question.IsCompiled) { return(true); } } return(false); }
private static TblPages StorePageWithoutPageFile(int themaRef, string name, int rank) { var p = new TblPages { ThemeRef = themaRef, PageName = name, PageTypeRef = (int)FX_PAGETYPE.Practice, PageRank = rank }; ServerModel.DB.Insert(p); return(p); }
private static void DeleteFiles(TblPages page) { var files = ServerModel.DB.Load<TblFiles>(ServerModel.DB.LookupIds<TblFiles>(page, null)); foreach (var file in files) { if (file.PID != null) ServerModel.DB.Delete<TblFiles>(file.ID); } var folders = ServerModel.DB.Load<TblFiles>(ServerModel.DB.LookupIds<TblFiles>(page, null)); foreach (var file in folders) ServerModel.DB.Delete<TblFiles>(file.ID); }
public virtual async Task <PageModel> PreparePageModelAsync(TblPages page) { PageModel result; if (page == null) { result = new PageModel(); } else { result = page.Adapt <PageModel>(); await page.LoadAllLocalizedStringsToModelAsync(result); } return(result); }
private void AddControl(TblPages page) { Control control; if ((FX_PAGETYPE)page.PageTypeRef == FX_PAGETYPE.Practice) { control = TestControlHelper.GetPracticeControl(page, PageContent); } else { throw new Exception("You can't see details for theory page"); } PageContent.Controls.Clear(); PageContent.Controls.Add(control); FillAnswer(control); }
private void ShowPage(TblPages page) { Control control; if ((FX_PAGETYPE)page.PageTypeRef == FX_PAGETYPE.Practice) { control = TestControlHelper.GetPracticeControl(page, PageContent); RedirectSubmitEventsToThisController(control, page.ID); } else { control = TestControlHelper.GetTheoryControl(page, PageContent); } PageContent.Controls.Clear(); PageContent.Controls.Add(control); }
public static string ChangeImageUrl(string pageText, TblPages page) { var imageUrlRegex = new Regex(string.Format(@"src=""(?<{0}>(?<{1}>\w+.files)/(?<{2}>\w+.\w+))""", UrlRegexGroup, FolderRegexGroup, ImageRegexGroup)); MatchCollection matches = imageUrlRegex.Matches(pageText); foreach (Match m in matches) { string imageName = m.Groups[ImageRegexGroup].Value; string folderName = m.Groups[FolderRegexGroup].Value; var list = ServerModel.DB.LookupIds<TblFiles>(page, null); var files = ServerModel.DB.Load<TblFiles>(list); string newUrl = string.Concat(ImageFileRequest, FindFileId(files, folderName, imageName)); pageText = pageText.Replace(m.Groups[UrlRegexGroup].Value, newUrl); } return pageText; }
private static void DeleteFiles(TblPages page) { var files = ServerModel.DB.Load <TblFiles>(ServerModel.DB.LookupIds <TblFiles>(page, null)); foreach (var file in files) { if (file.PID != null) { ServerModel.DB.Delete <TblFiles>(file.ID); } } var folders = ServerModel.DB.Load <TblFiles>(ServerModel.DB.LookupIds <TblFiles>(page, null)); foreach (var file in folders) { ServerModel.DB.Delete <TblFiles>(file.ID); } }
public virtual async Task <int> AddAsync(TblPages record) { if (record.ShowAsWebsiteDefaultPage && record.Published) { await _dbContext.Pages.Where(p => p.ShowAsWebsiteDefaultPage) .UpdateAsync(p => new TblPages() { ShowAsWebsiteDefaultPage = false }); } _dbContext.Pages.Add(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.Page); _eventPublisher.EntityInserted(record); return(record.Id); }
public static string ChangeImageUrl(string pageText, TblPages page) { var imageUrlRegex = new Regex(string.Format(@"src=""(?<{0}>(?<{1}>\w+.files)/(?<{2}>\w+.\w+))""", UrlRegexGroup, FolderRegexGroup, ImageRegexGroup)); MatchCollection matches = imageUrlRegex.Matches(pageText); foreach (Match m in matches) { string imageName = m.Groups[ImageRegexGroup].Value; string folderName = m.Groups[FolderRegexGroup].Value; var list = ServerModel.DB.LookupIds <TblFiles>(page, null); var files = ServerModel.DB.Load <TblFiles>(list); string newUrl = string.Concat(ImageFileRequest, FindFileId(files, folderName, imageName)); pageText = pageText.Replace(m.Groups[UrlRegexGroup].Value, newUrl); } return(pageText); }
public virtual async Task UpdateAsync(TblPages record) { var oldRecord = await FindByIdAsync(record.Id); if (record.ShowAsWebsiteDefaultPage && record.Published) { await _dbContext.Pages.Where(p => p.ShowAsWebsiteDefaultPage) .UpdateAsync(p => new TblPages() { ShowAsWebsiteDefaultPage = false }); } _dbContext.Pages.AddOrUpdate(record); await _dbContext.SaveChangesAsync(); QueryCacheManager.ExpireTag(CacheTags.Page); _eventPublisher.EntityUpdated(record, oldRecord); }
private void ShowPage() { if (PageId != 0) { TblPages page = GetPage(PageId); var questions = ServerModel.DB.Load <TblQuestions>(ServerModel.DB.LookupIds <TblQuestions>(page, null)); SetHeader(page); AddControl(page); MaxPageRank.Value = GetMaxRank(questions).ToString(); PageRank.Value = ((int)page.PageRank).ToString(); QuestionCount.Value = (questions.Count).ToString(); } else { throw new Exception("Page ID is not specified"); } }
private void SetDescription(TblPages p) { Description.Value = string.Format("You open {0}({1}) page", p.PageName, (FX_PAGETYPE)p.PageTypeRef); PageCount.Value = string.Format("{0}/{1}", PageIndex + 1, _pages.Length); }
private void SetHeader(TblPages page) { PageTitle.Value = GetPageTitleType(); PageHeader.Value = string.Format("{0} for Page: {1}", GetPageTitleType(), page.PageName); }
private static void AddPageFileToPage(TblPages page, int fileID) { page.PageFile = fileID.ToString(); ServerModel.DB.Update(page); }
private void SetDescription(TblPages p) { Description.Value = string.Format("You open {0}({1}) page", p.PageName, (FX_PAGETYPE) p.PageTypeRef); PageCount.Value = string.Format("{0}/{1}", PageIndex + 1, _pages.Length); }
public static Control GetTheoryControl(TblPages page, Panel p) { p.ScrollBars = ScrollBars.None; return(p.Page.ParseControl(string.Format(@"<IFRAME ID=""_iFrame"" width=""100%"" height=""100%"" Runat=""Server"" src=""DisplayTheory.itp?PageId={0}""></IFRAME>", page.ID))); }
private static void AddPageFileToPage(TblPages page, byte[] pageFile) { page.PageFile = pageFile; ServerModel.DB.Update(page); }
public static IList<TblQuestions> QuestionsOfPage(TblPages page) { return ServerModel.DB.Query<TblQuestions>(new CompareCondition<int>( DataObject.Schema.PageRef, new ValueCondition<int>(page.ID), COMPARE_KIND.EQUAL)); }
private static string GetControlString(TblPages page) { string controlString = Encoding.Unicode.GetString(page.PageFile.ToArray()); return controlString; }
private static string GetControlString(TblPages page) { string controlString = Encoding.Unicode.GetString(page.PageFile.ToArray()); return(controlString); }
public static Control GetTheoryControl(TblPages page, Panel p) { p.ScrollBars = ScrollBars.None; return p.Page.ParseControl(string.Format(@"<IFRAME ID=""_iFrame"" width=""100%"" height=""100%"" Runat=""Server"" src=""DisplayTheory.itp?PageId={0}""></IFRAME>", page.ID)); }
public static IList <TblQuestions> GetQuestionsForPage(TblPages page) { var questionsIDs = ServerModel.DB.LookupIds <TblQuestions>(page, null); return(ServerModel.DB.Load <TblQuestions>(questionsIDs)); }
private static void CheckPageType(TblPages page) { if(page.PageTypeRef != (int?) FX_PAGETYPE.Theory) throw new Exception("Wrong handler for page"); }
public static IList <TblQuestions> QuestionsOfPage(TblPages page) { return(ServerModel.DB.Query <TblQuestions>(new CompareCondition <int>( DataObject.Schema.PageRef, new ValueCondition <int>(page.ID), COMPARE_KIND.EQUAL))); }
public static IList<TblQuestions> GetQuestionsForPage(TblPages page) { var questionsIDs = ServerModel.DB.LookupIds<TblQuestions>(page, null); return ServerModel.DB.Load<TblQuestions>(questionsIDs); }
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); } } }