private void toolStripMenuItem1_Click(object sender, EventArgs e) { //MessageBox.Show("添加下级"); using (添加下级产品 mForm = new 添加下级产品()) { if (DialogResult.Yes == mForm.ShowDialog()) { int ret = new T_ProductsTableAdapter().Insert(mForm.txtProductName.Text.Trim(), treeView1.SelectedNode.Level + 1, Convert.ToInt64(treeView1.SelectedNode.Name)); if (ret > 0) { MessageBox.Show("加入成功"); AddTree(); } else { MessageBox.Show("加入失败"); } } } }
private void 修改名称ToolStripMenuItem_Click(object sender, EventArgs e) { using (添加下级产品 mForm = new 添加下级产品()) { mForm.Text = "修改产品名称"; mForm.txtProductName.Text = treeView1.SelectedNode.Text; if (DialogResult.Yes == mForm.ShowDialog()) { int ret = new T_ProductsTableAdapter().UpdateNameById(mForm.txtProductName.Text.Trim(), Convert.ToInt64(treeView1.SelectedNode.Name)); if (ret > 0) { MessageBox.Show("修改成功"); AddTree(); } else { MessageBox.Show("修改失败"); } } } }