/// <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 + "\"}"); }
/// <summary> /// 编辑保存促销 /// </summary> public void Promotion_Edit() { int id = RequestTool.RequestInt("id", 0); int tid = RequestTool.RequestInt("tid", 0); Lebi_Promotion model = B_Lebi_Promotion.GetModel(id); Lebi_Promotion_Type pt; bool addflag = false; if (model == null) { if (!EX_Admin.Power("promotion_add", "添加促销活动")) { AjaxNoPower(); return; } pt = B_Lebi_Promotion_Type.GetModel(tid); model = new Lebi_Promotion(); addflag = true; } else { if (!EX_Admin.Power("promotion_edit", "编辑促销活动")) { AjaxNoPower(); return; } pt = B_Lebi_Promotion_Type.GetModel(model.Promotion_Type_id); } if (pt == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } B_Lebi_Promotion.BindForm(model); model.IsCase801 = RequestTool.RequestInt("IsCase801", 0); model.IsCase802 = RequestTool.RequestInt("IsCase802", 0); model.IsCase803 = RequestTool.RequestInt("IsCase803", 0); model.IsCase804 = RequestTool.RequestInt("IsCase804", 0); model.IsCase805 = RequestTool.RequestInt("IsCase805", 0); model.IsCase806 = RequestTool.RequestInt("IsCase806", 0); model.IsRule901 = RequestTool.RequestInt("IsRule901", 0); model.IsRule902 = RequestTool.RequestInt("IsRule902", 0); model.IsRule903 = RequestTool.RequestInt("IsRule903", 0); model.IsRule904 = RequestTool.RequestInt("IsRule904", 0); model.IsRule905 = RequestTool.RequestInt("IsRule905", 0); model.IsRule906 = RequestTool.RequestInt("IsRule906", 0); model.IsRule907 = RequestTool.RequestInt("IsRule907", 0); model.IsRule908 = RequestTool.RequestInt("IsRule908", 0); model.IsRule909 = RequestTool.RequestInt("IsRule909", 0); model.IsRule910 = RequestTool.RequestInt("IsRule910", 0); model.IsRule911 = RequestTool.RequestInt("IsRule911", 0); model.IsRule912 = RequestTool.RequestInt("IsRule912", 0); model.Case804 = RequestTool.RequestString("Case804");; //处理包含商品 string Case805 = RequestTool.RequestString("Case805"); Case805 = Case805.Replace(",", "','"); Case805 = "'" + Case805 + "'"; List <Lebi_Product> pros = B_Lebi_Product.GetList("Number in (" + Case805 + ")", ""); string ids = ""; foreach (Lebi_Product pro in pros) { if (ids == "") { ids = pro.id.ToString(); } else { ids = ids + "," + pro.id.ToString(); } } model.Case805 = ids; model.Admin_id = CurrentAdmin.id; model.Admin_UserName = CurrentAdmin.UserName; model.Time_Start = pt.Time_Start; model.Time_End = pt.Time_End; model.Type_id_PromotionStatus = pt.Type_id_PromotionStatus; model.Remark = RequestTool.RequestString("Remark"); model.Sort = RequestTool.RequestInt("Sort", 0); model.Promotion_Type_id = pt.id; if (model.IsCase801 > 0 || model.IsCase802 > 0 || model.IsCase803 > 0 || model.IsCase804 > 0 || model.IsCase805 > 0) { model.IsSetCase = 1; } else { model.IsSetCase = 0; } if (addflag) { B_Lebi_Promotion.Add(model); model.id = B_Lebi_Promotion.GetMaxId(); } else { B_Lebi_Promotion.Update(model); } Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}"); }