Exemple #1
0
        /// <summary>
        /// method for creating questions
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btAddQ_Click(object sender, EventArgs e)
        {
            try
            {///creating new object of ListViewItem to fill it new data
                this.listView1.Items.Add(new ListViewItem(new string[] { "", "", "", "", "", "" }));
                foreach (ListViewItem i in this.listView1.Items)
                {///delegates to getting data from ADDdataform
                    General.GetQ   = () => i.SubItems[(int)Nums.Null].Text;
                    General.GetA   = () => i.SubItems[(int)Nums.One].Text;
                    General.GetB   = () => i.SubItems[(int)Nums.Two].Text;
                    General.GetC   = () => i.SubItems[(int)Nums.Three].Text;
                    General.GetD   = () => i.SubItems[(int)Nums.Four].Text;
                    General.GetCor = () => i.SubItems[(int)Nums.Five].Text;

                    ///delegates to setting data to ADDdataform
                    General.SetQ   = (x) => i.SubItems[(int)Nums.Null].Text = x;
                    General.SetA   = (x) => i.SubItems[(int)Nums.One].Text = x;
                    General.SetB   = (x) => i.SubItems[(int)Nums.Two].Text = x;
                    General.SetC   = (x) => i.SubItems[(int)Nums.Three].Text = x;
                    General.SetD   = (x) => i.SubItems[(int)Nums.Four].Text = x;
                    General.SetCor = (x) => i.SubItems[(int)Nums.Five].Text = x;
                }
                ///create & open ADDdataform
                var add = new ADD_data();
                add.ShowDialog();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Exemple #2
0
        /// <summary>
        /// correct data of selected items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCorrect_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.listView1.SelectedIndices == null)
                {
                    return;
                }
                else
                {
                    foreach (ListViewItem i in this.listView1.SelectedItems)
                    {
                        General.GetQ   = () => i.SubItems[(int)Nums.Null].Text;
                        General.GetA   = () => i.SubItems[(int)Nums.One].Text;
                        General.GetB   = () => i.SubItems[(int)Nums.Two].Text;
                        General.GetC   = () => i.SubItems[(int)Nums.Three].Text;
                        General.GetD   = () => i.SubItems[(int)Nums.Four].Text;
                        General.GetCor = () => i.SubItems[(int)Nums.Five].Text;

                        ///delegates to setting data to ADDdataform
                        General.SetQ   = (x) => i.SubItems[(int)Nums.Null].Text = x;
                        General.SetA   = (x) => i.SubItems[(int)Nums.One].Text = x;
                        General.SetB   = (x) => i.SubItems[(int)Nums.Two].Text = x;
                        General.SetC   = (x) => i.SubItems[(int)Nums.Three].Text = x;
                        General.SetD   = (x) => i.SubItems[(int)Nums.Four].Text = x;
                        General.SetCor = (x) => i.SubItems[(int)Nums.Five].Text = x;
                        var add = new ADD_data();
                        add.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
        /// <summary>
        /// method for passing the test
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btStart_Click(object sender, EventArgs e)
        {
            int    count     = (int)Nums.Null;
            string coransw   = null;
            int    questions = (int)Nums.Null;

            try
            {
                if (this.tbName.Text == string.Empty || this.tbFname.Text == string.Empty || this.tbLname.Text == string.Empty)
                {
                    MessageBox.Show("Необходимо ввести ФИО, группу и выбрать предмет!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    if (rbNet.Checked || rbPlus.Checked)
                    {
                        this.listView1.Items.Clear();
                        this.btLoadTest_Click(sender, e);
                        //timer1.Interval = 10000;
                        //this.timer1.Enabled = true;

                        foreach (ListViewItem i in this.listView1.Items)
                        {///delegates to getting data from ADDdataform
                            General.GetQ   = () => i.SubItems[(int)Nums.Null].Text;
                            General.GetA   = () => i.SubItems[(int)Nums.One].Text;
                            General.GetB   = () => i.SubItems[(int)Nums.Two].Text;
                            General.GetC   = () => i.SubItems[(int)Nums.Three].Text;
                            General.GetD   = () => i.SubItems[(int)Nums.Four].Text;
                            General.GetCor = () => i.SubItems[(int)Nums.Five].Text;

                            ///delegates to setting data to ADDdataform
                            General.SetQ   = (x) => i.SubItems[(int)Nums.Null].Text = x;
                            General.SetA   = (x) => i.SubItems[(int)Nums.One].Text = x;
                            General.SetB   = (x) => i.SubItems[(int)Nums.Two].Text = x;
                            General.SetC   = (x) => i.SubItems[(int)Nums.Three].Text = x;
                            General.SetD   = (x) => i.SubItems[(int)Nums.Four].Text = x;
                            General.SetCor = (x) => i.SubItems[(int)Nums.Five].Text = x;

                            coransw = i.SubItems[(int)Nums.Five].Text;

                            ///create & open ADDdataform
                            var add = new ADD_data();
                            add.tbCorrect.Visible = false;
                            add.lbcoransw.Visible = false;
                            add.ShowDialog();
                            this.tbCoransw.Text = count.ToString();

                            if (add.rbA.Checked)
                            {
                                if (coransw == "1")
                                {
                                    count++;
                                }
                            }
                            if (add.rbB.Checked)
                            {
                                if (coransw == "2")
                                {
                                    count++;
                                }
                            }
                            if (add.rbC.Checked)
                            {
                                if (coransw == "3")
                                {
                                    count++;
                                }
                            }
                            if (add.rbD.Checked)
                            {
                                if (coransw == "4")
                                {
                                    count++;
                                }
                            }

                            this.tbCoransw.Text = count.ToString();
                            questions++;
                        }
                        {
                            var res = count * (int)Nums.Onehundred / questions;
                            if (res > (int)Nums.Eighty)
                            {
                                this.tbRes.Text = "Сдан";
                            }
                            else
                            {
                                this.tbRes.Text = "Не сдан";
                            }
                            this.btSavetest_Click(sender, e);
                        }
                    }
                    if (!rbNet.Checked && !rbPlus.Checked)
                    {
                        MessageBox.Show("Пожалуйста, выберите предмет!", "Ошибка!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }