Ejemplo n.º 1
0
        public MovingTest(int test_id)
        {
            InitializeComponent();
            TestDB test = new TestDB(test_id);

            tbText.Text  = "Перемещение теста '" + test.name + "' в группу: ";
            this.test_id = test_id;
            TestsGroupDB obj = new TestsGroupDB();

            obj.Fill();

            // list групп для перемещения в неё
            Dictionary <string, string> test_group_list_move = new Dictionary <string, string>();

            for (int i = 0; i < obj.list_objects.Count; i++)
            {
                // Исключим из списка удаляемую группу, как?
                test_group_list_move.Add(obj.list_objects[i].id.ToString(), obj.list_objects[i].name);
            }

            cbTestGroupMove.DataSource    = new BindingSource(test_group_list_move, null);
            cbTestGroupMove.DisplayMember = "Value";
            cbTestGroupMove.ValueMember   = "Key";
            cbTestGroupMove.SelectedIndex = 0;
        }
Ejemplo n.º 2
0
        public DeleteTestsGroup()
        {
            InitializeComponent();
            TestsGroupDB obj = new TestsGroupDB();

            rbDeleteTest.Checked = true;
            obj.Fill();

            // list групп для удаления
            Dictionary <string, string> test_groups_list_delete = new Dictionary <string, string>();

            for (int i = 0; i < obj.list_objects.Count; i++)
            {
                test_groups_list_delete.Add(obj.list_objects[i].id.ToString(), obj.list_objects[i].name);
            }
            // list групп для перемещения в неё
            Dictionary <string, string> test_group_list_move = new Dictionary <string, string>();

            for (int i = 0; i < obj.list_objects.Count; i++)
            {
                // Исключим из списка удаляемую группу, как?
                test_group_list_move.Add(obj.list_objects[i].id.ToString(), obj.list_objects[i].name);
            }

            cbTestGroupDelete.DataSource    = new BindingSource(test_groups_list_delete, null);
            cbTestGroupDelete.DisplayMember = "Value";
            cbTestGroupDelete.ValueMember   = "Key";
            cbTestGroupDelete.SelectedIndex = 0;


            cbTestGroupMove.DataSource    = new BindingSource(test_group_list_move, null);
            cbTestGroupMove.DisplayMember = "Value";
            cbTestGroupMove.ValueMember   = "Key";
            cbTestGroupMove.SelectedIndex = 0;
        }
Ejemplo n.º 3
0
        private void btnConfirm_Click_1(object sender, EventArgs e)
        {
            string group_name = "";

            group_name = tbName.Text;
            TestsGroupDB tg = new TestsGroupDB();

            tg.name         = tbName.Text;
            tg.description  = tbDescription.Text;
            tg.comment      = tbComment.Text;
            tg.date_created = tbRegDate.Text;
            MainForm main_fm = (MainForm)Application.OpenForms["MainForm"];
            AdminDB  obj     = new AdminDB(main_fm.getAdminName());

            tg.owner_id = obj.id;
            tg.AddToDB();

            this.Close();
            MessageBox.Show("Группа " + group_name + " создана!");
        }
Ejemplo n.º 4
0
        private void btnConfirm_Click_1(object sender, EventArgs e)
        {
            this.Close();
            DialogResult dr = MessageBox.Show("Вы уверены, что хотите удалить объект?", "Вопрос", MessageBoxButtons.YesNo);

            switch (dr)
            {
            case DialogResult.Yes:
                // Получим список правил данной группы
                TestsDB rdb           = new TestsDB();
                int     group_from_id = Convert.ToInt32(((KeyValuePair <string, string>)cbTestGroupDelete.SelectedItem).Key);
                // Если удаляем тесты вместе с группой
                if (rbDeleteTest.Checked == true)
                {
                    rdb.DeleteByGroupId(group_from_id);
                }

                // Если перемещаем тесты группы в другую группу
                if (rbMoveTest.Checked == true)
                {
                    int group_to_move_id = Convert.ToInt32(((KeyValuePair <string, string>)cbTestGroupMove.SelectedItem).Key);
                    rdb.MoveToGroupId(group_from_id, group_to_move_id);
                }
                // Затем удаляем группу из test_group
                TestsGroupDB obj = new TestsGroupDB();
                obj.Delete(Convert.ToInt32(((KeyValuePair <string, string>)cbTestGroupDelete.SelectedItem).Key));

                // Обновим dgv
                MainForm main_fm = (MainForm)Application.OpenForms["MainForm"];
                main_fm.UpdateDGV_Rules();

                break;

            case DialogResult.No:
                break;
            }
            this.Close();
        }
