/// <summary> /// 编辑添加一个广告 /// </summary> public void AdvertImage_Edit() { if (!EX_Admin.Power("advertimage_edit", "编辑广告")) { AjaxNoPower(); return; } int id = RequestTool.RequestInt("id", 0); Lebi_Advert model = B_Lebi_Advert.GetModel(id); if (model == null) { model = new Lebi_Advert(); model = B_Lebi_Advert.BindForm(model); model.Language_Codes = Language.LanuageidsToCodes(model.Language_ids); B_Lebi_Advert.Add(model); model.id = B_Lebi_Advert.GetMaxId(); } else { model = B_Lebi_Advert.BindForm(model); model.Language_Codes = Language.LanuageidsToCodes(model.Language_ids); B_Lebi_Advert.Update(model); } string action = Tag("编辑广告"); Lebi_Theme theme = B_Lebi_Theme.GetModel(model.Theme_id); if (theme != null) { ImageHelper.LebiImagesUsed(theme.Path_Files + "/advertment/" + model.Image, "advertment", model.id); } Log.Add(action, "AdvertImage", model.id.ToString(), CurrentAdmin); Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("advertimage_edit", "编辑广告")) { PageNoPower(); } int id = RequestTool.RequestInt("id", 0); int aid = RequestTool.RequestInt("aid"); advert = B_Lebi_Theme_Advert.GetModel(aid); if (advert == null) { PageError(); return; } theme = B_Lebi_Theme.GetModel(advert.Theme_id); model = B_Lebi_Advert.GetModel(id); if (model == null) { model = new Lebi_Advert(); model.Theme_Advert_Code = advert.Code; model.Theme_Advert_id = advert.id; } }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Advert model) { return(D_Lebi_Advert.Instance.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Advert model) { D_Lebi_Advert.Instance.Update(model); }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Advert SafeBindForm(Lebi_Advert model) { return(D_Lebi_Advert.Instance.SafeBindForm(model)); }