private void LoadObjectEdit() { TreeNode currentNode = trvDatabase.SelectedNode; if (currentNode.Parent.Text == "模板") { IObjectTemplate template = currentNode.Tag as IObjectTemplate; frmEditTemplate frm = new frmEditTemplate(); frm.SetTemplate(template); frm.SetDatabase(template.Database); frm.ShowDialog(); currentNode.Tag = frm.GetTemplate(); currentNode.Text = frm.GetTemplate().Name; } if (currentNode.Parent.Text == "数据字典") { IYTDomain domain = currentNode.Tag as IYTDomain; frmEditDomain frm = new frmEditDomain(); frm.SetDatabase(currentNode.Parent.Parent.Tag as ITemplateDatabase); frm.SetDomain(domain); DialogResult result = frm.ShowDialog(); if (result == DialogResult.OK) { TreeNode pNode = currentNode.Parent; pNode.Nodes.Clear(); LoadDomains(pNode.Parent.Tag as ITemplateDatabase, pNode); } currentNode.Tag = frm.GetDomain(); } if (currentNode.Parent.Text == "数据集") { IObjectDataset dataset = currentNode.Tag as IObjectDataset; frmEditDataset frm = new frmEditDataset(); frm.SetDatabase(currentNode.Parent.Parent.Tag as ITemplateDatabase); frm.Dataset = dataset; DialogResult result = frm.ShowDialog(); if (result == DialogResult.OK) { currentNode.Tag = frm.Dataset; currentNode.Text = frm.Dataset.Name; } } }
private void mnuPasteObject_Click(object sender, EventArgs e) { if (_copyObject == null) { return; } TreeNode currentNode = trvDatabase.SelectedNode; ITemplateDatabase database = currentNode.Tag as ITemplateDatabase; if (_copyObject.Parent.Text == "模板") { IObjectTemplate template = _copyObject.Tag as IObjectTemplate; template.ID = -1; template.Database = database; frmEditTemplate frm = new frmEditTemplate(); frm.SetTemplate(template); frm.SetDatabase(database); DialogResult result = frm.ShowDialog(); if (result == DialogResult.OK) { TreeNode pNode = currentNode.Nodes[0]; pNode.Nodes.Clear(); LoadTemplates(database, pNode); } } if (_copyObject.Parent.Text == "数据字典") { IYTDomain domain = _copyObject.Tag as IYTDomain; domain.ID = -1; frmEditDomain frm = new frmEditDomain(); frm.SetDatabase(database); frm.SetDomain(domain); DialogResult result = frm.ShowDialog(); if (result == DialogResult.OK) { TreeNode pNode = currentNode.Nodes[1]; pNode.Nodes.Clear(); LoadDomains(database, pNode); } //currentNode.Tag = frm.GetDomain(); } if (_copyObject.Parent.Text == "数据集") { IObjectDataset dataset = _copyObject.Tag as IObjectDataset; dataset.ID = -1; frmEditDataset frm = new frmEditDataset(); frm.SetDatabase(database); frm.Dataset = dataset; DialogResult result = frm.ShowDialog(); if (result == DialogResult.OK) { TreeNode pNode = currentNode.Nodes[2]; pNode.Nodes.Clear(); LoadDatasets(database, pNode); } } _copyObject = null; }