/// <summary> /// 根据名称获取内容模板 /// </summary> /// <returns></returns> public TempletEntity GetCModelByActionName(string actionName, string webSiteId, bool isMobile) { TempletEntity templet = new TempletEntity(); ColumnsApp c_ModulesApp = new ColumnsApp(); ColumnsEntity module = c_ModulesApp.GetModelByActionName(actionName, webSiteId); if (module != null) { if (isMobile && new WebSiteApp().IsMobile(webSiteId)) { templet = service.FindEntity(m => m.Id == module.MCTempletId && m.WebSiteId == webSiteId && m.EnabledMark == true && m.DeleteMark != true); } else { templet = service.FindEntity(m => m.Id == module.CTempletId && m.WebSiteId == webSiteId && m.EnabledMark == true && m.DeleteMark != true); } } return(templet); }
/// <summary> /// 获取全站搜索模板 /// </summary> /// <returns></returns> public TempletEntity GetSearchModel(string webSiteId, bool isMobile) { TempletEntity templet = new TempletEntity(); var expression = ExtLinq.True <TempletEntity>(); if (!string.IsNullOrEmpty(webSiteId)) { if (isMobile && new WebSiteApp().IsMobile(webSiteId)) { expression = expression.And(t => t.WebSiteId == webSiteId && t.DeleteMark != true && t.EnabledMark == true && t.TempletType == (int)Enums.TempletType.MSearch); } else { expression = expression.And(t => t.WebSiteId == webSiteId && t.DeleteMark != true && t.EnabledMark == true && t.TempletType == (int)Enums.TempletType.Search); } } templet = service.FindEntity(expression); return(templet); }
/// <summary> /// 根据路径获取模板 /// </summary> /// <returns></returns> public TempletEntity GetModelByUrlRaws(RequestModel requestModel, ref int irequestType) { TempletEntity templet = new TempletEntity(); if (requestModel.UrlRaws != null) { if (Common.IsSearchForUrl(requestModel.UrlRaws)) { if (new WebSiteApp().IsSearch(requestModel.webSite?.Id) || new WebSiteApp().IsMSearch(requestModel.webSite?.Id)) { templet = GetSearchModel(requestModel.webSite?.Id, requestModel.IsMobile); irequestType = (int)Enums.TempletType.Search; } } else { string Ids = requestModel.UrlRaws.LastOrDefault(); int Id = 0; if (requestModel.UrlRaws.Count == 1 || Int32.TryParse(Ids, out Id)) { templet = GetModelByActionName(requestModel.UrlRaws.FirstOrDefault(), requestModel.webSite?.Id, requestModel.IsMobile); } else { templet = GetCModelByActionName(requestModel.UrlRaws.FirstOrDefault(), requestModel.webSite?.Id, requestModel.IsMobile); } } } return(templet); }
public TempletEntity GetFormByName(string webSiteShortName, string Name) { TempletEntity model = new TempletEntity(); WebSiteEntity entity = new WebSiteApp().GetFormByShortName(webSiteShortName); if (entity != null && !string.IsNullOrEmpty(entity.Id)) { model = service.FindEntity(m => m.FullName == Name && m.WebSiteId == entity.Id && m.DeleteMark != true); } return(model); }
public void DeleteForm(string keyValue) { TempletEntity moduleEntity = service.FindEntity(keyValue); if (moduleEntity != null) { //验证用户站点权限 iUserRepository.VerifyUserWebsiteRole(moduleEntity.WebSiteId); } service.DeleteById(t => t.Id == keyValue); //添加日志 LogHelp.logHelp.WriteDbLog(true, "删除模板信息=>" + keyValue, Enums.DbLogType.Delete, "模板管理"); }
public ActionResult SubmitForm(TempletEntity moduleEntity, string keyValue) { try { moduleEntity.WebSiteId = Base_WebSiteId; moduleEntity.TempletType = (int)Code.Enums.TempletType.Common; templetApp.SubmitForm(moduleEntity, keyValue); return(Success("操作成功。")); } catch (Exception e) { return(Error(e.Message)); } }
/// <summary> /// 添加站点搜索模板 /// </summary> /// <param name="moduleEntity"></param> /// <param name="db"></param> private void AddMSearchModel(WebSiteEntity moduleEntity, IRepositoryBase db) { if (!iTempletRepository.IsExistMSearchModel(moduleEntity.Id)) { TempletEntity templetEntity = new TempletEntity(); templetEntity.WebSiteId = moduleEntity.Id; templetEntity.SortCode = 1; templetEntity.FullName = ConfigHelp.configHelp.WEBSITESEARCHPATH; templetEntity.Description = "移动端全站搜索模板"; templetEntity.TempletType = (int)Code.Enums.TempletType.MSearch; templetEntity.EnabledMark = true; templetEntity.Create(); db.Insert(templetEntity); } }
public void GenStaticPage(string keyValue) { ContentEntity moduleEntity = service.FindEntity(keyValue); if (moduleEntity != null) { //验证用户站点权限 iUserRepository.VerifyUserWebsiteRole(moduleEntity.WebSiteId); } ColumnsEntity columnsEntity = GetModuleByContentID(keyValue); if (columnsEntity != null && (columnsEntity.Type == (int)Enums.ModuleType.List || columnsEntity.Type == (int)Enums.ModuleType.AdvancedList)) { if (new WebSiteApp().IsOverSizeByWebSiteId(columnsEntity.WebSiteId)) { throw new Exception("该站点空间已不足,请联系管理员!"); } WebSiteApp webSiteApp = new WebSiteApp(); WebSiteEntity webSiteEntity = webSiteApp.GetFormNoDel(columnsEntity.WebSiteId); if (webSiteEntity != null && !string.IsNullOrEmpty(webSiteEntity.Id)) { TempletApp templetapp = new TempletApp(); TempletEntity templet = templetapp.GetFormNoDel(columnsEntity.CTempletId); if (templet != null) { new TempHelp().GenHtmlPage(keyValue, webSiteEntity, columnsEntity, templet); } if (new WebSiteApp().IsMobile(webSiteEntity.Id)) { templet = templetapp.GetFormNoDel(columnsEntity.MCTempletId); if (templet != null) { new TempHelp().GenMHtmlPage(keyValue, webSiteEntity, columnsEntity, templet); } } } //添加日志 LogHelp.logHelp.WriteDbLog(true, "内容信息=>生成列表详情静态页" + columnsEntity.FullName, Enums.DbLogType.Submit, "内容管理"); } }
/// <summary> /// 获取默认模板 /// </summary> /// <returns></returns> public TempletEntity GetMain(RequestModel requestModel) { TempletEntity templet = new TempletEntity(); ColumnsApp c_ModulesApp = new ColumnsApp(); ColumnsEntity module = c_ModulesApp.GetMain(requestModel.WebSiteId); if (module != null) { if (requestModel.IsMobile && new WebSiteApp().IsMobile(requestModel.WebSiteId)) { templet = service.FindEntity(m => m.Id == module.MTempletId && m.WebSiteId == requestModel.WebSiteId && m.EnabledMark == true && m.DeleteMark != true); } else { templet = service.FindEntity(m => m.Id == module.TempletId && m.WebSiteId == requestModel.WebSiteId && m.EnabledMark == true && m.DeleteMark != true); } } return(templet); }
public void SubmitForm(TempletEntity moduleEntity, string keyValue) { service.SubmitForm(moduleEntity, keyValue); }
/// <summary> /// 添加站点栏目 /// </summary> /// <param name="moduleEntity"></param> /// <param name="db"></param> private void AddColumns(WebSiteEntity moduleEntity, IRepositoryBase db, List <TempletEntity> TempletModels) { List <ColumnsEntity> cmodels = new List <ColumnsEntity>(); if (!string.IsNullOrEmpty(moduleEntity.Id)) { List <SysColumnsEntity> models = iSysTempletsRepository.GetListBySysTempletId(moduleEntity.SysTempletId); List <TempletEntity> tempModels = GetListByWebSiteId(moduleEntity.Id); if (TempletModels != null && TempletModels.Count > 0) { tempModels.AddRange(TempletModels); } List <SysTempletItemsEntity> systempsModels = iSysTempletsRepository.GetItemList(moduleEntity.SysTempletId); if (models != null && models.Count > 0) { foreach (SysColumnsEntity model in models) { string strNewIds = Guid.NewGuid().ToString(); models.ForEach(delegate(SysColumnsEntity m) { if (m.ParentId == model.Id) { m.ParentId = strNewIds; } if (systempsModels != null && systempsModels.Count > 0 && tempModels != null && tempModels.Count > 0) { SysTempletItemsEntity systempsModelT = systempsModels.Find(t => t.Id == m.TempletId); SysTempletItemsEntity systempsModelCT = systempsModels.Find(t => t.Id == m.CTempletId); SysTempletItemsEntity systempsModelMT = systempsModels.Find(t => t.Id == m.MTempletId); SysTempletItemsEntity systempsModelMCT = systempsModels.Find(t => t.Id == m.MCTempletId); if (systempsModelT != null && !string.IsNullOrEmpty(systempsModelT.Id)) { TempletEntity tempModelT = tempModels.Find(t => t.FullName == systempsModelT.FullName); if (tempModelT != null && !string.IsNullOrEmpty(tempModelT.Id)) { m.TempletId = tempModelT.Id; } } if (systempsModelCT != null && !string.IsNullOrEmpty(systempsModelCT.Id)) { TempletEntity tempModelCT = tempModels.Find(t => t.FullName == systempsModelCT.FullName); if (tempModelCT != null && !string.IsNullOrEmpty(tempModelCT.Id)) { m.CTempletId = tempModelCT.Id; } } if (systempsModelMT != null && !string.IsNullOrEmpty(systempsModelMT.Id)) { TempletEntity tempModelMT = tempModels.Find(t => t.FullName == systempsModelMT.FullName); if (tempModelMT != null && !string.IsNullOrEmpty(tempModelMT.Id)) { m.MTempletId = tempModelMT.Id; } } if (systempsModelMCT != null && !string.IsNullOrEmpty(systempsModelMCT.Id)) { TempletEntity tempModelMCT = tempModels.Find(t => t.FullName == systempsModelMCT.FullName); if (tempModelMCT != null && !string.IsNullOrEmpty(tempModelMCT.Id)) { m.MCTempletId = tempModelMCT.Id; } } } }); model.Id = strNewIds; } cmodels = InitColumnsEntity(moduleEntity.Id, cmodels, models); if (cmodels != null && cmodels.Count > 0) { foreach (var cmodelT in cmodels) { cmodelT.Create(); db.Insert(cmodelT); } } } } }