/// <summary> /// 显示模版 /// </summary> /// <param name="Theme"></param> /// <param name="xf"></param> /// <param name="Puts"></param> /// <returns></returns> public String ViewTemplate(EffectDBEntity Theme, String ThemeFile, Hashtable Puts, TemplateFormat xf) { VelocityHelper vltContext = new VelocityHelper(this, Theme); vltContext.Put("xf", xf); //模版格式化共用方法 vltContext.Put("ModuleID", ModuleId); //绑定的主模块编号 vltContext.Put("TabID", TabId); //绑定的主模块页面编号 if (Puts != null && Puts.Count > 0) { foreach (String key in Puts.Keys) { vltContext.Put(key, Puts[key]); } } return(vltContext.Display(ThemeFile)); }
/// <summary> /// 绑定数据项到前台 /// </summary> public void BindDataItem(EffectDBEntity EffectDB) { List <DNNGo_LayerGallery_Content> DataList = new List <DNNGo_LayerGallery_Content>(); Hashtable Puts = new Hashtable(); TemplateFormat xf = new TemplateFormat(this); xf.PhContent = PhContent; //读取需要载入的参数 QueryParam qp = new QueryParam(); int RecordCount = 0; qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.ModuleId, Settings_ModuleID, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.Status, (Int32)EnumStatus.Published, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual)); qp.Where.Add(new SearchParam(DNNGo_LayerGallery_Content._.EndTime, xUserTime.UtcTime(), SearchType.GtEqual)); qp.OrderType = 0; if (EffectDB.Pager)//传入分页的数量 { qp.PageSize = (Int32)xf.ViewXmlSetting("PageSize", 9999); qp.PageSize = qp.PageSize <= 0 ? 9999 : qp.PageSize; qp.PageIndex = PageIndex; } if (Settings_Sortby == (Int32)EnumSortby.Name) { qp.Orderfld = DNNGo_LayerGallery_Content._.Title; DataList = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount); } else if (Settings_Sortby == (Int32)EnumSortby.Name_Desc) { qp.OrderType = 1; qp.Orderfld = DNNGo_LayerGallery_Content._.Title; DataList = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount); } else if (Settings_Sortby == (Int32)EnumSortby.Time) { qp.Orderfld = DNNGo_LayerGallery_Content._.StartTime; DataList = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount); } else if (Settings_Sortby == (Int32)EnumSortby.Time_Desc) { qp.OrderType = 1; qp.Orderfld = DNNGo_LayerGallery_Content._.StartTime; DataList = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount); } else if (Settings_Sortby == (Int32)EnumSortby.Random) { qp.Orderfld = " newid() "; DataList = DNNGo_LayerGallery_Content.FindRandomAll(qp, out RecordCount); } else { qp.Orderfld = DNNGo_LayerGallery_Content._.Sort; DataList = DNNGo_LayerGallery_Content.FindAll(qp, out RecordCount); } List <DNNGo_LayerGallery_Content> tList = new List <DNNGo_LayerGallery_Content>(); //查看需要过滤掉非激活的选项 foreach (var content in DataList) { String Activate = Convert.ToString(xf.GetValue(xf.ViewDicts(content), "activate", "on")); if (String.IsNullOrEmpty(Activate) || Activate.ToLower() == "on") { tList.Add(content); } } Puts.Add("DataList", tList); Puts.Add("EffectName", Settings_EffectName); Puts.Add("ThemeName", Settings_EffectThemeName); //加载LayerList Puts.Add("LayerList", GetLayerList()); if (EffectDB.Pager && RecordCount > qp.PageSize) { Puts.Add("Pager", new Pager(qp.PageIndex, qp.PageSize, ModuleId, RecordCount, EnumPageType.DnnURL).CreateHtml());//分页 } else { Puts.Add("Pager", ""); } String HtmlContent = ViewTemplate(EffectDB, "Effect.html", Puts, xf); //#if RELEASE //Release状态下需要格式化HTML代码 HtmlContent = CodeDeal.DealCode(HtmlContent); //格式化HTML //#endif liContent.Text = HtmlContent; }
/// <summary> /// 显示模版 /// </summary> /// <param name="Theme"></param> /// <param name="ThemeFile"></param> /// <param name="Puts"></param> /// <returns></returns> public String ViewTemplate(EffectDBEntity Theme, String ThemeFile, Hashtable Puts) { TemplateFormat xf = new TemplateFormat(this); return(ViewTemplate(Theme, ThemeFile, Puts, xf)); }