//修改加盟价 protected void txt_ChangeJoinPrice_OnTextChanged(object sender, EventArgs e) { var textBox = (TextBox)sender; var dataItem = ((GridDataItem)textBox.Parent.Parent); if (dataItem != null) { var goodsId = new Guid(dataItem.GetDataKeyValue("GoodsID").ToString()); var joinPriceNew = Convert.ToDecimal(textBox.Text); try { string errorMsg; bool result = _goodsCenterSao.UpdateJoinPrice(goodsId, joinPriceNew, out errorMsg); if (result) { var goodsCode = dataItem.GetDataKeyValue("GoodsCode").ToString(); var goodsName = dataItem.GetDataKeyValue("GoodsName").ToString(); var joinPriceOld = Convert.ToDecimal(dataItem.GetDataKeyValue("JoinPrice").ToString()); if (!joinPriceOld.Equals(joinPriceNew)) { var goodsPriceChange = new Model.GoodsPriceChange { Id = Guid.NewGuid(), Name = CurrentSession.Personnel.Get().RealName, Datetime = DateTime.Now, GoodsId = goodsId, GoodsName = goodsName, GoodsCode = goodsCode, SaleFilialeId = Guid.Empty, SaleFilialeName = string.Empty, SalePlatformId = Guid.Empty, SalePlatformName = string.Empty, OldPrice = joinPriceOld, NewPrice = joinPriceNew, Quota = joinPriceOld - joinPriceNew, Type = 1 }; _goodsPriceChange.AddGoodsPriceChange(goodsPriceChange); } RG_GoodsPriceList.Rebind(); } } catch (Exception ex) { RAM.Alert("无效的操作。" + ex.Message); } } }
/// <summary> /// 向GoodsPriceChange表插入一条数据,插入成功则返回自增列数值,插入不成功则返回-1 /// </summary> /// <param name="goodsPriceChange">GoodsPriceChange</param> /// <returns></returns> public bool AddGoodsPriceChange(GoodsPriceChange goodsPriceChange) { return(_goodsPriceChange.AddGoodsPriceChange(goodsPriceChange)); }