//修改 protected void imgUpdatebtn_Click(object sender, ImageClickEventArgs e) { if (!string.IsNullOrEmpty(txtProductId.Text)) { Products item = new Products(); //修改条件 HttpContext.Current.Response.Write("<script language='javascript'>alert(' 请输入密码? ');</script>"); item.ProductId = txtProductId.Text; item.ProductName = txtProductName.Text; decimal result = 0; //成本价 if (decimal.TryParse(txtProductCost.Text, out result)) { item.ProductCost = decimal.Parse(txtProductCost.Text); } else { HttpContext.Current.Response.Write("<script language='javascript'>alert('产品成本价不符合要求!');</script>"); } //销售价 decimal result1 = 0; if (decimal.TryParse(txtSalePrice.Text, out result1)) { item.SalePrice = decimal.Parse(txtSalePrice.Text); } else { HttpContext.Current.Response.Write("<script language='javascript'>alert('产品销售价不符合要求!');</script>"); } //最低库存量 decimal result2 = 0; if (decimal.TryParse(txtCurrentstock.Text, out result2)) { item.Currentstock = decimal.Parse(txtCurrentstock.Text); } else { HttpContext.Current.Response.Write("<script language='javascript'>alert('最低库存量不符合要求!');</script>"); } //是否要提醒 item.StockNotifyStatus = int.Parse(dwlStockNotifyStatus.SelectedItem.Value); item.Remarks = txtRemarks.Text; item.UpdateDate = DateTime.Now; if (Session["LoginedAdmin"] != null) { AdUserInfo adminUserObj = (AdUserInfo)Session["LoginedAdmin"]; item.Updater = adminUserObj.AdminUserId; } item.ProductUnits = txtProductUnits.Text; //更新产品信息 if (ProductsDAL.UpdateProductInfo(item)) { InitProduct(item.ProductId); HttpContext.Current.Response.Write("<script language='javascript'>alert('修改产品信息成功!');</script>"); } else { HttpContext.Current.Response.Write("<script language='javascript'>alert('修改产品信息失败!');</script>"); } } else { HttpContext.Current.Response.Write("<script language='javascript'>alert('没有产品信息无法修改!');</script>"); } }