private void EditObject() { EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode; PlantStructureObjectForm plantstructureobjectform = new PlantStructureObjectForm(); tblPlantStructure _tblplantstructure = (tblPlantStructure)node.sqlobject; plantstructureobjectform.name = _tblplantstructure.Name; plantstructureobjectform.description = _tblplantstructure.Description; plantstructureobjectform.type = _tblplantstructure.Type; if (plantstructureobjectform.ShowDialog() == DialogResult.OK) { _tblplantstructure.Name = plantstructureobjectform.name; _tblplantstructure.Description = plantstructureobjectform.description; _tblplantstructure.Type = plantstructureobjectform.type; foreach (tblPlantStructure tblplantstructure in tblSolution.m_tblSolution().m_tblPlantStructureCollection) { if ((tblplantstructure.Name.ToUpper() == _tblplantstructure.Name.ToUpper()) && (tblplantstructure.ParentID == _tblplantstructure.ParentID) && (tblplantstructure.ID != _tblplantstructure.ID)) { return; } } int ret = _tblplantstructure.Update(); UpdateTabPage(); } }
private void ToolStripMenuItemAddObject_Click(object sender, EventArgs e) { EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode; PlantStructureObjectForm plantstructureobjectform = new PlantStructureObjectForm(); //plantstructureobjectform.isfolder = false; //plantstructureobjectform.title = "Plant Structure Object Folder"; if (plantstructureobjectform.ShowDialog() == DialogResult.OK) { tblPlantStructure tblplantstructure = new tblPlantStructure(); tblplantstructure.Name = plantstructureobjectform.name; tblplantstructure.Description = plantstructureobjectform.description; tblplantstructure.Type = plantstructureobjectform.type; tblplantstructure.ParentID = node.NodeID; tblplantstructure.SolutionID = tblSolution.m_tblSolution().SolutionID; tblplantstructure.IsFolder = false; tblplantstructure.IsObject = true; tblplantstructure.Visible = true; int ret = tblplantstructure.Insert(); if (ret == 0) { EWSTreeNode childnode = new EWSTreeNode(tblplantstructure.Name); childnode.NodeID = tblplantstructure.ID; childnode.sqlobject = tblplantstructure; childnode.ContextMenuStrip = contextMenuStripStructure; childnode.ImageIndex = 2; childnode.SelectedImageIndex = 2; childnode.Nodetype = (TREE_NODE_TYPE)tblplantstructure.Type; node.Nodes.Add(childnode); } UpdateTabPage(); } }