示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode.Text != "商品销售信息")
            {
                if (treeView1.SelectedNode.Parent.Text == "商品销售信息")
                {
                    frmGoodsInfo      frmth  = (frmGoodsInfo)this.Owner;
                    _SellGoodsMenthod tbsell = new _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 void fillGet()
        {
            try {
                _SellGoodsMenthod tbsell = new _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());
            }
        }