Example #1
0
        private void CreateDBTree()
        {
            this.treeView1.BeginUpdate();
            DBProjectNode projNode = new DBProjectNode();

            projNode.DataInfo = DBGlobalService.CurrentProject;
            //this.mDataBaseNode = projNode;
            projNode.Text += "(持久阶段)";
            projNode.TreeNode.Expand();

            this.treeView1.Nodes.Add(projNode.TreeNode);

            foreach (var child in projNode.Children)
            {
                child.TreeNode.Expand();
            }

            TreeEventSource eventSource = new TreeEventSource(projNode);

            eventSource.Refresh  += new RefreshDelegate(eventSource_Refresh);
            eventSource.Generate += new GenerateDelegate(eventSource_Generate);
            this.treeView1.EndUpdate();
        }
Example #2
0
        private void CreateTree()
        {
            this.treeView1.BeginUpdate();
            DBProjectNode projNode = new DBProjectNode();

            projNode.DataInfo = DBGlobalService.CurrentProject;
            this.treeView1.Nodes.Add(projNode.TreeNode);
            TreeEventSource eventSource = new TreeEventSource(projNode);

            eventSource.Refresh  += new RefreshDelegate(eventSource_Refresh);
            eventSource.Generate += new GenerateDelegate(eventSource_Generate);

            /*
             * //load biz config
             * var bizCfg = GlobalService.ProjectFile.Replace(".xml", ".biz.xml");
             * var doc = new Document();
             * BusinessCfg cfg = null;
             * if (System.IO.File.Exists(bizCfg))
             * {
             *  doc.Load(bizCfg);
             *  cfg = new BusinessCfg(doc);
             * }
             * else
             * {
             *  cfg = doc.CreateNode<BusinessCfg>();
             *  doc.Root = cfg;
             *  cfg.ServiceFolder = doc.CreateNode<ServiceFolder>();
             *  cfg.AjaxFolder = doc.CreateNode<AjaxFolder>();
             *  cfg.FormViewFolder = doc.CreateNode<FormViewFolder>();
             * }
             *
             * GlobalService.BusinessCfgDoc = doc;
             *
             * var serviceNode = new ServiceFolderNode();
             * serviceNode.ServiceFolder = cfg.ServiceFolder;
             *
             * projNode.Children.Add(serviceNode);
             *
             * var ajaxNode = new AjaxFolderNode();
             * ajaxNode.Dom = cfg.AjaxFolder.Dom;
             *
             * projNode.Children.Add(ajaxNode);
             *
             * var formNode = new FormFolderNode();
             * if (string.IsNullOrWhiteSpace(cfg.FormViewFolder.Name))
             *  cfg.FormViewFolder.Name = "表单";
             *
             * formNode.FormFolder = cfg.FormViewFolder;
             *
             * projNode.Children.Add(formNode);
             *
             * doc.Save(bizCfg);
             *
             */
            this.treeView1.EndUpdate();
            return;

            projNode.Name = projNode.Text = "工程";

            #region 连接字符串

            ConnectionPackageNode connPkgNode = new ConnectionPackageNode();
            connPkgNode.Parent = projNode;
            connPkgNode.Text   = connPkgNode.Name = "连接串";

            foreach (Project.ConnectionType connectionRow in DBGlobalService.CurrentProject.Connections)
            {
                ConnectionNode connNode = new ConnectionNode();
                connNode.Name             = connNode.Text = connectionRow.Name;
                connNode.ConncetionString = connectionRow.ConnectionString;
                connNode.Parent           = connPkgNode;
                //表

                TablePackageNode tablePkgNode = new TablePackageNode();
                tablePkgNode.Name   = tablePkgNode.Text = "表";
                tablePkgNode.Parent = connNode;

                foreach (Project.TableType tableRow in connectionRow.Tables)
                {
                    TableNode tableNode = new TableNode();
                    tableNode.Text   = tableNode.Name = tableRow.Name;
                    tableNode.Parent = tablePkgNode;
                }

                //sql
                SqlPackageNode sqlPkgNode = new SqlPackageNode();
                sqlPkgNode.Text   = sqlPkgNode.Name = "查询";
                sqlPkgNode.Parent = connNode;

                foreach (Project.SqlType sqlRow in connectionRow.Sqls)
                {
                    SqlNode sqlNode = new SqlNode();
                    sqlNode.Name   = sqlNode.Text = sqlRow.Name;
                    sqlNode.Parent = sqlPkgNode;

                    DBModelNode modeNode = new DBModelNode();
                    modeNode.Text = modeNode.Name = sqlRow.Name;

                    modeNode.Parent = sqlNode;
                }
            }
            #endregion

            #region 自定义模型

            //CustomModelSetNode customModlePkgNode = new CustomModelSetNode();
            //customModlePkgNode.Text = customModlePkgNode.Name = "自定义模型";
            //customModlePkgNode.Parent = projNode;

            //if (GlobalService.CurrentProject.HasCustomModelSet())
            //{
            //    foreach (Project.ModelType row in GlobalService.CurrentProject.CustomModelSet.MyModels)
            //    {

            //        ModelNode modeNode = new ModelNode();
            //        modeNode.ModelType = ModelNode.SourceType.FromCustom;
            //        modeNode.Name = modeNode.Text = row.Name.Value;
            //        modeNode.Parent = customModlePkgNode;
            //    }
            //}
            #endregion
        }