Exemple #1
0
        private void treeDb_BeforeCheck(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node.Parent == null || !e.Node.Checked)
            {
                return;
            }
            TreeNode[] nodes = treeDb.Nodes.Find(e.Node.Parent.Text + "@" + e.Node.Text, true);
            if (nodes.Length <= 0 || nodes[0].Parent == null)
            {
                return;
            }

            bool used = false;

            for (int i = 0; i < nodes.Length; i++)
            {
                if (nodes[i].Checked)
                {
                    used = true;
                }
            }
            if (!used)
            {
                return;
            }

            string txt = string.Format("[{0}]-[{1}] {2}{3}[{4}]-[{5}].",
                                       e.Node.Parent.Text, e.Node.Text, GlobalText.GetValue("UsedAsAForeignKey"), Environment.NewLine, nodes[0].Parent.Text, nodes[0].Text);

            GlobalText.ShowWarning(txt);
        }
Exemple #2
0
        private void treeDb_BeforeCheck(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node.Parent == null || !e.Node.Checked)
            {
                return;
            }
            TreeNode[] nodes = treeDb.Nodes.Find($"{e.Node.Parent.Text}@{e.Node.Text}", true);
            if (nodes.Length <= 0 || nodes[0].Parent == null)
            {
                return;
            }

            bool used = false;

            for (int i = 0; i < nodes.Length; i++)
            {
                if (nodes[i].Checked)
                {
                    used = true;
                }
            }
            if (!used)
            {
                return;
            }

            string txt = $"[{e.Node.Parent.Text}]-[{e.Node.Text}] {GlobalText.GetValue("UsedAsAForeignKey")}{Environment.NewLine}[{nodes[0].Parent.Text}]-[{nodes[0].Text}].";

            GlobalText.ShowWarning(txt);
        }