Ejemplo n.º 1
0
        //public ActionResult Index()
        //{
        //    C_TempletApp templetApp = new C_TempletApp();
        //    C_TempletEntity model = templetApp.GetMain();
        //    string htmls = Server.HtmlDecode(model.F_Content);
        //    return Content(htmls);
        //}
        public ActionResult Index(string name)
        {
            C_TempletApp    templetApp   = new C_TempletApp();
            C_TempletEntity model        = new C_TempletEntity();
            C_ModulesApp    modulesApp   = new C_ModulesApp();
            C_ModulesEntity moduleentity = new C_ModulesEntity();

            if (string.IsNullOrEmpty(name))
            {
                model        = templetApp.GetMain();
                moduleentity = modulesApp.GetMain();
            }
            else
            {
                model        = templetApp.GetModelByActionName(name);
                moduleentity = modulesApp.GetFormByActionName(name);
            }
            string htmls = Server.HtmlDecode(model.F_Content);

            if (moduleentity != null)
            {
                TempHelp temphelp = new TempHelp();
                htmls = temphelp.GetHtmlPages(htmls, moduleentity.F_Id);
            }

            return(Content(htmls));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据栏目id获取内容集合
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        private string GetContentsById(string Ids, string mcodes, Dictionary <string, string> attrs)
        {
            string                       strs            = "";
            C_ContentApp                 contentapp      = new C_ContentApp();
            List <C_ContentEntity>       contententitys  = new List <C_ContentEntity>();
            IQueryable <C_ContentEntity> contententitysT = null;

            //数据源
            if (attrs.ContainsKey("sourcename"))
            {
                string sourceName = "";
                attrs.TryGetValue("sourcename", out sourceName);
                C_ModulesApp    modulesApp   = new C_ModulesApp();
                C_ModulesEntity moduleentity = new C_ModulesEntity();
                moduleentity = modulesApp.GetFormByActionName(sourceName);
                if (moduleentity != null && moduleentity.F_Id != Guid.Empty.ToString())
                {
                    contententitysT = contentapp.GetListIq(moduleentity.F_Id);
                }
            }
            else
            {
                contententitysT = contentapp.GetListIq(Ids);
            }
            if (contententitysT != null)
            {
                //排序
                if (attrs.ContainsKey("sort"))
                {
                    string val = "";
                    attrs.TryGetValue("sort", out val);

                    string sortName = "F_" + val;
                    contententitysT = contententitysT.OrderBy(sortName);
                }
                //排序
                if (attrs.ContainsKey("sortdesc"))
                {
                    string val = "";
                    attrs.TryGetValue("sortdesc", out val);

                    string sortName = "F_" + val;
                    contententitysT = contententitysT.OrderBy(sortName, true);
                }
                //行数
                if (attrs.ContainsKey("tatol"))
                {
                    string val = "";
                    attrs.TryGetValue("tatol", out val);
                    int tatolnum = 0;
                    if (int.TryParse(val, out tatolnum))
                    {
                        contententitys = contententitysT.Take(tatolnum).ToList();
                    }
                }
                //处理连接地址
                contententitys.ForEach(delegate(C_ContentEntity model)
                {
                    if (model != null && model.F_UrlAddress != null)
                    {
                        model.F_UrlPage = model.F_UrlAddress;
                        model.F_UrlPage = model.F_UrlPage.Replace(@"\", "/");
                    }
                });
                if (contententitys != null && contententitys.Count > 0)
                {
                    foreach (C_ContentEntity contententity in contententitys)
                    {
                        strs += GetHtmlPage(mcodes, contententity);
                    }
                }
            }
            return(strs);
        }