private void button2_Click(object sender, EventArgs e) { if (treeView1.SelectedNode.Text != "商品销售信息") { if (treeView1.SelectedNode.Parent.Text == "商品销售信息") { frmThGoodsInfo frmth = (frmThGoodsInfo)this.Owner; tb_SellGoodsMenthod tbsell = new tb_SellGoodsMenthod(); SqlDataReader dr = tbsell.dtb_SellGoodsFind(treeView1.SelectedNode.Text); dr.Read(); if (dr.HasRows) { frmth.txtSellID.Text = dr[0].ToString(); frmth.txtThGoodsName.Text = dr[4].ToString(); frmth.goodid = dr[2].ToString(); frmth.Kcid = dr[1].ToString(); frmth.txtDataTime.Text = dr[6].ToString(); frmth.txtPrice.Text = dr[7].ToString(); frmth.txtnum.Text = Convert.ToInt32(dr[5].ToString()).ToString(); this.Close(); } dr.Close(); } else { MessageBox.Show("选择商品销售编号!"); } } }
public SellGoodsForm(string EmpID) : this() { txtEmpID.Text = EmpID; sellGoods = new tb_SellGoods(); sellGoodsMenthod = new tb_SellGoodsMenthod(); sellGoodsMenthod.Find(dataGridView1); }
//在treeview中选择要添加的退货商品信息然后点击确定按钮 //添加商品信息按钮 private void button1_Click(object sender, EventArgs e) { if (treeView1.SelectedNode.Text != "商品销售信息") { if (treeView1.SelectedNode.Parent.Text == "商品销售信息") { ThGoodsInfoForm thGoodsInfoForm = (ThGoodsInfoForm)this.Owner; tb_SellGoodsMenthod sellGoodsMenthod = new tb_SellGoodsMenthod(); SqlConnection conn = (new GetSqlConnection()).GetCon(); string sqlcmd = "select * from tb_SellGoods where SellID='" + treeView1.SelectedNode.Text + "'"; SqlCommand cmd = new SqlCommand(sqlcmd, conn); SqlDataReader dataReader = cmd.ExecuteReader(); dataReader.Read(); if (dataReader.HasRows) { thGoodsInfoForm.txtSellID.Text = dataReader[0].ToString(); //销售编号 thGoodsInfoForm.txtThGoodsName.Text = dataReader[3].ToString(); //商品名称 thGoodsInfoForm.goodsID = dataReader[1].ToString(); //商品编号 MessageBox.Show(thGoodsInfoForm.goodsID); thGoodsInfoForm.txtPrice.Text = dataReader[6].ToString(); //退货单价 thGoodsInfoForm.num = dataReader[4].ToString(); //销售数量(限制输入的退货数量) MessageBox.Show("最大退货数量为:" + thGoodsInfoForm.num); } dataReader.Close(); conn.Dispose(); this.Close(); } else { MessageBox.Show("选择商品销售编号"); } } }
public void fillGet() { try { tb_SellGoodsMenthod tbsell = new tb_SellGoodsMenthod(); SqlDataReader dr = tbsell.dtb_SellGoodsFind(this.dataGridView1[1, this.dataGridView1.CurrentCell.RowIndex].Value.ToString()); dr.Read(); if (dr.HasRows) { txtSellID.Text = dr[0].ToString(); txtThGoodsName.Text = dr[4].ToString(); goodid = dr[2].ToString(); Kcid = dr[1].ToString(); txtDataTime.Text = dr[6].ToString(); txtPrice.Text = dr[7].ToString(); txtnum.Text = Convert.ToInt32(dr[5].ToString()).ToString(); } dr.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message.ToString()); } }