Exemplo n.º 1
0
        public override void DoFormAcceptMsg(string tag, Dictionary <object, object> agrs)
        {
            base.DoFormAcceptMsg(tag, agrs);
            if (string.Compare(tag, "NewFunc") == 0)//新建功能
            {
                if (agrs != null && agrs.Count() > 0)
                {
                    LibTreeNode funcNode = agrs["funcNode"] as LibTreeNode;
                    switch (funcNode.NodeType)
                    {
                    case NodeType.Func:
                        #region
                        //数据源节点
                        LibTreeNode ds = new LibTreeNode();
                        funcNode.CopyTo(ds);
                        ds.NodeType = NodeType.DataModel;
                        ModelDesignProject.CreatModelFile(ds);

                        funcNode.Nodes.Add(ds);
                        //排版模型节点
                        LibTreeNode form = new LibTreeNode();
                        funcNode.CopyTo(form);
                        form.NodeType = NodeType.FormModel;
                        ModelDesignProject.CreatModelFile(form);
                        funcNode.Nodes.Add(form);
                        //权限模型节点
                        LibTreeNode permission = new LibTreeNode();
                        funcNode.CopyTo(permission);
                        permission.NodeType = NodeType.PermissionModel;
                        ModelDesignProject.CreatModelFile(permission);
                        funcNode.Nodes.Add(permission);

                        this.treeView1.SelectedNode.Nodes.Add(funcNode);
                        ModelDesignProject.AddXmlNode(funcNode);
                        this.treeView1.SelectedNode = funcNode;
                        #endregion
                        break;

                    case NodeType.SpectFunc:
                        break;

                    case NodeType.ReportFunc:
                        #region 创建树形节点
                        LibTreeNode report = new LibTreeNode();
                        funcNode.CopyTo(report);
                        report.NodeType = NodeType.ReportModel;
                        ModelDesignProject.CreatModelFile(report);

                        funcNode.Nodes.Add(report);

                        //权限模型节点
                        LibTreeNode reportpermission = new LibTreeNode();
                        funcNode.CopyTo(reportpermission);
                        reportpermission.NodeType = NodeType.PermissionModel;
                        ModelDesignProject.CreatModelFile(reportpermission);
                        funcNode.Nodes.Add(reportpermission);

                        this.treeView1.SelectedNode.Nodes.Add(funcNode);
                        ModelDesignProject.AddXmlNode(funcNode);
                        this.treeView1.SelectedNode = funcNode;
                        #endregion
                        break;

                    case NodeType.DataModel:
                        break;

                    case NodeType.FormModel:
                        break;

                    case NodeType.PermissionModel:
                        break;

                    case NodeType.KeyValues:
                        ModelDesignProject.CreatModelFile(funcNode);
                        this.treeView1.SelectedNode.Nodes.Add(funcNode);
                        ModelDesignProject.AddXmlNode(funcNode);
                        this.treeView1.SelectedNode = funcNode;
                        break;

                    case NodeType.TransBillModel:
                        #region 创建树形节点
                        LibTreeNode trans = new LibTreeNode();
                        funcNode.CopyTo(trans);
                        trans.NodeType = NodeType.TransBillModel;
                        ModelDesignProject.CreatModelFile(trans);

                        this.treeView1.SelectedNode.Nodes.Add(trans);
                        ModelDesignProject.AddXmlNode(trans);
                        #endregion
                        break;
                    }
                }
            }
        }