Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            DBworker DBworker = new DBworker();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || comboBox1.Text == "" || maskedTextBox1.Text == "")
            {
                MessageBox.Show("ВСЕ ПОЛЯ ОБЯЗАТЕЛЬНЫ К ЗАПОЛЕНИЮ");
            }
            else
            {
                DBworker.addUser(textBox2.Text, textBox1.Text, maskedTextBox1.Text, textBox3.Text, (user.permtype)comboBox1.SelectedIndex);
                MessageBox.Show("Регистрация успешна!");
                Close();
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            DBworker DBworker = new DBworker();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || maskedTextBox1.Text == "")
            {
                MessageBox.Show("ВСЕ ПОЛЯ кроме PermKey ОБЯЗАТЕЛЬНЫ К ЗАПОЛЕНИЮ");
            }
            else
            {
                DBworker.newUser(textBox2.Text, textBox1.Text, maskedTextBox1.Text, textBox3.Text, maskedTextBox2.Text);
                MessageBox.Show("Регистрация успешна!");
                Close();
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e) //login
        {
            DBworker DBworker = new DBworker();
            user     user     = DBworker.login(textBox1.Text, textBox2.Text);

            if (user != null)
            {
                MessageBox.Show("ПРАВА: " + user.Permissions);
                if (user.Permissions == user.permtype.admin)
                {
                    TestDesk form = new TestDesk(user);
                    Hide();
                    form.ShowDialog();
                    Show();
                }
                else if (user.Permissions == user.permtype.teacher)
                {
                    TestDesk form = new TestDesk(user);
                    Hide();
                    form.ShowDialog();
                    Show();
                }
                else if (user.Permissions == user.permtype.studen)
                {
                    TestDesk form = new TestDesk(user);
                    Hide();
                    form.ShowDialog();
                    Show();
                }
                else if (user.Permissions == user.permtype.cheater)
                {
                    TestDesk form = new TestDesk(user);
                    Hide();
                    form.ShowDialog();
                    Show();
                }
                else if (user.Permissions == user.permtype.CAHR)
                {
                    TestDesk form = new TestDesk(user);
                    Hide();
                    form.ShowDialog();
                    Show();
                }
            }
        }
Ejemplo n.º 4
0
        void points()  // ЩИТАЕМ БАЛЛЫ С КОЗЛЁНКОМ!!!
        {
            int balls  = 0;
            int eballs = 0;
            int mballs = 0;

            for (int n = 0; n < questions.questions.Length; n++)
            {
                int tempcnt  = 0;
                int mtempcnt = 0;
                eballs += questions.questionsPoints[n];

                /*
                 * if (questions.questions[n].trueanswer.Equals(checks[n]))
                 * { balls++; }
                 */
                for (int m = 0; m < questions.questions[n].trueanswer.Length; m++)
                {
                    if (questions.questions[n].qtype != question.questiontypes.text)
                    {
                        if (checks[n][m] == questions.questions[n].trueanswer[m])
                        {
                            tempcnt++;
                        }
                        else if (checks[n][m] == questions.questions[n].trueanswer[m])
                        {
                            mtempcnt++;
                        }
                    }
                    else
                    {
                        if (txt[n].ToLower().Trim(new char[] { ' ', ',', '.', '!', '?' }) == questions.questions[n].answerstext[m].ToLower().Trim(new char[] { ' ', ',', '.', '!', '?' }))
                        {
                            tempcnt  = questions.questions[n].trueanswer.Length;
                            mtempcnt = 0;
                            break;
                        }
                        else
                        {
                            mtempcnt++;
                        }
                    }
                }
                if (tempcnt == questions.questions[n].trueanswer.Length)
                {
                    balls++;
                }
                else if (mtempcnt > 0)
                {
                    mballs++;
                }
            }
            if ((User.Permissions == user.permtype.cheater || User.Permissions == user.permtype.CAHR) && balls < (eballs / 2))
            {
                if (User.Permissions == user.permtype.cheater)
                {
                    int sballs = (eballs - balls);
                    if (sballs >= (eballs / 2))
                    {
                        balls += (eballs - sballs);
                    }
                }
                else if (User.Permissions == user.permtype.CAHR)
                {
                    balls += (eballs / 10);
                }
            }
            MessageBox.Show("Вы набрали " + balls + " из " + eballs
                            //+ "\n Неточных ответов - " + mballs
                            , "Итог");
            DBworker DBworker = new DBworker();

            DBworker.addResult(User, balls, testName);
        }