// 添加新商品 private void AddGoods_Click(object sender, EventArgs e) { goodsRedact = new GoodsRedact() { Manage = this }; // 激活商品编辑窗口并打开 goodsRedact.Show(); }
// 修改指定的商品 private void GoodsAlter_Click(object sender, EventArgs e) { goodsRedact = new GoodsRedact() // 激活商品编辑窗口 { commodity = new CommodityTable // 获取选中的商品对象 { Number = (int)Dgv_GoodsList.SelectedCells[0].Value, CommodityName = Dgv_GoodsList.SelectedCells[1].Value.ToString().Trim(), CommodityUnit = Dgv_GoodsList.SelectedCells[2].Value.ToString(), Quantity = int.Parse(Dgv_GoodsList.SelectedCells[4].Value.ToString()), PurchasePice = double.Parse(Dgv_GoodsList.SelectedCells[3].Value.ToString().Trim()), Retail = double.Parse(Dgv_GoodsList.SelectedCells[5].Value.ToString()), Type = new CommodityTypeTable { TypeName = Dgv_GoodsList.SelectedCells[6].Value.ToString() }, Path = Dgv_GoodsList.SelectedCells[7].Value.ToString().Trim() }, Manage = this, }; goodsRedact.Show(); }