예제 #1
0
        // метод добавления задачи  ------------------------------------------
        private void AddTask()
        {
            mini dtf = new mini();

            dtf.Owner = this;
            dtf.addButtonVisible(true);
            dtf.changeButtonVisible(false);

            TreeView tree = new TreeView();

            // добавление основных заданий в комбобокс
            Dictionary <string, string> comboList = tree.getMainTasks(user);

            if (comboList.Count > 0)
            {
                dtf.checkBoxStateChange(false);
                dtf.comboSet(comboList);
            }
            else
            {
                dtf.checkBoxStateChange(true);
            }
            dtf.ShowDialog(this);
        }
예제 #2
0
        // метод изменения задачи -----------------------------------------
        public void ChangeTask()
        {
            // проверка выбрана ли задача
            TreeNode node = MainTree.SelectedNode;

            if (node == null)
            {
                textBox1.ForeColor = Color.DarkRed;
                textBox1.Text      = "Задача не выбрана, изменение не возможно!";
                return;
            }
            else
            {
                mini dtf = new mini();
                dtf.Owner = this;

                // проверка на дочерние узлы
                if (node.GetNodeCount(true) > 0)
                {
                    dtf.checkBoxOn(false);
                }

                // меняем кнопки (изменить - добавить)
                dtf.changeButtonVisible(true);
                dtf.addButtonVisible(false);

                TreeView      tree   = new TreeView();
                List <string> oneRow = tree.getRow(user, node.Name);

                dtf.SetNameBox(oneRow[2]);
                dtf.SetDeskrBox(oneRow[3]);

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

                if (oneRow[6].Equals("1"))
                {
                    comboList = tree.getAllMainTasks(user);
                    dtf.checkBoxStateChange(true);
                }
                else
                {
                    comboList = tree.getMainTasks(user);
                }
                //поиск индекса в комбобоксе, по которому к нему можно будет обратиться
                int count = 0;

                // проверка на основное задание
                if (oneRow[7].Equals("1") || oneRow[7].Equals("-1"))
                {
                    dtf.checkBoxStateChange(true);
                    dtf.comboSet(comboList);
                    dtf.comboVisible(false);
                }
                else
                {
                    foreach (KeyValuePair <string, string> line in comboList)
                    {
                        if (oneRow[7].Equals(line.Key))
                        {
                            break;
                        }
                        else
                        {
                            count += 1;
                        }
                    }

                    // добавление основных заданий в комбобокс
                    dtf.checkBoxStateChange(false);
                    dtf.comboSet(comboList);
                    dtf.comboBoxSelectedChange(count);
                    // передадим выделенную строку
                }

                dtf.selectRow = oneRow;
                dtf.ShowDialog(this);
            }
        }