예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!is_two)
            {
                this.temp_rb            = new List <int>();
                this.temp_user_ans_text = new List <string>();

                if ((!checkBox1.Checked) && (!checkBox2.Checked) &&
                    (!checkBox3.Checked) && (!checkBox4.Checked) &&
                    (!checkBox5.Checked) && (!checkBox6.Checked))
                {
                    MessageBox.Show("Пожалуйста, выберите ответ!");
                }
                else
                {
                    //check ans after press next question
                    if (checkBox1.Checked)
                    {
                        user_ans_bool.Add(model6.check_ans_2[x].Contains(label2.Text));
                        temp_rb.Add(1);
                        temp_user_ans_text.Add(label2.Text);
                    }

                    else if (checkBox2.Checked)
                    {
                        user_ans_bool.Add(model6.check_ans_2[x].Contains(label3.Text));
                        temp_rb.Add(2);
                        temp_user_ans_text.Add(label3.Text);
                    }

                    else if (checkBox3.Checked)
                    {
                        user_ans_bool.Add(model6.check_ans_2[x].Contains(label4.Text));
                        temp_rb.Add(3);
                        temp_user_ans_text.Add(label4.Text);
                    }

                    else if (checkBox4.Checked)
                    {
                        user_ans_bool.Add(model6.check_ans_2[x].Contains(label5.Text));
                        temp_rb.Add(4);
                        temp_user_ans_text.Add(label5.Text);
                    }

                    else if (checkBox5.Checked)
                    {
                        user_ans_bool.Add(model6.check_ans_2[x].Contains(label6.Text));
                        temp_rb.Add(5);
                        temp_user_ans_text.Add(label6.Text);
                    }

                    else if (checkBox6.Checked)
                    {
                        user_ans_bool.Add(model6.check_ans_2[x].Contains(label7.Text));
                        temp_rb.Add(6);
                        temp_user_ans_text.Add(label7.Text);
                    }

                    rb_2.Add(temp_rb);
                    user_ans_text_2.Add(temp_user_ans_text);

                    /*for (int i = 0; i < user_ans_text_2[user_ans_text_2.Count - 1].Count; i++)
                     * {
                     *  MessageBox.Show(user_ans_text_2[user_ans_text_2.Count - 1][i].ToString());
                     * }*/

                    ans_this_test_2.Add(model6.check_ans_2[x]);
                    model6.check_ans_2.RemoveAt(x);

                    if (question_number < 20)
                    {
                        checkBox1.Checked = false;
                        checkBox2.Checked = false;
                        checkBox3.Checked = false;
                        checkBox4.Checked = false;
                        checkBox5.Checked = false;
                        checkBox6.Checked = false;
                        question_number++;
                        func(question_number);
                    }
                    else
                    {
                        model6.user_ans_bool               = user_ans_bool;
                        model6.answers_fix                 = answers_fix;
                        model6.questions_fix               = questions_fix;
                        model6.rb_2                        = rb_2;
                        model6.ans_this_test               = ans_this_test;
                        model6.ans_this_test_2             = ans_this_test_2;
                        model6.user_ans_text_2             = user_ans_text_2;
                        model6.is_2_ans_question_this_test = is_2_ans_question_this_test;

                        //show last form
                        Form7 form7 = new Form7(model6);
                        form7.Show();

                        this.Hide();
                    }
                }
            }
            else
            {
                this.temp_rb            = new List <int>();
                this.temp_user_ans_text = new List <string>();
                int tmp = 0;
                foreach (CheckBox c in this.Controls.OfType <CheckBox>())
                {
                    if (c.Checked)
                    {
                        tmp++;
                    }
                }
                if (tmp != 2)
                {
                    MessageBox.Show("Пожалуйста, выберите 2 ответа!");
                }
                else
                {
                    user_ans_bool.Add(true);
                    //check ans after press next question
                    if (checkBox1.Checked)
                    {
                        user_ans_bool[question_number - 1] &= model6.check_ans_2[x].Contains(label2.Text);
                        temp_rb.Add(1);
                        temp_user_ans_text.Add(label2.Text);
                    }

                    if (checkBox2.Checked)
                    {
                        user_ans_bool[question_number - 1] &= model6.check_ans_2[x].Contains(label3.Text);
                        temp_rb.Add(2);
                        temp_user_ans_text.Add(label3.Text);
                    }

                    if (checkBox3.Checked)
                    {
                        user_ans_bool[question_number - 1] &= model6.check_ans_2[x].Contains(label4.Text);
                        temp_rb.Add(3);
                        temp_user_ans_text.Add(label4.Text);
                    }

                    if (checkBox4.Checked)
                    {
                        user_ans_bool[question_number - 1] &= model6.check_ans_2[x].Contains(label5.Text);
                        temp_rb.Add(4);
                        temp_user_ans_text.Add(label5.Text);
                    }

                    if (checkBox5.Checked)
                    {
                        user_ans_bool[question_number - 1] &= model6.check_ans_2[x].Contains(label6.Text);
                        temp_rb.Add(5);
                        temp_user_ans_text.Add(label6.Text);
                    }

                    if (checkBox6.Checked)
                    {
                        user_ans_bool[question_number - 1] &= model6.check_ans_2[x].Contains(label7.Text);
                        temp_rb.Add(6);
                        temp_user_ans_text.Add(label7.Text);
                    }

                    rb_2.Add(temp_rb);
                    user_ans_text_2.Add(temp_user_ans_text);

                    /*for (int i = 0; i < user_ans_text_2[user_ans_text_2.Count - 1].Count; i++)
                     * {
                     *  MessageBox.Show(user_ans_text_2[user_ans_text_2.Count - 1][i].ToString());
                     * }*/

                    ans_this_test_2.Add(model6.check_ans_2[x]);
                    model6.check_ans_2.RemoveAt(x);

                    if (question_number < 20)
                    {
                        checkBox1.Checked = false;
                        checkBox2.Checked = false;
                        checkBox3.Checked = false;
                        checkBox4.Checked = false;
                        checkBox5.Checked = false;
                        checkBox6.Checked = false;
                        question_number++;
                        func(question_number);
                    }
                    else
                    {
                        model6.user_ans_bool               = user_ans_bool;
                        model6.answers_fix                 = answers_fix;
                        model6.questions_fix               = questions_fix;
                        model6.rb_2                        = rb_2;
                        model6.ans_this_test               = ans_this_test;
                        model6.ans_this_test_2             = ans_this_test_2;
                        model6.user_ans_text_2             = user_ans_text_2;
                        model6.is_2_ans_question_this_test = is_2_ans_question_this_test;

                        //show last form
                        Form7 form7 = new Form7(model6);
                        form7.Show();

                        this.Hide();
                    }
                }
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!model8.is_2_ans_question_this_test[index])
            {
                this.temp_rb            = new List <int>();
                this.temp_user_ans_text = new List <string>();

                if ((!checkBox1.Checked) && (!checkBox2.Checked) &&
                    (!checkBox3.Checked) && (!checkBox4.Checked) &&
                    (!checkBox5.Checked) && (!checkBox6.Checked))
                {
                    MessageBox.Show("Пожалуйста, выберите ответ!");
                }
                else
                {
                    //check ans after press next question
                    if (checkBox1.Checked)
                    {
                        model8.user_ans_bool[index] = model8.ans_this_test_2[index].Contains(label2.Text);
                        temp_rb.Add(1);
                        temp_user_ans_text.Add(label2.Text);
                    }

                    else if (checkBox2.Checked)
                    {
                        model8.user_ans_bool[index] = model8.ans_this_test_2[index].Contains(label3.Text);
                        temp_rb.Add(2);
                        temp_user_ans_text.Add(label3.Text);
                    }

                    else if (checkBox3.Checked)
                    {
                        model8.user_ans_bool[index] = model8.ans_this_test_2[index].Contains(label4.Text);
                        temp_rb.Add(3);
                        temp_user_ans_text.Add(label4.Text);
                    }

                    else if (checkBox4.Checked)
                    {
                        model8.user_ans_bool[index] = model8.ans_this_test_2[index].Contains(label5.Text);
                        temp_rb.Add(4);
                        temp_user_ans_text.Add(label5.Text);
                    }

                    else if (checkBox5.Checked)
                    {
                        model8.user_ans_bool[index] = model8.ans_this_test_2[index].Contains(label6.Text);
                        temp_rb.Add(5);
                        temp_user_ans_text.Add(label6.Text);
                    }

                    else if (checkBox6.Checked)
                    {
                        model8.user_ans_bool[index] = model8.ans_this_test_2[index].Contains(label7.Text);
                        temp_rb.Add(6);
                        temp_user_ans_text.Add(label7.Text);
                    }

                    model8.rb_2[index]            = temp_rb;
                    model8.user_ans_text_2[index] = temp_user_ans_text;

                    //show last form
                    Form7 form7 = new Form7(model8);
                    form7.Show();

                    this.Hide();
                }
            }
            else
            {
                this.temp_rb            = new List <int>();
                this.temp_user_ans_text = new List <string>();
                int tmp = 0;
                foreach (CheckBox c in this.Controls.OfType <CheckBox>())
                {
                    if (c.Checked)
                    {
                        tmp++;
                    }
                }
                if (tmp != 2)
                {
                    MessageBox.Show("Пожалуйста, выберите 2 ответа!");
                }
                else
                {
                    //check ans after press next question
                    if (checkBox1.Checked)
                    {
                        model8.user_ans_bool[index]  = true;
                        model8.user_ans_bool[index] &= model8.ans_this_test_2[index].Contains(label2.Text);
                        temp_rb.Add(1);
                        temp_user_ans_text.Add(label2.Text);
                    }

                    if (checkBox2.Checked)
                    {
                        model8.user_ans_bool[index]  = true;
                        model8.user_ans_bool[index] &= model8.ans_this_test_2[index].Contains(label3.Text);
                        temp_rb.Add(2);
                        temp_user_ans_text.Add(label3.Text);
                    }

                    if (checkBox3.Checked)
                    {
                        model8.user_ans_bool[index]  = true;
                        model8.user_ans_bool[index] &= model8.ans_this_test_2[index].Contains(label4.Text);
                        temp_rb.Add(3);
                        temp_user_ans_text.Add(label4.Text);
                    }

                    if (checkBox4.Checked)
                    {
                        model8.user_ans_bool[index]  = true;
                        model8.user_ans_bool[index] &= model8.ans_this_test_2[index].Contains(label5.Text);
                        temp_rb.Add(4);
                        temp_user_ans_text.Add(label5.Text);
                    }

                    if (checkBox5.Checked)
                    {
                        model8.user_ans_bool[index]  = true;
                        model8.user_ans_bool[index] &= model8.ans_this_test_2[index].Contains(label6.Text);
                        temp_rb.Add(5);
                        temp_user_ans_text.Add(label6.Text);
                    }

                    if (checkBox6.Checked)
                    {
                        model8.user_ans_bool[index]  = true;
                        model8.user_ans_bool[index] &= model8.ans_this_test_2[index].Contains(label7.Text);
                        temp_rb.Add(6);
                        temp_user_ans_text.Add(label7.Text);
                    }

                    model8.rb_2[index]            = temp_rb;
                    model8.user_ans_text_2[index] = temp_user_ans_text;

                    //show last form
                    Form7 form7 = new Form7(model8);
                    form7.Show();

                    this.Hide();
                }
            }
        }