Beispiel #1
0
        private void SubmitResults_Click(object sender, EventArgs e)//TODO: This should populate the tree with location>Form>Result>Files
        {
            TreeView backup = new TreeView();

            try
            {
                SubmitResults.Enabled = false;
                SubmitResults.Visible = false;
                TreeViewBox.Enabled   = false;
                CopyTree(TreeViewBox, backup);
                Graph AccountsToForms = cnxn.getAccountFormResultGraph();
                Graph FormsToResults  = new Graph();
                foreach (string AccountID in AccountsToForms.getRoots())
                {
                    FormsToResults.setNameForID(AccountID, AccountsToForms.getNameFromID(AccountID));
                    foreach (string FormID in AccountsToForms.getChildren(AccountID))
                    {
                        FormsToResults.setNameForID(FormID, AccountsToForms.getNameFromID(FormID));
                        FormsToResults.addEdge(AccountID, FormID);
                        foreach (TreeNode Result in TreeViewBox.getCheckedChildren(FormID))
                        {
                            FormsToResults.setNameForID(Result.Name, Result.Text);
                            FormsToResults.addEdge(FormID, Result.Name);
                        }
                    }
                }
                TreeViewBox.BeginUpdate();
                TreeView resultsTree = cnxn.getFileTree(FormsToResults);
                TreeViewBox.Nodes.Clear();
                CopyTree(resultsTree, TreeViewBox);
                TreeViewBox.EndUpdate();
                TreeViewBox.Enabled   = true;
                SelectLabel.Text      = "Please select Results from which to pull certifications.";
                SubmitResults.Visible = false;
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid Settings!", "Error", MessageBoxButtons.OK);
                SubmitResults.Enabled = true;
                SubmitResults.Visible = true;
                TreeViewBox.BeginUpdate();
                TreeViewBox.Nodes.Clear();
                CopyTree(backup, TreeViewBox);
                TreeViewBox.EndUpdate();
                TreeViewBox.Enabled = true;
                TreeViewBox.Enabled = true;
            }
        }
Beispiel #2
0
        private void SubmitFormsButton_Click(object sender, EventArgs e)
        {
            TreeView backup = new TreeView();

            try
            {
                SubmitFormsButton.Enabled = false;
                SubmitFormsButton.Visible = false;
                TreeViewBox.Enabled       = false;
                //cnxn.AccountsForForms.UnionWith(TreeViewBox.getChecked());
                //cnxn.getForms(cnxn.AccountsForForms);
                CopyTree(TreeViewBox, backup);
                Graph AccountsToForms = new Graph();
                foreach (TreeNode Account in TreeViewBox.Nodes)
                {
                    AccountsToForms.setNameForID(Account.Name, Account.Text);
                    foreach (TreeNode Form in TreeViewBox.getCheckedChildren(Account.Name))
                    {
                        AccountsToForms.setNameForID(Form.Name, Form.Text);
                        AccountsToForms.addEdge(Account.Name, Form.Name);
                    }
                }
                TreeViewBox.BeginUpdate();
                TreeView resultsTree = cnxn.getResultsTree(AccountsToForms);
                TreeViewBox.Nodes.Clear();
                CopyTree(resultsTree, TreeViewBox);
                TreeViewBox.EndUpdate();
                TreeViewBox.Enabled     = true;
                SelectLabel.Text        = "Please select Results from which to pull certifications.";
                SubmitSuppliers.Visible = false;
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid Settings!", "Error", MessageBoxButtons.OK);
                SubmitFormsButton.Enabled = true;
                SubmitFormsButton.Visible = true;
                TreeViewBox.BeginUpdate();
                TreeViewBox.Nodes.Clear();
                CopyTree(backup, TreeViewBox);
                TreeViewBox.EndUpdate();
                TreeViewBox.Enabled = true;
                TreeViewBox.Enabled = true;
            }
        }