/// <summary> /// 编辑促销 /// </summary> public void PromotionType_Edit() { int id = RequestTool.RequestInt("id", 0); Lebi_Promotion_Type model = B_Lebi_Promotion_Type.GetModel(id); bool addfalg = false; if (model == null) { if (!EX_Admin.Power("promotion_add", "添加促销活动")) { AjaxNoPower(); return; } model = new Lebi_Promotion_Type(); addfalg = true; } model = B_Lebi_Promotion_Type.BindForm(model); model.Name = Language.RequestString("Name"); model.Content = Language.RequestString("Content"); if (addfalg) { model.Admin_id = CurrentAdmin.id; model.Admin_UserName = CurrentAdmin.UserName; B_Lebi_Promotion_Type.Add(model); model.id = B_Lebi_Promotion_Type.GetMaxId(); } else { if (!EX_Admin.Power("promotion_edit", "编辑促销活动")) { AjaxNoPower(); return; } B_Lebi_Promotion_Type.Update(model); //更新规则的状态 List <Lebi_Promotion> ps = B_Lebi_Promotion.GetList("Promotion_Type_id=" + model.id + "", ""); foreach (Lebi_Promotion p in ps) { p.Type_id_PromotionStatus = model.Type_id_PromotionStatus; p.Time_End = model.Time_End; p.Time_Start = model.Time_Start; B_Lebi_Promotion.Update(p); } } Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("promotion_list", "促销活动列表")) { PageReturnMsg = PageNoPowerMsg(); } tid = RequestTool.RequestInt("tid", 0); pt = B_Lebi_Promotion_Type.GetModel(tid); if (pt == null) { PageError(); return; } string where = "Promotion_Type_id=" + tid; PageSize = RequestTool.getpageSize(25); models = B_Lebi_Promotion.GetList(where, "Sort desc", PageSize, page); int recordCount = B_Lebi_Promotion.Counts(where); PageString = Pager.GetPaginationString("?page={0}&tid=" + tid, page, PageSize, recordCount); }