/// <summary> /// 获取最新更新的书籍 /// </summary> /// <param name="top"></param> /// <returns></returns> public string getnoveltopupdate(string top) { int i_top = top.ToInt32(); List <Book> bs = BookView.GetModelList("Enable=1 order by UpdateTime desc", i_top); StringBuilder sb = new StringBuilder(); //foreach (Book b in bs) for (int i = 0; i < bs.Count; i++) { Book b = bs[i]; Class c = BookView.GetClass(b); string str_style = ""; if (i % 2 == 0) { str_style = " style=\"background-color: #f5f5f5\""; } sb.AppendLine(string.Format("<tr" + str_style + "><td>[<a target=\"_blank\" href=\"{0}\" class=\"sort\">{1}</a>]</td><td><a class=\"name\" target=\"_blank\" href=\"{2}\">{3}</a> <a target=\"_blank\" href=\"{4}\" class=\"chapter\">{5}</a></td><td><a target=\"_blank\" href=\"/Search.aspx?m=4&key={6}\" class=\"author\">{6}</a></td><td style=\"color: #666666\">{7}</td></tr>", BasePage.GetClassUrl(c), b.ClassName, BasePage.GetBookUrl(b, c), b.Title, BasePage.GetBookChapterUrl(BookChapterView.GetModelByID(b.LastChapterID.ToS()), c), b.LastChapterTitle, b.Author, b.UpdateTime.ToString("MM-dd HH:mm") )); } return(sb.ToS()); }
/// <summary> /// 获取最新更新的书籍 Metro风格 /// </summary> /// <param name="top"></param> /// <returns></returns> public string getnoveltopmetroupdate(string top) { int i_top = top.ToInt32(); List <Book> bs = BookView.GetModelList("Enable=1 order by UpdateTime desc", i_top); StringBuilder sb = new StringBuilder(); int i = 1; foreach (Book b in bs) { Class c = BookView.GetClass(b); sb.AppendLine(string.Format("<li style=\" background-color:{0};\"><div class=\"item\"><h1><a href=\"{1}\">" + i + ".{2}</a></h1><div><div class=\"lastchapter\"><a href=\"{5}\">{6}</a></div></div></div><div class=\"item\"><h1><a href=\"{1}\">阅读书籍</a></h1><div><div class=\"lastchapter\"><a href=\"{5}\" title=\"{6}\">阅读最新章节</a></div><div class=\"class\">分类:<a href=\"{3}\">{4}</a></div><div class=\"author\">作者:{8}</div><div class=\"time\">更新时间:{9}</div></div></div></li>", BasePage.RandomBGColor(), BasePage.GetBookUrl(b, c), b.Title, BasePage.GetClassUrl(c), b.ClassName, BasePage.GetBookChapterUrl(BookChapterView.GetModelByID(b.LastChapterID.ToS()), c), b.LastChapterTitle, b.LastChapterTitle.CutString(12), b.Author, b.UpdateTime.ToString("MM-dd HH:mm") )); i++; } return(sb.ToS()); }
/// <summary> /// 创建章节页面 /// </summary> /// <param name="cp"></param> /// <param name="b"></param> /// <param name="cls"></param> public static void CreateBookChapterPage(BookChapter cp, Book b, Class cls) { TemplateHelper h = new TemplateHelper(); string FileName = BasePage.GetBookChapterUrl(cp, cls); Voodoo.IO.File.Write(System.Web.HttpContext.Current.Server.MapPath("~" + FileName), h.CreateBookChapterPage(cp, b, cls)); ping(BasePage.SystemSetting.SiteUrl.TrimEnd('/') + FileName); CreatePagesByCrateWith(4); }