コード例 #1
0
 private void nodeSelected(TreeNode node)
 {
     if (node.Level != 0)
     {
         DataSource dataSource = ModelDesignProject.GetDataSource(node.Name.Trim());
         SetValue(dataSource);
     }
 }
コード例 #2
0
        private void InitializeControl()
        {
            _currentDS = ModelDesignProject.GetDataSource(_dsId);
            if (_currentDS.DefTables != null)
            {
                foreach (DefineTable defTB in _currentDS.DefTables)
                {
                    TreeNode nodeDefTable = new TreeNode();
                    SetDefineTableNode(defTB, nodeDefTable);
                    TreeNode nodeDTStruct;
                    TreeNode nodeField;
                    foreach (DataTableStruct dtStruct in defTB.TableStruct)
                    {
                        nodeDTStruct = new TreeNode();
                        SetTableStructNode(dtStruct, nodeDTStruct);
                        foreach (LibField field in dtStruct.Fields)
                        {
                            nodeField = new TreeNode();
                            SetFieldNode(field, nodeField);
                            nodeDTStruct.Nodes.Add(nodeField);
                        }
                        nodeDefTable.Nodes.Add(nodeDTStruct);
                    }
                    this.treeView1.Nodes["defineTableCollection"].Nodes.Add(nodeDefTable);
                }
            }
            else
            {
                _currentDS.DefTables = new SDPCRL.CORE.LibCollection <DefineTable>();
                TreeNode nodeDefTable = new TreeNode();

                DefineTable defTable = new DefineTable();
                defTable.ID          = DataSourceInfoBLL.GetMaxDefTBID(_dsId) + 1;
                defTable.TableName   = "defineTable1";
                defTable.DisplayName = "自定义数据表";
                SetDefineTableNode(defTable, nodeDefTable);
                _currentDS.DefTables.Add(defTable);

                defTable.TableStruct = new SDPCRL.CORE.LibCollection <DataTableStruct>();
                TreeNode tableStruct = new TreeNode();
                nodeDefTable.Nodes.Add(tableStruct);

                DataTableStruct dbStruct = new DataTableStruct();
                dbStruct.Name        = "dataTableStruct1";
                dbStruct.DisplayName = "数据表结构";
                SetTableStructNode(dbStruct, tableStruct);
                defTable.TableStruct.Add(dbStruct);
                this.treeView1.Nodes["defineTableCollection"].Nodes.Add(nodeDefTable);
                this.treeView1.SelectedNode = tableStruct;;
                nodeDefTable.Expand();
            }
            ModelDesignProject.CreateDS(_currentDS);
        }
コード例 #3
0
 private void toolbtCreateTableObj_Click(object sender, EventArgs e)
 {
     ModelDesignProject.CreateTableObj(ModelDesignProject.GetDataSource(this.tabControl1.SelectedTab.Name));
 }
コード例 #4
0
 private void toolbtSave_Click(object sender, EventArgs e)
 {
     ModelDesignProject.DoSaveDS(ModelDesignProject.GetDataSource(this.tabControl1.SelectedTab.Name).DSID);
     MessageBox.Show("保存成功");
 }