Esempio n. 1
0
 private void InsertUpdateChapter(ref Chapter chapter)
 {
     chapter.Chapter_Name = txtChapterChapterName.Text;
     chapter.Chapter_No   = Convert.ToInt32(nudChapterChapterNo.Value);
     chapter.Description  = txtChapterDescrption.Text;
     chapter.Subject_ID   = ComboboxKVP.GetIDFromComboBox(combChapterSubjectName);
 }
Esempio n. 2
0
        private void CombTestChapters_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurrentChapter = combTestChapters.Text;
            int chapter_ID = ComboboxKVP.GetIDFromComboBox(combTestChapters);

            tests = dbContext.Logs.Where(x => x.Chapter_ID == chapter_ID).ToList();
            TestGenerate();
        }
Esempio n. 3
0
        private void CombChapterSubjectName_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurrentSubject = combChapterSubjectName.Text;
            gvChapter.AutoGenerateColumns = false;
            int subID = ComboboxKVP.GetIDFromComboBox(combChapterSubjectName);

            gvChapter.DataSource = dbContext.Chapters
                                   .Where(x => x.Subject.ID == subID)
                                   .OrderBy(x => x.Chapter_No).ToList();
        }
Esempio n. 4
0
 private void CombSearchChapter_SelectedIndexChanged(object sender, EventArgs e)
 {
     CurrentChapter = combSearchChapter.Text;
     if (DoThat)
     {
         int chapter_ID = ComboboxKVP.GetIDFromComboBox(combSearchChapter);
         gvSearch.AutoGenerateColumns = false;
         gvSearch.DataSource          = dbContext.Logs
                                        .Where(x => x.Chapter_ID == chapter_ID).ToList();
     }
 }
Esempio n. 5
0
 private void CombLibraryQuestion_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ckbLibraryAutoFunctionaility.Checked)
     {
         int ID = ComboboxKVP.GetIDFromComboBox(combLibraryQuestion);
         if (ID > 0)
         {
             Log log = dbContext.Logs.FirstOrDefault(x => x.ID == ID);
             FillLibrary(log);
         }
     }
 }
Esempio n. 6
0
 private void InsertUpdateLog(ref Log newLog)
 {
     newLog.Chapter_ID  = ComboboxKVP.GetIDFromComboBox(combLibraryChapters);
     newLog.Answer      = txtLibraryAnswer.Text;
     newLog.Question    = combLibraryQuestion.Text;
     newLog.Hint_1      = txtLibraryHint1.Text;
     newLog.Hint_2      = txtLibraryHint2.Text;
     newLog.Hint_3      = txtLibraryHint3.Text;
     newLog.Type_ID     = ComboboxKVP.GetIDFromComboBox(combLibraryType);
     newLog.Level       = Convert.ToInt32(nudLibraryLevel.Value);
     newLog.Description = txtLibraryDescription.Text;
 }
Esempio n. 7
0
        private void FillQuestion(ComboBox chapter, ComboBox question)
        {
            CurrentChapter = chapter.Text;
            question.Items.Clear();
            int chapter_id = ComboboxKVP.GetIDFromComboBox(chapter);

            ComboboxKVP[] questions = dbContext.Logs
                                      .Where(x => x.Chapter_ID == chapter_id)
                                      .Select(y => new ComboboxKVP()
            {
                ID = y.ID, Text = y.Question
            }).ToArray();
            if (questions.Count() > 0 && CurrentChapter != "")
            {
                question.Items.AddRange(questions);
                question.SelectedIndex = 0;
            }
        }
Esempio n. 8
0
        private void TestGenerate()
        {
            int subject_ID = ComboboxKVP.GetIDFromComboBox(combTestSubject);
            int chapter_ID = ComboboxKVP.GetIDFromComboBox(combTestChapters);

            if (combTestChapters.Text == "")
            {
                tests = dbContext.Logs.Where(x => x.Chapter.Subject_ID == subject_ID).ToList();
            }
            else
            {
                tests = dbContext.Logs.Where(x => x.Chapter_ID == chapter_ID).ToList();
            }
            if (tests.Count > 0)
            {
                TotalQuestions = tests.Count();
                LastAttempt    = 0;
                TestFillControl(LastAttempt);
            }
        }
Esempio n. 9
0
        private void FillChapters(ComboBox subject, ComboBox chapter)
        {
            CurrentSubject = subject.Text;
            chapter.Items.Clear();
            int subid = ComboboxKVP.GetIDFromComboBox(subject);

            ComboboxKVP[] chapters = dbContext.Chapters
                                     .Where(x => x.Subject_ID == subid)
                                     .OrderBy(x => x.Chapter_No).ToList()
                                     .Select(y => new ComboboxKVP()
            {
                ID = y.ID, Text = "Part " + y.Chapter_No + " " + y.Chapter_Name
            }).ToArray();
            chapter.Items.AddRange(chapters);
            if (chapters.Count() > 0 && CurrentChapter != "")
            {
                chapter.Text = CurrentChapter;
            }
            if (chapters.Count() > 0 && chapter.SelectedIndex < 0)
            {
                chapter.SelectedIndex = 0;
            }
        }