Exemplo n.º 1
0
 public static classQuiz getQuestions(classQuiz objQuiz, int q_id)
 {
     using (var conn = new SQLiteConnection(dbname))
     {
         using (var query = conn.Prepare(string.Format(@"select * from quiz where q_id = {0};", q_id)))
         {
             while (query.Step() == SQLiteResult.ROW)
             {
                 objQuiz = new classQuiz
                 {
                     q_id       = Convert.ToInt32(query[0].ToString()),
                     q_ques     = query[1].ToString(),
                     q_topic    = Convert.ToInt32(query[2].ToString()),
                     q_level    = Convert.ToInt32(query[3].ToString()),
                     correctOpt = query[4].ToString(),
                     Opt1       = query[5].ToString(),
                     Opt2       = query[6].ToString(),
                     Opt3       = query[7].ToString(),
                     Opt4       = query[8].ToString(),
                     c_id       = Convert.ToInt32(query[9].ToString())
                 };
             }
         }
     }
     return(objQuiz);
 }
Exemplo n.º 2
0
 private void getQuesInfo()
 {
     objCurrentQues = dbHelperClass.getQuestions(objCurrentQues, quesCount);
     quesCount++;
     tbQues.Text = objCurrentQues.q_ques;
     rb1.Content = objCurrentQues.Opt1;
     rb2.Content = objCurrentQues.Opt2;
     rb3.Content = objCurrentQues.Opt3;
     rb4.Content = objCurrentQues.Opt4;
     if (beginCount <= 5 && !UtilityData.isBeginDone)
     {
         beginCount++;
     }
     else if (intermidiateCount <= 5 && !UtilityData.isIntermdiateDone)
     {
         intermidiateCount++;
     }
     else if (advancedCount <= 5 && !UtilityData.isAdvancedDone)
     {
         advancedCount++;
     }
 }
Exemplo n.º 3
0
 private void btTestYourself_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         correctAns            = 0;
         spTest.Visibility     = Visibility.Visible;
         spResult.Visibility   = Visibility.Collapsed;
         currentQuesCount      = 0;
         gdTestQues.Visibility = Visibility.Visible;
         dbHelperClass.getTestQuestions(obcQuiz, UtilityData.objCurrentCourse.c_id);
         classQuiz objQuiz = (classQuiz)obcQuiz[0];
         tbQues.Text = objQuiz.q_ques;
         rb1.Content = objQuiz.Opt1;
         rb2.Content = objQuiz.Opt2;
         rb3.Content = objQuiz.Opt3;
         rb4.Content = objQuiz.Opt4;
         currentQuesCount++;
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 4
0
        private void btNext_Click(object sender, RoutedEventArgs e)
        {
            if ((bool)rb1.IsChecked || (bool)rb2.IsChecked || (bool)rb3.IsChecked || (bool)rb4.IsChecked)
            {
                try
                {
                    if (currentQuesCount <= 3)
                    {
                        if ((bool)rb1.IsChecked)
                        {
                            if (obcQuiz[currentQuesCount - 1].correctOpt == rb1.Content.ToString())
                            {
                                correctAns++;
                            }
                        }
                        else if ((bool)rb2.IsChecked)
                        {
                            if (obcQuiz[currentQuesCount - 1].correctOpt == rb2.Content.ToString())
                            {
                                correctAns++;
                            }
                        }
                        else if ((bool)rb3.IsChecked)
                        {
                            if (obcQuiz[currentQuesCount - 1].correctOpt == rb3.Content.ToString())
                            {
                                correctAns++;
                            }
                        }
                        else
                        if (obcQuiz[currentQuesCount - 1].correctOpt == rb4.Content.ToString())
                        {
                            correctAns++;
                        }

                        if (currentQuesCount == 3)
                        {
                            spTest.Visibility   = Visibility.Collapsed;
                            spResult.Visibility = Visibility.Visible;
                            tbCorrectAns.Text   = correctAns.ToString();
                            if (correctAns <= 2)
                            {
                                spRecommend.Visibility = Visibility.Visible;
                            }
                        }
                        if (currentQuesCount <= 2)
                        {
                            classQuiz objQuiz = obcQuiz[currentQuesCount];
                            tbQues.Text = objQuiz.q_ques;
                            rb1.Content = objQuiz.Opt1;
                            rb2.Content = objQuiz.Opt2;
                            rb3.Content = objQuiz.Opt3;
                            rb4.Content = objQuiz.Opt4;
                            currentQuesCount++;
                        }
                    }
                    rb1.IsChecked = false;
                    rb2.IsChecked = false;
                    rb3.IsChecked = false;
                    rb4.IsChecked = false;
                }
                catch (Exception)
                {
                }
            }
        }