public static void update(ProductEntity pro) { Product.update(pro); }
public static int insert(ProductEntity pro) { return Product.insert(pro); }
protected void btn_Save_Click(object sender, EventArgs e) { if (logic.category.isExistShortname(id, txt_ProductNo.Text.Trim())) { Library.Script.ClientMsg("已经存在商品编号,请更换!"); return; } ProductEntity pro = new ProductEntity(); pro.ProductId = id; pro.ProductNo = txt_ProductNo.Text.Trim(); pro.Name = txt_Name.Text; pro.Adminid = logic.sysAdmin.AdminID; pro.AutoAdd = Convert.ToDecimal(txt_AutoAdd.Text); pro.CategoryId = Convert.ToInt32(drp_Type.Value); pro.Description = html_Details.Value.ToString(); pro.Standard = txt_Standard.Text; pro.Unit = txt_Unit.Text; pro.StandardInfor = html_StandardInfor.Value.ToString(); pro.IsSale = cbx_IsSale.Checked; pro.IsAutoPrice = cbx_IsAutoPrice.Checked; pro.IsCurrentCost = cbx_IsCurrentPrice.Checked; if (id != 0) { //如果取消时价后,修改该商品前执行 DAL.Product.productIsCurrentCancelProduct(pro.Adminid, id, pro.IsCurrentCost); logic.product.update(pro); //如果商品加价比例有修改,则增加采购商历史价格 if (txt_AutoAdd.Text.Trim() != hd_autoAdd.Value && cbx_IsAutoPrice.Checked == true) { logic.buyerPriceHistory.insertByUpdateProduct(id); } //创建图片文件 updateFiles(id); string buyers = hd_buyers.Value.ToString(); logic.buyerRange.insertByProductId(buyers, id); } else { int proId = logic.product.insert(pro); //增加企业价格体系 //PriceStructureEntity ps = new PriceStructureEntity(); //decimal autoPercent = 0m; //decimal.TryParse(txt_AutoPercent.Text, out autoPercent); //ps.AutoPercent = autoPercent; //ps.ProductId = proId; //ps.CategoryId = pro.CategoryId; //logic.priceStructure.insertByProduct(ps); //创建图片文件 updateFiles(proId); string buyers = hd_buyers.Value.ToString(); logic.buyerRange.insertByProductId(buyers, proId); } //Library.Script.ClientMsgUrl("保存成功!", "productList.aspx"); Library.Script.RegisterStartup("javascript:alert('保存成功');winClose();"); }