示例#1
0
        //------------------------------------------------------------------------------------//



        //--------------------------------GroupButtonMethods----------------------------------//
        private void buttonAddGroup_Click(object sender, EventArgs e)
        {
            string selectedComp = string.Empty;

            if (treeViewCompany.SelectedNode != null)
            {
                if (treeViewCompany.SelectedNode.Level == 0)
                {
                    selectedComp = treeViewCompany.SelectedNode.Text;
                }
                else
                {
                    selectedComp = treeViewCompany.SelectedNode.Parent.Text;
                }
            }

            FormGroup fGroup = new FormGroup(selectedComp);

            fGroup.ShowDialog();
            ReloadTrees(false, true);

            if (fGroup.DialogResult == DialogResult.OK)
            {
                TreeNode node = treeViewCompany.Nodes.Cast <TreeNode>().Where(x => x.Text == fGroup.CompanyWhichGotNewGroup).First().Nodes.Find(fGroup.NewGroupName, false).First();
                node.Parent.Expand();
                treeViewCompany.SelectedNode = node;
            }
        }
示例#2
0
        private void buttonEditGroup_Click(object sender, EventArgs e)
        {
            if (treeViewCompany.SelectedNode != null && treeViewCompany.SelectedNode.Level == 1)
            {
                XElement xel = xDocument.Descendants("firmen").First().Descendants("firma").Where(x => x.Attribute("name").Value == treeViewCompany.SelectedNode.Parent.Text).First().Descendants("group").Where(x => x.Attribute("name").Value == treeViewCompany.SelectedNode.Name).First();

                FormGroup fGroup = new FormGroup(xel.Attribute("name").Value, xel.Attribute("pfad").Value, xel.Attribute("freigabepfad").Value, xel.Parent.Attribute("name").Value, StringIntToBool(xel.Attribute("sachb").Value));
                fGroup.ShowDialog();
                ReloadTrees(false, true);

                if (fGroup.DialogResult == DialogResult.OK)
                {
                    TreeNode node = treeViewCompany.Nodes.Cast <TreeNode>().Where(x => x.Text == fGroup.CompanyWhichGotNewGroup).First().Nodes.Find(fGroup.NewGroupName, false).First();
                    treeViewCompany.SelectedNode = node;
                }
            }
            else
            {
                MessageBox.Show("Bitte Gruppe auswählen", "Achtung", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }