private void Save() { AjaxResult result = new AjaxResult(); result.IsSuccess = false; result.Msg = "保存失败!"; int id = 0; if (!string.IsNullOrEmpty(Request.Form["id"])) { id = Convert.ToInt32(Request.Form["id"]); var model = bll.Get(id); model.CreateTime = DateTime.Parse(Request.Form["CreateTime"]); model.ExpiryDate = DateTime.Parse(Request.Form["ExpiryDate"]); model.Title = Request.Form["Title"]; model.Summary = Server.HtmlDecode(Request.Form["Summary"]); model.SummaryCode = Server.HtmlDecode(Request.Form["SummaryCode"]); model.Catalog = Request.Form["CataLog"]; if (bll.Update(model)) { result.IsSuccess = true; result.Msg = "更新成功!"; } } else { var model = new SupplyDemandInfo(); model.CreateTime = DateTime.Parse(Request.Form["CreateTime"]); model.ExpiryDate = DateTime.Parse(Request.Form["ExpiryDate"]); model.Title = Request.Form["Title"]; model.Summary = Server.HtmlDecode(Request.Form["Summary"]); model.SummaryCode = Server.HtmlDecode(Request.Form["SummaryCode"]); model.Catalog = Request.Form["CataLog"]; model.State = "0"; model.CompanyCode3 = User.CompanyCode3; model.CompanyName = Request.Form["CompanyName"]; model.Creator = User.ID; model.CreateName = User.UserName; model.ActorID = User.ID; model.CreateTime = DateTime.Now; if (bll.Add(model)) { result.IsSuccess = true; result.Msg = "增加成功!"; } } Response.Clear(); Response.Write(result.ToJsonString()); Response.ContentType = "application/json"; Response.End(); }
private void Init() { SupplyDemandInfo sdi = new SupplyDemandInfo { Creator = User.ID, CreateName = User.UserName, CreateTime = DateTime.Today }; var company = userInfoBLL.GetUserCompany(User.ID); if (company != null) { sdi.CompanyCode3 = company.CompanyCode3; sdi.CompanyName = company.CompanyName; } var strJSON = string.Empty; strJSON = JsonConvert.SerializeObject(sdi); Response.Clear(); Response.Write(strJSON); Response.ContentType = "application/json"; Response.End(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SupplyDemandInfo model) { return(dal.Update(model) > 0); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(SupplyDemandInfo model) { return(dal.Add(model) > 0); }