private void EditFolder() { EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode; PlantStructureFolderForm plantstructurefolderform = new PlantStructureFolderForm(); tblPlantStructure _tblplantstructure = (tblPlantStructure)node.sqlobject; plantstructurefolderform.name = _tblplantstructure.Name; plantstructurefolderform.description = _tblplantstructure.Description; if (plantstructurefolderform.ShowDialog() == DialogResult.OK) { _tblplantstructure.Name = plantstructurefolderform.name; _tblplantstructure.Description = plantstructurefolderform.description; 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 ToolStripMenuItemAddPropertyFolder_Click(object sender, EventArgs e) { EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode; PlantStructureFolderForm plantstructurefolderform = new PlantStructureFolderForm(); //plantstructureobjectform.isfolder = true; //plantstructureobjectform.title = "Plant Structure Object Folder"; if (plantstructurefolderform.ShowDialog() == DialogResult.OK) { tblPlantStructure tblplantstructure = new tblPlantStructure(); tblplantstructure.Name = plantstructurefolderform.name; tblplantstructure.Description = plantstructurefolderform.description; tblplantstructure.Type = (int)TREE_NODE_TYPE.PropertyFolder; tblplantstructure.ParentID = node.NodeID; tblplantstructure.SolutionID = tblSolution.m_tblSolution().SolutionID; tblplantstructure.IsFolder = true; tblplantstructure.IsObject = false; 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 = 1; childnode.SelectedImageIndex = 1; childnode.Nodetype = (TREE_NODE_TYPE)tblplantstructure.Type; node.Nodes.Add(childnode); } UpdateTabPage(); } }