/// <summary> /// 根据model获取内容 /// </summary> /// <param name="Ids"></param> /// <returns></returns> private string GetModelById(string name, C_ContentEntity model) { string strs = ""; if (model != null) { PropertyInfo[] propertys = model.GetType().GetProperties(); if (propertys != null && propertys.Length > 0) { foreach (PropertyInfo property in propertys) { if (property.Name == name || property.Name.Replace("F_", "") == name) { object obj = property.GetValue(model, null); if (obj != null) { strs = obj.ToString(); if (IsHtmlEnCode(strs)) { strs = System.Web.HttpUtility.HtmlDecode(strs); } } } } } } return(strs); }
/// <summary> /// 获取模板元素集合 /// </summary> /// <param name="codes"></param> /// <returns></returns> public string GetHtmlPage(string codes, C_ContentEntity model) { string strs = ""; try { string templets = System.Web.HttpUtility.HtmlDecode(codes); int i = templets.IndexOf(STARTMC); int j = templets.IndexOf(ENDMC) + ENDMC.Length; while (i > 0 && j > 0) { string templetst = templets.Substring(i, j - i); string strt = templetst.Replace(STARTMC, "").Replace(ENDMC, ""); string[] strts = strt.Split('.'); if (strts.Length >= 2 && strts[1] != null) { string htmlt = GetModelById(strts[1], model); templets = templets.Replace(templetst, htmlt); } i = templets.IndexOf(STARTMC); j = templets.IndexOf(ENDMC) + ENDMC.Length; } strs = templets; } catch (Exception ex) { strs = ""; } return(strs); }
/// <summary> /// 根据id更新内容链接 /// </summary> /// <param name="Ids"></param> private void UpdateContentById(string url, string Ids) { C_ContentApp contentapp = new C_ContentApp(); C_ContentEntity contentEntity = contentapp.GetForm(Ids); if (contentEntity != null) { contentEntity.F_UrlAddress = url; contentapp.SubmitForm(contentEntity, Ids); } }
public C_ModulesEntity GetModuleByContentID(string keyValue) { C_ModulesEntity moduleEntity = new C_ModulesEntity(); C_ModulesApp moduleapp = new C_ModulesApp(); C_ContentEntity contentEntity = GetForm(keyValue); if (JudgmentHelp.judgmentHelp.IsNullEntity <C_ContentEntity>(contentEntity) && JudgmentHelp.judgmentHelp.IsNullOrEmptyOrGuidEmpty(contentEntity.F_ModuleId)) { moduleEntity = moduleapp.GetForm(contentEntity.F_ModuleId); } return(moduleEntity); }
public ActionResult SubmitForm(C_ContentEntity c_ContentEntity, string keyValue) { try { c_contentApp.SubmitForm(c_ContentEntity, keyValue); return(Success("操作成功。")); } catch (Exception ex) { return(Error("操作失败。" + ex.Message)); } }
public void SubmitForm(C_ContentEntity moduleEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { moduleEntity.Modify(keyValue); service.Update(moduleEntity); } else { moduleEntity.Create(); service.Insert(moduleEntity); } }
public void GetStaticPage(string keyValue) { C_ModulesEntity module = GetModuleByContentID(keyValue); C_ContentEntity content = GetForm(keyValue); if (module != null) { C_TempletApp templetapp = new C_TempletApp(); C_TempletEntity templet = templetapp.GetForm(module.F_CTempletId); if (templet != null) { string templets = System.Web.HttpUtility.HtmlDecode(templet.F_Content); TempHelp temphelp = new TempHelp(); temphelp.GenHtmlPage(templets, keyValue); } } }
/// <summary> /// 初始化 /// </summary> /// <param name="Id"></param> private void InitHtmlSavePath(string Id) { if (!string.IsNullOrEmpty(Id)) { if (CONTENTENTITY == null || CONTENTENTITY.F_Id != Id) { C_ContentApp contentapp = new C_ContentApp(); CONTENTENTITY = contentapp.GetForm(Id); C_ModulesEntity moduleentity = contentapp.GetModuleByContentID(Id); if (JudgmentHelp.judgmentHelp.IsNullEntity <C_ModulesEntity>(moduleentity)) { HTMLSAVEPATH += moduleentity.F_ActionName + @"\"; } } } }