/// <summary> /// 自定义模块 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult HomePageModuleDeatilEdit(int id, string postion, int?moduleID, int?moduleHelperID) { ViewBag.Postion = postion; SE_HomePageConfigManager manager = new SE_HomePageConfigManager(); int priortylevel = 1; var list = manager.GetHomePageContentList(moduleID, moduleHelperID); if (list != null && list.Count() > 0) { priortylevel += list.Count(); } if (moduleID != null) { var module = manager.GetHomePageModuleEntity(moduleID.Value); ViewBag.ParentPriortylevel = module.PriorityLevel; } else { var module = manager.GetHomePageModuleHelperEntity(moduleHelperID.Value); ViewBag.ParentPriortylevel = module.PriorityLevel; } if (id == 0) { return(View(new SE_HomePageModuleContentConfig() { PriorityLevel = priortylevel })); } else { return(View(manager.GetHomePageContentEntity(id))); } }
/// <summary> /// 保存 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult HomePageModuleContentSave(SE_HomePageModuleContentConfig model) { SE_HomePageConfigManager manager = new SE_HomePageConfigManager(); if (model.ID == 0) { if (model.FKHomePageModuleID != null) { var moduleModel = manager.GetHomePageModuleEntity(model.FKHomePageModuleID.Value); if (moduleModel != null) { model.StartVersion = moduleModel.StartVersion; model.EndVersion = moduleModel.EndVersion; } } if (model.FKHomePageModuleHelperID != null) { var moduleHelperModel = manager.GetHomePageModuleHelperEntity(model.FKHomePageModuleHelperID.Value); if (moduleHelperModel != null) { model.StartVersion = moduleHelperModel.StartVersion; model.EndVersion = moduleHelperModel.EndVersion; } } model.ID = manager.AddHomePageContent(model); if (model.ID > 0) { AutoReloadCache(); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(model), Author = User.Identity.Name, BeforeValue = "", ChangeDatetime = DateTime.Now, ObjectID = model.ID.ToString(), ObjectType = "PCCLoger", Operation = "新增内容" + model.Title }); return(Json(model.ID)); } else { return(Json(0)); } } else { var before = manager.GetHomePageContentEntity(model.ID); if (manager.UpdateHomePageContent(model)) { AutoReloadCache(); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(model), Author = User.Identity.Name, BeforeValue = JsonConvert.SerializeObject(before), ChangeDatetime = DateTime.Now, ObjectID = model.ID.ToString(), ObjectType = "PCCLoger", Operation = "编辑内容" + model.Title }); return(Json(1)); } else { return(Json(0)); } } }
/// <summary> /// 修改背景图片 /// </summary> /// <param name="moduleID"></param> /// <param name="moduleHelperID"></param> /// <param name="url"></param> /// <returns></returns> public ActionResult UpdateBgImage(int?moduleID, int?moduleHelperID, string url) { SE_HomePageConfigManager mangaer = new SE_HomePageConfigManager(); if (moduleID != null) { var model = mangaer.GetHomePageModuleEntity(moduleID.Value); if (model == null || model.ID == 0) { throw new Exception("模块不存在"); } var before = model.BgImageUrl; model.BgImageUrl = url; if (mangaer.UpdatePageModule(model)) { AutoReloadCache(); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = url, Author = User.Identity.Name, BeforeValue = before, ChangeDatetime = DateTime.Now, ObjectID = model.ID.ToString(), ObjectType = "PCMLoger", Operation = "更改模块背景图片" + model.ModuleName }); return(Json(1)); } else { return(Json(0)); } } else { var model = mangaer.GetHomePageModuleHelperEntity(moduleHelperID.Value); if (model == null || model.ID == 0) { throw new Exception("模块不存在"); } var before = model.BgImageUrl; model.BgImageUrl = url; if (mangaer.UpdateHomePageModuleHelperBgImage(model)) { AutoReloadCache(); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = url, Author = User.Identity.Name, BeforeValue = before, ChangeDatetime = DateTime.Now, ObjectID = model.ID.ToString(), ObjectType = "PCMHLoger", Operation = "更改子模块背景图片" + model.ModuleName }); return(Json(1)); } else { return(Json(0)); } } }
/// <summary> /// 模块内容列表 /// </summary> /// <returns></returns> public ActionResult HomePageModuleContentList(int?moduleID, int?moduleHelperID) { SE_HomePageConfigManager manager = new SE_HomePageConfigManager(); if (moduleID != null) { var module = manager.GetHomePageModuleEntity(moduleID.Value); ViewBag.ModuleName = module.ModuleName; } else { var module = manager.GetHomePageModuleHelperEntity(moduleHelperID.Value); ViewBag.ModuleName = module.ModuleName; } ViewBag.moduleID = moduleID; ViewBag.moduleHelperID = moduleHelperID; var list = manager.GetHomePageContentList(moduleID, moduleHelperID); return(View(list)); }
/// <summary> /// 自定义模块列表明细 /// </summary> /// <param name="moduleID"></param> /// <param name="moduleHelperID"></param> /// <returns></returns> public ActionResult HomePageModuleDeatil(int?moduleID, int?moduleHelperID) { SE_HomePageConfigManager manager = new SE_HomePageConfigManager(); ViewBag.ModuleID = moduleID; ViewBag.ModuleHelperID = moduleHelperID; if (moduleID != null) { var module = manager.GetHomePageModuleEntity(moduleID.Value); return(View(module)); } else { var module = manager.GetHomePageModuleHelperEntity(moduleHelperID.Value); return(View(new SE_HomePageModuleConfig() { BgImageUrl = module.BgImageUrl, ModuleType = module.ModuleType })); } }
/// <summary> /// 模块内容的 /// </summary> /// <returns></returns> public ActionResult HomePageModuleContent(int id, int?moduleID, int?moduleHelperID) { SE_HomePageConfigManager manager = new SE_HomePageConfigManager(); VIPAuthorizationRuleConfigManager vip = new VIPAuthorizationRuleConfigManager(); int count = 0; ViewBag.VIPList = vip.GetVIPAuthorizationRuleConfigList("", int.MaxValue, 1, out count); int priortylevel = 1; var list = manager.GetHomePageContentList(moduleID, moduleHelperID); if (list != null && list.Count() > 0) { priortylevel += list.Count(); } if (moduleID != null) { var module = manager.GetHomePageModuleEntity(moduleID.Value); ViewBag.ParentPriortylevel = module.PriorityLevel; } else { var module = manager.GetHomePageModuleHelperEntity(moduleHelperID.Value); ViewBag.ParentPriortylevel = module.PriorityLevel; } if (id == 0) { return(View(new SE_HomePageModuleContentConfig() { PriorityLevel = priortylevel })); } else { return(View(manager.GetHomePageContentEntity(id))); } }