/// <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); }
public ColumnsEntity GetModuleByContentID(string keyValue) { ColumnsEntity moduleEntity = new ColumnsEntity(); ContentEntity contentEntity = GetFormNoDel(keyValue); ColumnsApp c_ModulesApp = new ColumnsApp(); if (JudgmentHelp.judgmentHelp.IsNullEntity <ContentEntity>(contentEntity) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(contentEntity.ColumnId)) { moduleEntity = c_ModulesApp.GetFormNoDel(contentEntity.ColumnId); } return(moduleEntity); }
//[ValidateAntiForgeryToken] public ActionResult SubmitForm(ColumnsEntity moduleEntity, string keyValue) { try { moduleEntity.WebSiteId = Base_WebSiteId; c_ModulesApp.SubmitForm(moduleEntity, keyValue); return(Success("操作成功。")); } catch (Exception e) { return(Error(e.Message)); } }
public void SubmitForm(ContentEntity moduleEntity, string keyValue) { string strKeyWords = string.Empty; if (!iKeyWordsRespository.IsHasKeyWords(moduleEntity.WebSiteId, moduleEntity.Content, out strKeyWords)) { using (var db = new SqlServerRepositoryBase().BeginTrans()) { if (!string.IsNullOrEmpty(keyValue)) { ContentEntity moduleEntityT = FindEntity(keyValue); if (moduleEntityT != null) { //验证用户站点权限 iUserRepository.VerifyUserWebsiteRole(moduleEntityT.WebSiteId); moduleEntity.WebSiteId = moduleEntityT.WebSiteId; } moduleEntity.Modify(keyValue); db.Update(moduleEntity); //添加日志 iLogRepository.WriteDbLog(true, "修改内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "内容管理"); } else { string mIds = moduleEntity.ColumnId; ColumnsEntity cmModel = iColumnsRepository.GetFormNoDel(mIds); if (cmModel.Type == (int)Code.Enums.ModuleType.Content || cmModel.Type == (int)Code.Enums.ModuleType.List || cmModel.Type == (int)Code.Enums.ModuleType.AdvancedList) { if (JudgmentHelp.judgmentHelp.IsNullEntity <ColumnsEntity>(cmModel) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(cmModel.Id)) { string urlAddress = @"\" + cmModel.ActionName + @"\" + moduleEntity.Id; moduleEntity.UrlAddress = urlAddress; //SubmitForm(moduleEntity, moduleEntity.Id); } } moduleEntity.Create(); db.Insert(moduleEntity); //添加日志 iLogRepository.WriteDbLog(true, "添加内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "内容管理"); } db.Commit(); } } else { throw new Exception("存在非法关键词,请检查!关键字:" + strKeyWords); } }
public void DeleteForm(string keyValue) { ColumnsEntity 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, "栏目管理"); }
/// <summary> /// 根据模块名称获取一个内容 /// </summary> /// <param name="actionCode"></param> /// <returns></returns> public ContentEntity GetContentByActionCode(string actionCode, string webSiteShortName) { ColumnsEntity moduleEntity = new ColumnsEntity(); ColumnsApp c_ModulesApp = new ColumnsApp(); ContentEntity contentEntity = new ContentEntity(); WebSiteEntity webSiteEntity = new WebSiteApp().GetFormByShortName(webSiteShortName); if (webSiteEntity != null && !string.IsNullOrWhiteSpace(webSiteEntity.Id)) { moduleEntity = c_ModulesApp.GetFormByActionName(actionCode, webSiteEntity.Id); if (JudgmentHelp.judgmentHelp.IsNullEntity <ColumnsEntity>(moduleEntity) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(moduleEntity.Id)) { contentEntity = service.IQueryable(m => m.ColumnId == moduleEntity.Id && m.EnabledMark == true && m.DeleteMark != true).FirstOrDefault(); } } return(contentEntity); }
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> /// <param name="keyValue"></param> public void GenStaticPageByCol(string columnId) { ColumnsEntity moduleEntity = iColumnsRepository.FindEntity(columnId); if (moduleEntity != null) { //验证用户站点权限 iUserRepository.VerifyUserWebsiteRole(moduleEntity.WebSiteId); } if (moduleEntity != null && moduleEntity.Type == (int)Enums.ModuleType.Content) { if (new WebSiteApp().IsOverSizeByWebSiteId(moduleEntity.WebSiteId)) { throw new Exception("该站点空间已不足,请联系管理员!"); } new TempHelp().GenHtmlPageCol(moduleEntity); new TempHelp().GenMHtmlPageCol(moduleEntity); //添加日志 LogHelp.logHelp.WriteDbLog(true, "内容信息=>生成栏目静态页" + moduleEntity.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); }
/// <summary> /// 获取请求路径栏目Id /// </summary> /// <returns></returns> private string GetColumnIds(System.Web.HttpContext context) { string cIds = string.Empty; string urlHost = GetHost(context); string urlRaw = context.Request.RawUrl.ToString(); urlRaw = context.Server.UrlDecode(urlRaw); //处理Url参数 urlRaw = Common.HandleUrlRaw(urlRaw); List <string> urlRaws = WebHelper.GetUrls(urlRaw); WebSiteApp app = new WebSiteApp(); ColumnsApp c_ColumnsApp = new ColumnsApp(); WebSiteEntity entity = app.GetModelByUrlHost(urlHost); if (urlRaws == null || urlRaws.Count == 0) { ColumnsEntity columnsEntity = c_ColumnsApp.GetMain(entity.Id); if (columnsEntity != null) { cIds = columnsEntity.Id; } } else { if (urlRaws.Count > 0) { ColumnsEntity columnsEntity = c_ColumnsApp.GetFormByActionName(urlRaws.FirstOrDefault(), entity.Id); if (columnsEntity != null) { cIds = columnsEntity.Id; } } } return(cIds); }
protected internal void writeColumnSet(HtmlTextWriter writer, bool isAjaxData) { writer.Write("<ntb:columns "); Cmn.writeAttr(writer, "id", Name); ColumnsEntity ce = new ColumnsEntity(); ce.setColumnsCollection(Columns); Cmn.writeAttr(writer, "headerenabled", ShowHeader.ToString().ToLower(), "true"); if (isAjaxData && GetDataUrl != null) Cmn.writeAttr(writer, "gethandler", string.Format(GetDataUrl.Contains("?") ? "{0}&did={2}&NitCols={1}" : "{0}?did={2}&NitCols={1}", GetDataUrl, Uri.EscapeDataString(Cmn.ToBase64(ce.Xml)), Name)); Cmn.writeAttr(writer, "gethandler", GetDataUrl); if (isAjaxData && SaveDataUrl != null) Cmn.writeAttr(writer, "savehandler", string.Format(SaveDataUrl.Contains("?") ? "{0}&did={2}&NitCols={1}" : "{0}?did={2}&NitCols={1}", SaveDataUrl, Uri.EscapeDataString(Cmn.ToBase64(ce.Xml)), Name)); Cmn.writeAttr(writer, "savehandler", SaveDataUrl); writer.WriteLine(">"); int index = 0; foreach(Column c in Columns) c.getClientColDefHtml(writer, "grid", index++, isAjaxData, null); writer.Write("</"); writer.Write("ntb:columns"); writer.WriteLine(">"); }
protected override void writeColumnInnerContents(HtmlTextWriter writer, string ctlType, bool isLiveData) { base.writeColumnInnerContents(writer, ctlType, isLiveData); if (ctlType.CompareTo("grid") != 0) return; ColumnsEntity ce = new ColumnsEntity(); ce.setColumnsCollection(Columns); writer.Write("<ntb:{0} ", EditorName); Cmn.writeAttr(writer, "datasourceid", DataSourceId); Cmn.writeAttr(writer, "datasource", LocalData); if (isLiveData && GetDataUrl != null) Cmn.writeAttr(writer, "gethandler", string.Format(GetDataUrl.Contains("?") ? "{0}&NitCols={1}" : "{0}?NitCols={1}", GetDataUrl, Uri.EscapeDataString(Cmn.ToBase64(ce.Xml)))); Cmn.writeAttr(writer, "valuefield", ValueField); string df = ""; foreach (Column c in Columns) if (c.Visible) df += c.Name + "|"; if (df.Length > 0) df = df.Substring(0, df.Length - 1); Cmn.writeAttr(writer, "displayfields", df); writerEditorAttributes(writer, ctlType); writer.Write("></ntb:{0}>", EditorName); }
public RequestDataRow(ColumnsEntity columns) { m_columns = columns; }
public XmlDataRow(XmlElement data, ColumnsEntity columns) { RawData = data; m_columns = columns; }
public void SubmitForm(ContentEntity moduleEntity, string keyValue, List <UpFileDTO> upFileentitys) { string strKeyWords = string.Empty; if (!iKeyWordsRespository.IsHasKeyWords(moduleEntity.WebSiteId, moduleEntity.Content, out strKeyWords)) { using (var db = new SqlServerRepositoryBase().BeginTrans()) { if (!string.IsNullOrEmpty(keyValue)) { ContentEntity moduleEntityT = FindEntity(keyValue); if (moduleEntityT != null) { //验证用户站点权限 iUserRepository.VerifyUserWebsiteRole(moduleEntityT.WebSiteId); moduleEntity.WebSiteId = moduleEntityT.WebSiteId; } moduleEntity.Modify(keyValue); db.Update(moduleEntity); //添加日志 iLogRepository.WriteDbLog(true, "修改内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Update, "内容管理"); } else { string mIds = moduleEntity.ColumnId; ColumnsEntity cmModel = iColumnsRepository.GetFormNoDel(mIds); if (cmModel.Type == (int)Code.Enums.ModuleType.Content || cmModel.Type == (int)Code.Enums.ModuleType.List || cmModel.Type == (int)Code.Enums.ModuleType.AdvancedList) { if (JudgmentHelp.judgmentHelp.IsNullEntity <ColumnsEntity>(cmModel) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(cmModel.Id)) { string urlAddress = @"\" + cmModel.ActionName + @"\" + moduleEntity.Id; moduleEntity.UrlAddress = urlAddress; //SubmitForm(moduleEntity, moduleEntity.Id); } } moduleEntity.Create(); db.Insert(moduleEntity); //添加日志 iLogRepository.WriteDbLog(true, "添加内容信息=>" + moduleEntity.FullName, Enums.DbLogType.Create, "内容管理"); } if (upFileentitys != null && upFileentitys.Count > 0) { upFileentitys = upFileentitys.FindAll(m => m != null); foreach (UpFileDTO upFileentity in upFileentitys) { if (upFileentity != null) { //更新上传文件表 upFileentity.Sys_WebSiteId = moduleEntity.WebSiteId; upFileentity.Sys_ParentId = keyValue; upFileentity.Sys_ModuleName = EnumHelp.enumHelp.GetDescription(Enums.UpFileModule.Contents); UpFileEntity upFileEntity = iUpFileRepository.InitUpFileEntity(upFileentity); upFileEntity.Create(); db.Insert(upFileEntity); } } } db.Commit(); } } else { throw new Exception("存在非法关键词,请检查!关键字:" + strKeyWords); } }
public void SubmitForm(ColumnsEntity moduleEntity, string keyValue) { service.SubmitForm(moduleEntity, keyValue); }
public AjaxSaveDataHandlerEventArgs(string xml, ColumnsEntity columns) { XmlDocument xmldoc = new XmlDocument(); NsMgr = new XmlNamespaceManager(xmldoc.NameTable); NsMgr.AddNamespace("ntb", "http://www.nitobi.com"); xmldoc.LoadXml(xml); UpdatedData = xmldoc.SelectSingleNode("//ntb:data", NsMgr) as XmlElement; m_count = UpdatedData.SelectNodes("//ntb:e", NsMgr).Count; m_columns = columns; }