//选择商品分类按钮点击事件 private void select_goods_type_btn_Click(object sender, EventArgs e) { SetGoodsType setGoodsType = new SetGoodsType(true); setGoodsType.isModifyingGoods = true; setGoodsType.ShowDialog(this); if (selectedGoodsTypeNode != null) { select_goods_type_btn.Text = selectedGoodsTypeNode.Text; } FindParentNode(selectedGoodsTypeNode); is_by_num_cbx.Checked = is_by_num; if (is_by_num_cbx.Checked) { stock_num_txb.Text = "-1"; stock_num_txb.Enabled = false; } if (stock_num_txb.Text == "-1" && !is_by_num_cbx.Checked) { stock_num_txb.Text = "0"; } is_by_num_cbx.Enabled = false; }
//选择商品分类按钮点击事件 private void select_goods_type_btn_Click(object sender, EventArgs e) { //打开商品分类窗口,设置商品分类窗口的是否正在选择商品分类属性为真 SetGoodsType setGoodsType = new SetGoodsType(true); setGoodsType.ShowDialog(this); //如果选择的分类不为空,将该按钮的文本修改为选择的商品分类 if (selectedGoodsTypeNode != null) { select_goods_type_btn.Text = selectedGoodsTypeNode.Text; } //调用FindParentNode方法,传入当前选择的分类节点 FindParentNode(selectedGoodsTypeNode); //设置是否为计次商品的复选框值为is_by_num is_by_num_cbx.Checked = is_by_num; //如果是计次商品,设置库存数量为-1且不允许更改 if (is_by_num_cbx.Checked) { stock_num_txb.Text = "-1"; stock_num_txb.Enabled = false; } //如果是非计次商品,允许修改库存数量 else { stock_num_txb.Text = ""; stock_num_txb.Enabled = true; } //禁用是否为计次商品的复选框 is_by_num_cbx.Enabled = false; }