public bool SaveData() { var result = false; using (var ctx = new EF6.RT2020Entities()) { var item = ctx.ProductSupplement.Where(x => x.ProductId == this._ProductId).FirstOrDefault(); if (item == null) { item = new EF6.ProductSupplement(); item.SupplementId = Guid.NewGuid(); item.ProductId = _ProductId; ctx.ProductSupplement.Add(item); } item.Product.FixedPriceItem = chkFixedPrice.Checked; item.VipDiscount_FixedItem = DecimalHelper.StringToDecimal(txtFixPriceItem.Text); item.VipDiscount_DiscountItem = DecimalHelper.StringToDecimal(txtDiscountItem.Text); item.VipDiscount_NoDiscountItem = DecimalHelper.StringToDecimal(txtNoDiscountItem.Text); item.StaffDiscount = DecimalHelper.StringToDecimal(txtStaffDiscount.Text); ctx.SaveChanges(); } return(result); }
public bool SaveData() { var result = false; using (var ctx = new EF6.RT2020Entities()) { var item = ctx.Product.Where(x => x.ProductId == _ProductId).FirstOrDefault(); if (item != null) { item.AlternateItem = txtVendorItemNum.Text.Trim(); item.ReorderLevel = DecimalHelper.StringToDecimal(txtReorderLevel.Text); item.ReorderQty = DecimalHelper.StringToDecimal(txtReorderQuantity.Text); ctx.SaveChanges(); } } return(result); }