private void 添加一级ToolStripMenuItem_Click(object sender, EventArgs e) { 知识点_添加框 nf = new 知识点_添加框(); nf.ShowDialog(); if (wb != "") { 添加一级(); treeView1.Nodes.Add(wb); //if (treeView1.SelectedNode.Level == 0) //{ // SqlConnection conn = new SqlConnection(login.sqlName); // conn.Open(); // SqlCommand cmd = conn.CreateCommand(); // cmd.CommandType = CommandType.StoredProcedure; // cmd.CommandText = "new_教师知识_添加同级_一级"; // cmd.Parameters.Add("mingzi", SqlDbType.NVarChar).Value = wb; // cmd.Parameters.Add("nianji", SqlDbType.NVarChar).Value = this.comboBox1.Text; // cmd.Parameters.Add("kemu", SqlDbType.NVarChar).Value = this.comboBox2.Text; // cmd.ExecuteNonQuery(); // treeView1.Nodes.Add(wb); //} //if (treeView1.SelectedNode.Level == 1) //{ // SqlConnection conn = new SqlConnection(login.sqlName); // conn.Open(); // SqlCommand cmd = conn.CreateCommand(); // cmd.CommandType = CommandType.StoredProcedure; // cmd.CommandText = "new_教师知识_添加同级_二级"; // cmd.Parameters.Add("mingzi", SqlDbType.NVarChar).Value = wb; // cmd.Parameters.Add("nianji", SqlDbType.NVarChar).Value = this.comboBox1.Text; // cmd.Parameters.Add("kemu", SqlDbType.NVarChar).Value = this.comboBox2.Text; // cmd.Parameters.Add("yiji", SqlDbType.NVarChar).Value = treeView1.SelectedNode.Parent.Text; // treeView1.SelectedNode.Parent.Nodes.Add(wb); // cmd.ExecuteNonQuery(); //} } }
private void 添加二级ToolStripMenuItem_Click(object sender, EventArgs e) { 知识点_添加框 nf = new 知识点_添加框(); nf.ShowDialog(); if (wb != "") { 添加二级(); if (treeView1.SelectedNode.Level == 1) { treeView1.SelectedNode.Parent.Nodes.Add(wb); } else if (treeView1.SelectedNode.Level == 0) { treeView1.SelectedNode.Nodes.Add(wb); } } }
private void 添加二级ToolStripMenuItem_Click(object sender, EventArgs e) { 知识点_添加框 nf = new 知识点_添加框(); nf.ShowDialog(); if (wb != "") { //添加二级(); TreeNode tn = new TreeNode(); tn.Text = wb; tn.Tag = 添加二级(); if (treeView1.SelectedNode.Level == 1) { treeView1.SelectedNode.Parent.Nodes.Add(tn); } else if (treeView1.SelectedNode.Level == 0) { treeView1.SelectedNode.Nodes.Add(tn); } } }