Exemplo n.º 1
0
        /// <summary>
        /// 生成内容页--图片
        /// </summary>
        /// <param name="album"></param>
        /// <param name="cls"></param>
        public static void CreateContentPage(Question qs, Class cls)
        {
            TemplateHelper h        = new TemplateHelper();
            string         FileName = BasePage.GetQuestionUrl(qs, cls);

            Voodoo.IO.File.Write(System.Web.HttpContext.Current.Server.MapPath("~" + FileName), h.CreateContentPage(qs, cls));
            ping(BasePage.SystemSetting.SiteUrl.TrimEnd('/') + FileName);
            CreatePagesByCrateWith(3);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新闻列表
        /// </summary>
        /// <param name="ClassID">栏目ID</param>
        /// <param name="TitlePreChar">标题前字符</param>
        /// <param name="count">索取条数</param>
        /// <param name="TitleLength">标题保留长度</param>
        /// <param name="ExtSql">额外的Sql条件</param>
        /// <param name="Order">排序语句</param>
        /// <returns></returns>
        public string cmsnewslist(string ClassID, string TitlePreChar, string count, string TitleLength, string showTime, string ExtSql, string Order)
        {
            Class cls = NewsAction.NewsClass.Where(p => p.ID.ToString() == ClassID).First();

            if (cls.ModelID == 1)
            {
                string str_sql = string.Format("classID in ({0})", GetAllSubClass(ClassID.ToInt32()));
                if (ExtSql.Length > 1)
                {
                    str_sql += " and " + ExtSql;
                }
                str_sql += Order;


                List <News>   nlist = NewsView.GetModelList(str_sql, count.ToInt32());
                StringBuilder sb    = new StringBuilder();
                foreach (News n in nlist)
                {
                    string title = n.Title;
                    if (TitleLength.ToInt32() > 0)
                    {
                        title = title.CutString(TitleLength.ToInt32());
                    }
                    string timespan = "";
                    if (showTime.ToInt32() > 0)
                    {
                        timespan = string.Format("<span class=\"news_time_span\">{0}</span>", n.NewsTime.ToString("yyyy/MM/dd"));
                    }

                    sb.AppendLine(string.Format("<li>{0}{1}<a href='{2}' title='{3}'>{4}</a></li>", TitlePreChar, timespan, BasePage.GetNewsUrl(n, NewsView.GetNewsClass(n)), n.Title, title));
                }
                return(sb.ToS());
            }//Model=1 新闻
            else if (cls.ModelID == 2)
            {
                return("图");
            }
            else if (cls.ModelID == 3)//问答
            {
                string str_sql = string.Format("classID in ({0})", GetAllSubClass(ClassID.ToInt32()));
                if (ExtSql.Length > 1)
                {
                    str_sql += " and " + ExtSql;
                }
                str_sql += Order;
                List <Question> qlist = QuestionView.GetModelList(str_sql, count.ToInt32());
                StringBuilder   sb    = new StringBuilder();
                foreach (Question q in qlist)
                {
                    string title = q.Title;
                    if (TitleLength.ToInt32() > 0)
                    {
                        title = title.CutString(TitleLength.ToInt32());
                    }
                    string timespan = "";
                    if (showTime.ToInt32() > 0)
                    {
                        timespan = string.Format("<span class=\"news_time_span\">{0}</span>", q.AskTime.ToString("yyyy/MM/dd"));
                    }

                    sb.AppendLine(string.Format("<li>{0}{1}<a href='{2}' title='{3}'>{4}</a></li>", TitlePreChar, timespan, BasePage.GetQuestionUrl(q, q.GetClass()), q.Title, title));
                }
                return(sb.ToS());
            }
            else
            {
                return("未知模型");
            }
        }