Ejemplo n.º 1
0
 /// <summary>
 /// 确定按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_ok_Click(object sender, EventArgs e)
 {
     if (text_edit.Text != "" && btn_type == 3)
     {
         if (MessageBox.Show("您确定将 " + lab_now_select_text.Text + " 更改为 " + text_edit.Text + " ?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             TreeNode tn = TreeTraversal(goods_type_id);
             tn.Text = text_edit.Text;
             gtb.Update(goods_type_id, text_edit.Text);
             text_edit.Enabled = false;
             ReSet();
         }
     }
     else if (text_edit.Text != "" && btn_type == 1)
     {
         if (MessageBox.Show("您确定要创建一个名为 " + text_edit.Text + " 的总类型?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             TreeNode tn = TreeTraversal(goods_type_id);
             gtm.Goods_type  = text_edit.Text;
             gtm.Node_parent = 0;
             gtm.Node_depth  = 1;
             gtb.Insert(gtm);
             ReSet();
         }
     }
     else if (text_edit.Text != "" && btn_type == 2 && lab_now_select.Text != "")
     {
         if (MessageBox.Show("您确定在 " + lab_now_select_text.Text + " 类型下添加" + text_edit.Text + " 类型?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             TreeNode tn = TreeTraversal(goods_type_id);
             gtm.Goods_type  = text_edit.Text;
             gtm.Node_parent = goods_type_id;
             gtm.Node_depth  = tn.Level + 2;
             gtb.Insert(gtm);
             ReSet();
         }
     }
     btn_type = 0;
 }