/// <summary> /// 获取下一个提问 /// </summary> /// <param name="img"></param> /// <param name="cls"></param> /// <returns></returns> public static Question GetNextQuestion(Question qs, Class cls) { List <Question> lresult = QuestionView.GetModelList(string.Format("classID={0} and ID>{1} order by ID Asc", cls.ID, qs.ID), 1); if (lresult.Count == 0) { return(null); } else { return(lresult.First()); } }
protected void btn_createPage_Click(object sender, EventArgs e) { string ids = WS.RequestString("id"); var qus = QuestionView.GetModelList(string.Format("id in ({0})", ids)); foreach (var qu in qus) { CreatePage.CreateContentPage(qu, qu.GetClass()); } Class cls = ClassView.GetModelByID(WS.RequestString("class")); if (cls.ID > 0) { CreatePage.CreateListPage(cls, 1); } Js.AlertAndChangUrl("生成成功!", url); }
protected void btn_Content_Click(object sender, EventArgs e) { Response.Buffer = false; Js.ScrollEnd(); var newses = NewsView.GetModelList(); newses = newses.Where(p => p.Audit).ToList(); foreach (var n in newses) { Response.Write(string.Format("正在生成内容页:{0}<br/>", n.Title)); try { CreatePage.CreateContentPage(n, NewsView.GetNewsClass(n)); } catch (Exception ex) { Response.Write(string.Format("{0}<br/>", ex.Message)); } } var imgs = ImageAlbumView.GetModelList(); foreach (var img in imgs) { try { Response.Write(string.Format("正在生成内容页:{0}<br/>", img.Title)); CreatePage.CreateContentPage(img, img.GetClass()); } catch (Exception ex) { Response.Write(string.Format("{0}<br/>", ex.Message)); } } var ques = QuestionView.GetModelList(); foreach (var q in ques) { try { Response.Write(string.Format("正在生成内容页:{0}<br/>", q.Title)); CreatePage.CreateContentPage(q, q.GetClass()); } catch (Exception ex) { Response.Write(string.Format("{0}<br/>", ex.Message)); } } var books = BookView.GetModelList(); foreach (var b in books) { try { Response.Write(string.Format("正在生成内容页:{0}<br/>", b.Title)); CreatePage.CreateContentPage(b, BookView.GetClass(b)); Js.ScrollEndStart(); } catch (Exception ex) { Response.Write(string.Format("{0}<br/>", ex.Message)); } } //try //{ // var movies = MovieInfoView.GetModelList(); // foreach (var m in movies) // { // try // { // Response.Write(string.Format("正在生成内容页:{0}<br/>", m.Title)); // CreatePage.CreateContentPage(m, MovieInfoView.GetClass(m)); // Js.ScrollEnd(); // } // catch (Exception ex) // { // Response.Write(string.Format("{0}<br/>", ex.Message)); // } // } //} //catch { } Js.AlertAndGoback("成功!"); }
/// <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("未知模型"); } }