Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            FrmGood frmGood = new FrmGood(this);

            frmGood.title = "新增";
            frmGood.ShowDialog();
            query();
        }
Пример #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            //如果没记录则不处理
            if (dataGridView1.RowCount <= 0)
            {
                return;
            }
            if ((dataGridView1.SelectedRows[0].Cells[0].Value) == null)
            {
                return;
            }
            //获取选择行并赋值给对象
            GoodsId goodsId = new GoodsId();
            Object  temp;

            goodsId.id           = long.Parse(dataGridView1.SelectedRows[0].Cells["id"].Value.ToString());
            temp                 = dataGridView1.SelectedRows[0].Cells["goods"].Value;
            goodsId.goods        = (temp == null ? "" : temp.ToString());
            temp                 = dataGridView1.SelectedRows[0].Cells["describe"].Value;
            goodsId.describe     = (temp == null ? "" : temp.ToString());
            temp                 = dataGridView1.SelectedRows[0].Cells["collect_date"].Value;
            goodsId.collect_date = (temp == null ? DateTime.Now : DateTime.Parse(temp.ToString()));


            temp = dataGridView1.SelectedRows[0].Cells["collect_addr"].Value;
            goodsId.collect_addr = (temp == null?"": temp.ToString());
            temp = dataGridView1.SelectedRows[0].Cells["contact_man"].Value;
            goodsId.contact_man = (temp == null ? "" : temp.ToString());
            temp = dataGridView1.SelectedRows[0].Cells["contact_phone"].Value;
            goodsId.contact_phone = (temp == null ? "" : temp.ToString());
            temp = dataGridView1.SelectedRows[0].Cells["contact_email"].Value;
            goodsId.contact_email = (temp == null ? "" : temp.ToString());
            //打开维护物品界面,并把获取的输入传过去
            FrmGood frmGood = new FrmGood(this, goodsId);

            frmGood.title = "修改";
            frmGood.ShowDialog();
            //查询最新的数据
            query();
        }