public ActionResult Edit(SpecialModel model, int specialId = -1) { SpecialPerformanceInfo specialInfo = AdminSpecial.GetSpecialById(specialId); if (specialInfo == null) { return(PromptView("专场不存在")); } int specialId2 = AdminSpecial.GetSpecialIdByName(model.SpecialName); if (specialId2 > 0 && specialId2 != specialId) { ModelState.AddModelError("SpecialName", "名称已经存在"); } if (ModelState.IsValid) { specialInfo.DisplayOrder = model.DisplayOrder; specialInfo.Name = model.SpecialName; specialInfo.State = model.State; AdminSpecial.UpdateSpecial(specialInfo); AddMallAdminLog("修改专场", "修改专场,专场ID为:" + specialId); return(PromptView("专场修改成功")); } ViewData["referer"] = MallUtils.GetMallAdminRefererCookie(); return(View(model)); }
/// <summary> /// 通过IDataReader创建SpecialPerformanceInfo信息 /// </summary> public static SpecialPerformanceInfo BuildSpecialFromReader(IDataReader reader) { SpecialPerformanceInfo specialInfo = new SpecialPerformanceInfo(); specialInfo.Specialid = TypeHelper.ObjectToInt(reader["specialid"]); specialInfo.Name = reader["name"].ToString(); specialInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]); specialInfo.State = TypeHelper.ObjectToInt(reader["state"]); return specialInfo; }
/// <summary> /// 获得专场 /// </summary> /// <param name="specialId">专场id</param> /// <returns></returns> public static SpecialPerformanceInfo GetSpecialById(int specialId) { SpecialPerformanceInfo specialInfo = null; IDataReader reader = NStore.Core.BMAData.RDBS.GetSpecialById(specialId); if (reader.Read()) { specialInfo = BuildSpecialFromReader(reader); } reader.Close(); return specialInfo; }
/// <summary> /// 获得专场列表 /// </summary> /// <returns></returns> public static List<SpecialPerformanceInfo> GetSpecialList() { List<SpecialPerformanceInfo> specialList = new List<SpecialPerformanceInfo>(); IDataReader reader = NStore.Core.BMAData.RDBS.GetSpecialList(); while (reader.Read()) { SpecialPerformanceInfo info = BuildSpecialFromReader(reader); specialList.Add(info); } reader.Close(); return specialList; }
public ActionResult Edit(int specialId = -1) { SpecialPerformanceInfo specialInfo = AdminSpecial.GetSpecialById(specialId); if (specialInfo == null) { return(PromptView("专场不存在")); } SpecialModel model = new SpecialModel(); model.DisplayOrder = specialInfo.DisplayOrder; model.SpecialName = specialInfo.Name; model.State = specialInfo.State; ViewData["referer"] = MallUtils.GetMallAdminRefererCookie(); return(View(model)); }
public ActionResult Add(SpecialModel model) { if (AdminSpecial.GetSpecialIdByName(model.SpecialName) > 0) { ModelState.AddModelError("SpecialName", "名称已经存在"); } if (ModelState.IsValid) { SpecialPerformanceInfo specialInfo = new SpecialPerformanceInfo() { DisplayOrder = model.DisplayOrder, Name = model.SpecialName, State = model.State }; AdminSpecial.CreateSpecial(specialInfo); AddMallAdminLog("添加专场", "添加专场,专场为:" + model.SpecialName); return(PromptView("专场添加成功")); } ViewData["referer"] = MallUtils.GetMallAdminRefererCookie(); return(View(model)); }
/// <summary> /// 创建专场 /// </summary> /// <param name="brandInfo"></param> public static void CreateSpecial(SpecialPerformanceInfo specialInfo) { NStore.Core.BMAData.RDBS.CreateSpecial(specialInfo); }