//加载 public void LoadDataBind() { int ID = CommonClass.ReturnRequestInt("id", 0); if (ID > 0) { TB_Product_Reply model = ProductService.ReplyService.Get(ID); if (model.ID.ToInt() > 0) { TbContent.Text = model.ComContent; ViewState["id"] = model.ID; } } }
//保存 protected void BtnSave_Click(object sender, EventArgs e) { TB_Product_Reply model = new TB_Product_Reply(); if (ViewState["id"] != null) { model = ProductService.ReplyService.Get(ViewState["id"]); } else { model.QuestionID = Request["qid"].ToInt(); } model.MemberID = AdminUserID; model.ComContent = TbContent.Text; model.AddDate = DateTime.Now; if (ViewState["id"] == null) { if (ProductService.ReplyService.Insert(model) == 1) { MessageDiv.InnerHtml = CommonClass.Reload("数据添加成功"); } else { MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败"); } } else { if (ProductService.ReplyService.Update(model) == 1) { MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功"); } else { MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败"); } } }