/// <summary> /// 绑定编辑商品的详细信息 /// </summary> private void BindGoodsTest() { goods = new VipSoft.BLL.Goods(); gs = new VipSoft.Model.Goods(); gs = goods.GetModel(GoodsID); lblGoodsCode.Text = gs.GoodsCode; lblGoodsName.Text = gs.Name; lblUnitType.Text = gs.Unit; // lblRemark.Text = gs.Remark; lblNameCode.Text = gs.NameCode; // lblRemark.Text = gs.Remark; lblNameCode.Text = gs.NameCode; lblBuyPrice.Text = gs.BuyPrice.ToString(); //参考进价 lblNumber.Text = gs.Number.ToString(); //当前库存 // txtReferencePrice.Text = gs.BuyPrice.ToString("¥0.00"); if (goodsModify == null) //不是修改商品 { this.txtReferencePrice.Text = ((decimal)gs.BuyPrice).ToString("¥0.00"); } else { this.txtCount.Text = _goodsNumber.ToString(); this.txtReferencePrice.Text = _buyPrice; } }
// 删除记录 private void DeleteItem() { if (this.dataGridView_List.SelectedRows.Count != 1) return; int goodsID = int.Parse(this.dataGridView_List.SelectedRows[0].Cells[1].Value.ToString()); string goodsCode = this.dataGridView_List.SelectedRows[0].Cells[2].Value.ToString(); string goodsName = this.dataGridView_List.SelectedRows[0].Cells[3].Value.ToString(); DialogResult dRes = MessageBox.Show("您确定要删除此产品么?此操作不可恢复。注意:删除后此产品相关的消费数据统计会出现错乱", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dRes == DialogResult.No) return; VipSoft.BLL.Goods goods = new VipSoft.BLL.Goods(); VipSoft.Model.Goods ginfo = goods.GetModel(goodsID); if (goods.Delete(goodsID)) { // 记录日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master, "产品管理", string.Format("删除产品,ID:{0}编号:{1}名称:{2}库存:{3}销售量:{4}售价:{5}积分:{6}最低折扣:{7}", goodsID.ToString(), goodsCode, goodsName, ginfo.Number, ginfo.SaleNumber, ginfo.Price, ginfo.Point, ginfo.MinPercent), DateTime.Now)); // 提示 MessageBox.Show("产品已被删除。"); // 重新绑定 BindList(); } }