protected void bind(int id) { if (id <= 0) { Response.Write("<script>alert('无效的参数');history.go(-1);</script>"); return; } string where = "wx_MaterialID=" + id; List <wx_MaterialInfo> list = BLL.wx_MaterialBLL.GetList(1, where, ""); if (list == null || list.Count == 0) { Response.Write("<script>alert('无对应的数据');history.go(-1);</script>"); return; } wx_MaterialInfo info = list[0]; Name = info.Name; Body = info.Body; CreateTime = info.CreateTime.ToString("yyyy-MM-dd"); if (info.ImgUrl.Trim().Length > 0) { ImgUrl = "<img src=\"" + info.ImgUrl + "\"/>"; } }
protected void bindlist() { if (parentid > 0) { info = BLL.wx_MaterialBLL.GetModel(parentid); list = BLL.wx_MaterialBLL.GetList(-1, "parentid=" + parentid, "CreateTime asc"); } }
protected void save() { try { wx_MaterialInfo model = new wx_MaterialInfo(); if (id > 0) { model = BLL.wx_MaterialBLL.GetModel(id); if (model == null || model.wx_MaterialID != id) { Response.Write("<script>parent.fail('参数id错误!');</script>"); return; } } model.Name = Common.Utils.ObjectToStr(Request.Form["Name"]); model.Paper = Common.Utils.ObjectToStr(Request.Form["Paper"]); model.Body = Common.Utils.ObjectToStr(Request.Form["Body"]); model.ImgUrl = Common.Utils.ObjectToStr(Request.Form["ImgUrl"]); model.Url = Common.Utils.ObjectToStr(Request.Form["url"]); //if (model.Url.Trim().Length == 0) //{ // model.Url = Common.Constant.Get_Host() + "/mobile/wx/wx_appmsg.aspx?id="; //} int saveresult = 0; string resultmsg = ""; if (id > 0) { saveresult = BLL.wx_MaterialBLL.Update(model); } else { model.companyid = ""; model.CreateTime = DateTime.Now; model.ParentID = parentid; model.Type = 3; saveresult = BLL.wx_MaterialBLL.Insert(model, BS.Components.Data.Entity.ReturnTypes.Identity); } if (saveresult > 0) { if (parentid <= 0) { parentid = saveresult; } Response.Write("<script>parent.success('" + parentid + "');</script>"); } else { Response.Write("<script>parent.fail('提交失败!" + resultmsg.Replace("'", "").Replace("\r", "").Replace("\n", "") + "');</script>"); } } catch (Exception exc) { Response.Write("<script>parent.fail('提交失败!" + exc.Message.Replace("'", "").Replace("\r", "").Replace("\n", "") + "');</script>"); } }
private void bind() { string link_url = ""; if (id > 0) { wx_MaterialInfo info = BLL.wx_MaterialBLL.GetModel(id); if (info == null || info.wx_MaterialID != id) { Response.Write("<script>alert('不存在对应的数据');history.go(-1);</script>"); return; } Name = info.Name; Paper = info.Paper; Body = info.Body; ImgUrl = info.ImgUrl; link_url = info.Url; } selecturl = BLL.UrlBLL.get_select("url", link_url); }