Ejemplo n.º 5
0
        public AddTest()
        {
            InitializeComponent();
            //int selected_index = 0;

            TestsGroupDB tu_obj = new TestsGroupDB();

            tu_obj.Fill();

            Dictionary <string, string> test_groups = new Dictionary <string, string>();

            for (int i = 0; i < tu_obj.list_objects.Count; i++)
            {
                test_groups.Add(tu_obj.list_objects[i].id.ToString(), tu_obj.list_objects[i].name);
                // Определим selected_index для выбранного типа
                //if (obj.type_user == tu_obj.list_objects[i].id) { selected_index = i; }
            }

            cbGroup.DataSource    = new BindingSource(test_groups, null);
            cbGroup.DisplayMember = "Value";
            cbGroup.ValueMember   = "Key";
            cbGroup.SelectedIndex = 0;
            //cbGroup.SelectedIndex = selected_index;
        }
Ejemplo n.º 6
0
        public AddRules()
        {
            InitializeComponent();

            // ТЕСТЫ ------------------------------------------------------------------------------
            dgvTests.Rows.Clear();
            TestsGroupDB obj = new TestsGroupDB();

            obj.Fill();

            Dictionary <string, string> test_group_list = new Dictionary <string, string>();

            for (int i = 0; i < obj.list_objects.Count; i++)
            {
                test_group_list.Add(obj.list_objects[i].id.ToString(), obj.list_objects[i].name);
            }

            cbTests.DataSource    = new BindingSource(test_group_list, null);
            cbTests.DisplayMember = "Value";
            cbTests.ValueMember   = "Key";
            cbTests.SelectedIndex = 0;

            tests = new TestsDB();
            tests.Fill(Convert.ToInt32(((KeyValuePair <string, string>)cbTests.SelectedItem).Key));
            for (int i = 0; i < tests.objects.Count; i++)
            {
                dgvTests.Rows.Add(
                    tests.objects[i].id,
                    false,
                    img_test,
                    tests.objects[i].name
                    );
            }
            // ПОЛЬЗОВАТЕЛИ -------------------------------------------------------------------------
            dgvUsers.Rows.Clear();
            UsersGroupDB obj_user = new UsersGroupDB();

            obj_user.Fill();

            Dictionary <string, string> user_group_list = new Dictionary <string, string>();

            for (int i = 0; i < obj_user.list_objects.Count; i++)
            {
                user_group_list.Add(obj_user.list_objects[i].id.ToString(), obj_user.list_objects[i].name);
            }

            cbUsers.DataSource    = new BindingSource(user_group_list, null);
            cbUsers.DisplayMember = "Value";
            cbUsers.ValueMember   = "Key";
            cbUsers.SelectedIndex = 0;

            users = new UsersDB();
            users.Fill(Convert.ToInt32(((KeyValuePair <string, string>)cbUsers.SelectedItem).Key));
            for (int i = 0; i < users.objects.Count; i++)
            {
                dgvUsers.Rows.Add(
                    users.objects[i].id,
                    false,
                    img_test,
                    users.objects[i].last_name
                    );
            }
            // ГРУППА ПРАВИЛ -------------------------------------------------------------------------
            RulesGroupDB obj_rules = new RulesGroupDB();

            obj_rules.Fill();

            Dictionary <string, string> rules_group_list = new Dictionary <string, string>();

            for (int i = 0; i < obj_rules.list_objects.Count; i++)
            {
                rules_group_list.Add(obj_rules.list_objects[i].id.ToString(), obj_rules.list_objects[i].name);
            }

            cbRulesGroup.DataSource    = new BindingSource(rules_group_list, null);
            cbRulesGroup.DisplayMember = "Value";
            cbRulesGroup.ValueMember   = "Key";
            cbRulesGroup.SelectedIndex = 0;
            // РАСПИСАНИЕ ----------------------------------------------------------------------------
            rbRaspType2.Checked           = true;
            rasp1_dateStart.CustomFormat  = "dd.MM.yyyy hh:mm:ss";
            rasp1_dateFinish.CustomFormat = "dd.MM.yyyy hh:mm:ss";
            // КОЛИЧЕСТВО ПОПЫТОК --------------------------------------------------------------------

            //cbNumberAttemptValue.SelectedIndex = 0;
        }