// // GET: /LotteryActivitysAreaRedPack/ public ActionResult Index(int activityID) { LotteryActivitys activity = LotteryActivitys.GetEntityByID(activityID); ViewData["activity"] = activity; List <SYSIntegralCodeArea> areas = SYSIntegralCodeArea.GetEntitysAll(); foreach (var item in areas) { LotteryActivitysAreaRedPack old = LotteryActivitysAreaRedPack.GetEntityActArea(activity.ID, item.ID); if (old == null) { LotteryActivitysAreaRedPack newmodel = new LotteryActivitysAreaRedPack(); newmodel.ActivityID = activity.ID; newmodel.AreaID = item.ID; newmodel.InsertAndReturnIdentity(); } } List <LotteryActivitysAreaRedPack> LAARPs = LotteryActivitysAreaRedPack.GetEntitysByActivityID(activity.ID); foreach (var item in LAARPs) { if (areas.Count(m => m.ID == item.AreaID) <= 0) { LotteryActivitysAreaRedPack.DeleteByID(item.ID); } } LAARPs = LAARPs.FindAll(m => areas.Count(n => n.ID == m.AreaID) > 0); ViewData["LAARPs"] = LAARPs; ViewData["areas"] = areas; return(View()); }
public ContentResult ToDel(int id) { if (SYSIntegralCodeArea.DeleteByID(id) > 0) { SYSIntegralCode.ClearAreaID(id); return(Content("ok")); } return(Content("删除出错")); }
public ContentResult ToDels(int[] ids) { bool rtn = SYSIntegralCodeArea.ToDels(ids); if (rtn) { return(Content("ok")); } else { return(Content("操作失败,网络异常")); } }
public ContentResult ToEdit(SYSIntegralCodeArea para) { if (string.IsNullOrWhiteSpace(para.AreaName)) { return(Content("区域名称不能为空")); } if (RepeatHelper.NoRepeatTwoAnd("SYSIntegralCodeArea", "AreaName", para.AreaName, "ActivityID", para.ActivityID.ToString(), para.ID) > 0) { return(Content("区域名称已存在")); } int rtn = para.EditByID(); if (rtn > 0) { return(Content("ok")); } return(Content("保存出错")); }
public ActionResult ToAdd(SYSIntegralCodeArea para) { if (string.IsNullOrWhiteSpace(para.AreaName)) { return(Content("区域名称不能为空")); } if (RepeatHelper.NoRepeatTwoAnd("SYSIntegralCodeArea", "AreaName", para.AreaName, "ActivityID", para.ActivityID.ToString(), para.ID) > 0) { return(Content("区域名称已存在")); } int rtn = para.InsertAndReturnIdentity(); if (rtn > 0) { para.ID = rtn; return(Json(para, JsonRequestBehavior.AllowGet)); } return(Json("error")); }
public ActionResult Edit(int id) { SYSIntegralCodeArea para = SYSIntegralCodeArea.GetEntityByID(id); return(View(para)); }