Example #1
0
        public UcQuestion(int qnumber, Question question)
        {
            InitializeComponent();

            label1.Text = qnumber + ". " + question.question;
            this.qnumber = qnumber;
            label2.Text = question.answer1;
            label3.Text = question.answer2;
            label4.Text = question.answer3;
            label5.Text = question.answer4;

            //Random random = new Random();
            //HashSet<int> numbers = new HashSet<int>();
            //while (numbers.Count < 4)
            //{
            //    numbers.Add(random.Next(1, 4));
            //}

            this.rightAnswer = question.rightAnswer;

            this.radioButton1.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
            this.radioButton2.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
            this.radioButton3.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
            this.radioButton4.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
        }
Example #2
0
        public UcQuestionRead(int qnumber, Question question)
        {
            InitializeComponent();

            label1.Text = "АСУУЛТ:"+qnumber + ":\n " + question.question;
            this.qnumber = qnumber;
            label2.Text = question.answer1;
        }
Example #3
0
        public UcQuestionTest(int qnumber, Question question)
        {
            InitializeComponent();
            label1.Text = qnumber +". "+ question.question;
            this.qnumber = qnumber;
            radioButton1.Text = question.answer1;
            radioButton2.Text = question.answer2;
            radioButton3.Text = question.answer3;
            radioButton4.Text = question.answer4;

            this.rightAnswer = question.rightAnswer;

            this.radioButton1.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
            this.radioButton2.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
            this.radioButton3.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
            this.radioButton4.CheckedChanged += new System.EventHandler(this.AllCheckBoxes_CheckedChanged);
        }
Example #4
0
 public List<Question> GetQuestionsByGroupId(int groupId)
 {
     List<Question> response = new List<Question>();
     try
     {
         this.OpenConnection();
         OleDbDataReader reader = null;  // This is OleDb Reader
         OleDbCommand cmd = new OleDbCommand(" select * from question where groupingID = " + groupId, _connection);
         reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             Question q = new Question();
             q.qid = Int32.Parse(reader["QID"].ToString());
             q.question = reader["Question"].ToString();
             q.answer1 = reader["Answer1"].ToString();
             q.answer2 = reader["Answer2"].ToString();
             q.answer3 = reader["Answer3"].ToString();
             q.answer4 = reader["Answer4"].ToString();
             q.rightAnswer = Int32.Parse(reader["RightAnswer"].ToString());
             q.groupId = Int32.Parse(reader["groupingID"].ToString());
             response.Add(q);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return null;
     }
     finally
     {
         this.CloseConnection();
     }
     return response;
 }