private void EditProperty() { EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode; PlantStructurePropertyForm plantstructurepropertyform = new PlantStructurePropertyForm(); tblPlantStructure _tblplantstructure = (tblPlantStructure)node.sqlobject; plantstructurepropertyform.name = _tblplantstructure.Name; plantstructurepropertyform.description = _tblplantstructure.Description; plantstructurepropertyform.type = _tblplantstructure.Type; plantstructurepropertyform.filename = _tblplantstructure.PropertyPath; plantstructurepropertyform.argument = _tblplantstructure.Argument; if (plantstructurepropertyform.ShowDialog() == DialogResult.OK) { _tblplantstructure.Name = plantstructurepropertyform.name; _tblplantstructure.Description = plantstructurepropertyform.description; _tblplantstructure.Type = plantstructurepropertyform.type; _tblplantstructure.PropertyPath = plantstructurepropertyform.filename; _tblplantstructure.Argument = plantstructurepropertyform.argument; 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 ToolStripMenuItemAddObjectFolder_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.ObjectFollder; // tblplantstructure.ParentID = node.NodeID; // tblplantstructure.SolutionID = tblSolution.m_tblSolution().SolutionID; // tblplantstructure.IsFolder = true; // 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 = 1; // childnode.SelectedImageIndex = 1; // childnode.Nodetype = (TREE_NODE_TYPE)tblplantstructure.Type; // node.Nodes.Add(childnode); // } // UpdateTabPage(); // } //} private void ToolStripMenuItemAddProperty_Click(object sender, EventArgs e) { EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode; PlantStructurePropertyForm plantstructureobjectform = new PlantStructurePropertyForm(); 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 = false; tblplantstructure.PropertyPath = plantstructureobjectform.filename; tblplantstructure.Argument = plantstructureobjectform.argument; 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 = 3; childnode.SelectedImageIndex = 3; childnode.Nodetype = (TREE_NODE_TYPE)tblplantstructure.Type; node.Nodes.Add(childnode); } UpdateTabPage(); } }