Esempio n. 1
0
        private void getques()
        {
            
            if (TotalQues==0)
            {
                score = 100 * nof_correct / (nof_correct+nof_unanswered+nof_wrong);
                System.Windows.MessageBox.Show("Correct: " + Convert.ToString(nof_correct) + " ,wrong: " + Convert.ToString(nof_wrong) + " ,Unanswered: " + Convert.ToString(nof_unanswered)+" : So, you scored : "+Convert.ToString(score)+"% in this session");
                DBProgressConnect DBProgressConnect_inst = new DBProgressConnect();
                //globaldata gb = new globaldata();
                DBProgressConnect_inst.Insert(globaldata.current_user, Convert.ToString(DateTime.Now), Convert.ToString(score));

                ActivitySelection Actv_Instnc = new ActivitySelection();
                this.Hide();
                Actv_Instnc.Show();
            }
            else
            {
                rdbtn1.IsChecked = false;
                rdbtn2.IsChecked = false;
                rdbtn3.IsChecked = false;
                rdbtn4.IsChecked = false;
                DBVocaConnect DBConnect_inst = new DBVocaConnect();
                int data_count = DBConnect_inst.Count();
                DataTable QuesLoadTable = new DataTable();
                QuesLoadTable = DBConnect_inst.Read();

                Random Rand_Gen = new Random();
                int[] x = new int[4];
                for (int j = 0; j < 4; j++)
                {
                    x[j] = Rand_Gen.Next(data_count + 1);
                }
                string ques;
                ques = QuesLoadTable.Rows[x[0]][1].ToString();
                ques = ques.Trim();
                txtblck1.Text = "Question: " + ques;
                CorrectAns = QuesLoadTable.Rows[x[0]][2].ToString();
                CorrectAns = CorrectAns.Trim();
                //label6.Content = "Database Entry: " + (x[0] + 1).ToString() + "\nCorrect Answer: " + CorrectAns;

                string[] AllAns = new string[4];
                for (int i = 0; i < 4; i++)
                {
                    AllAns[i] = QuesLoadTable.Rows[x[i]][2].ToString();
                }

                new Random().Shuffle(AllAns);

                rdbtn1.Content = AllAns[0].Trim();
                rdbtn2.Content = AllAns[1].Trim();
                rdbtn3.Content = AllAns[2].Trim();
                rdbtn4.Content = AllAns[3].Trim();

                TotalQues--;
            }
        }
Esempio n. 2
0
 private void Btn_Home_Click(object sender, RoutedEventArgs e)
 {
     ActivitySelection actv_inst = new ActivitySelection();
     this.Hide();
     actv_inst.Show();
 }
Esempio n. 3
0
 private void Btn_Back_Click(object sender, RoutedEventArgs e)
 {
     ActivitySelection Actv_Instnc = new ActivitySelection();
     this.Hide();
     Actv_Instnc.Show();
 }
Esempio n. 4
0
        private void Btn_Signin_Click(object sender, RoutedEventArgs e)
        {

            if (txtbx_user.Text=="" || passwordBox1.Password=="")
            {
                System.Windows.MessageBox.Show("Please enter username and password");
            }
            else
            {
                DBLoginConnect LoginDB = new DBLoginConnect();
                int upexists = LoginDB.UandP_Exists(txtbx_user.Text, passwordBox1.Password);
                if (upexists == 1)
                {
                    //globaldata gb = new globaldata();
                    //gb.current_user = txtbx_user.Text;
                    globaldata.current_user=txtbx_user.Text;
                    this.Hide();
                    ActivitySelection actvxml = new ActivitySelection();
                    actvxml.Show();
                }
                else
                {
                    System.Windows.MessageBox.Show("User does not exist!!");
                }
            }
            
        }