Esempio n. 1
0
        private void NewFolder()
        {
            TreeNode  Node      = treeView1.SelectedNode;
            Selection Selection = Node.Tag as Selection;
            Boolean   IsReport  = Convert.ToBoolean(Selection.Value);

            if (!IsReport)
            {
                string Code       = DepositoryReportCatlog.GetNextCode(Node.Name);
                string FolderName = DepositoryReportCatlog.GetFolderName(Node.Name, "新建文件夹");

                Boolean Result = DepositoryReportCatlog.New(Code, FolderName);
                if (Result)
                {
                    TreeNode SubNode = new TreeNode();
                    SubNode.Name = Code;
                    SubNode.Text = FolderName;
                    SubNode.SelectedImageIndex = 1;
                    SubNode.ImageIndex         = 0;

                    Selection       = new Selection();
                    Selection.Value = "false";
                    SubNode.Tag     = Selection;

                    Node.Nodes.Add(SubNode);
                    Node.Expand();
                    Node.TreeView.SelectedNode = SubNode;
                }
            }
        }
Esempio n. 2
0
        private void NewReport()
        {
            TreeNode  Node      = treeView1.SelectedNode;
            Selection Selection = Node.Tag as Selection;
            Boolean   IsReport  = Convert.ToBoolean(Selection.Value);

            if (!IsReport)
            {
                string Code       = DepositoryReportCatlog.GetNextCode(Node.Name);
                string ReportName = DepositoryReportCatlog.GetReportName(Node.Name, "新建表单");

                ReportConfiguration Report = new ReportConfiguration();
                Report.Code        = Code;
                Report.Description = ReportName;
                Boolean Result = DepositoryReportConfiguration.New(Report);
                if (Result)
                {
                    TreeNode SubNode = new TreeNode();
                    SubNode.Name = Code;

                    Selection                  = new Selection();
                    Selection.ID               = Report.Index;
                    Selection.Value            = "true";
                    SubNode.Tag                = Selection;
                    SubNode.Text               = ReportName;
                    SubNode.SelectedImageIndex = 2;
                    SubNode.ImageIndex         = 2;

                    Node.Nodes.Add(SubNode);
                    Node.Expand();
                    Node.TreeView.SelectedNode = SubNode;
                }
            }
        }
Esempio n. 3
0
        private void DeleteFolder()
        {
            TreeNode Node = treeView1.SelectedNode;
            String   Msg  = "文件夹不为空,删除失败!";

            if (Node.Nodes.Count > 0)
            {
                MessageBox.Show(Msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Selection Selection = Node.Tag as Selection;
            Boolean   IsReport  = Convert.ToBoolean(Selection.Value);

            Msg = "你确定要删除文件夹 ‘" + Node.Text + "’ 吗?";
            if (!IsReport && DialogResult.Yes == MessageBox.Show(Msg, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk))
            {
                if (ReportWindow.report != null && ReportWindow.report.Configuration.Code.StartsWith(Node.Name))
                {
                    ReportWindow.RemoveReport();
                }

                DepositoryReportCatlog.Delete(Node.Name);
                Node.Remove();
            }
        }
Esempio n. 4
0
 private void ReportCatlogForm_Load(object sender, EventArgs e)
 {
     DepositoryReportCatlog.InitReportCatlog(treeView1);
     if (treeView1.Nodes.Count > 0)
     {
         treeView1.SelectedNode = treeView1.Nodes[0];
     }
 }
Esempio n. 5
0
        private void treeView1_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                if (e.Label.Length > 0)
                {
                    if (e.Label.IndexOfAny(new char[] { '@', '.', ',', '!' }) == -1)
                    {
                        e.Node.EndEdit(false);
                        Selection Selection = (e.Node.Tag as Selection);
                        Boolean   IsReport  = Convert.ToBoolean(Selection.Value);
                        if (!IsReport)
                        {
                            DepositoryReportCatlog.Update(e.Node.Name, e.Label);
                        }
                        else
                        {
                            Boolean result = DepositoryReportConfiguration.UpdateReportName(Selection.ID, e.Label);
                        }
                    }
                    else
                    {
                        e.CancelEdit = true;
                        MessageBox.Show("无效的树节点文本.\n" + "无效的字符是: '@','.', ',', '!'", "编辑节点");
                        e.Node.BeginEdit();
                    }
                }
                else
                {
                    e.CancelEdit = true;
                    MessageBox.Show("无效的树节点文本.\n文本不能为空", "编辑节点");
                    e.Node.BeginEdit();
                }

                e.Node.TreeView.LabelEdit = false;
            }
        }