/// <summary> /// 获取章节内容 /// </summary> /// <param name="chapterID">章节id</param> protected void GetChapterContent(long chapterID) { using (DataEntities ent = new DataEntities()) { BookChapter chapter = (from l in ent.BookChapter where l.ID == chapterID select l).FirstOrDefault(); string path = BasePage.GetBookChapterTxtUrl(chapter, chapter.GetClass()); string content = Voodoo.IO.File.Read(Server.MapPath(path)); Response.Clear(); Response.Write(XML.Serialize(content)); } }
public void ChapterUpdate(BookChapter chapter, string Content) { using (DataEntities ent = new DataEntities()) { var cpt = (from l in ent.BookChapter where l.ID == chapter.ID select l).FirstOrDefault(); cpt = chapter; ent.SaveChanges(); } ///保存文件 Class cls = chapter.GetClass(); string txtPath = AppDomain.CurrentDomain.BaseDirectory + BasePage.GetBookChapterTxtUrl(chapter, cls).Replace("/", "\\"); Voodoo.IO.File.Write(txtPath, Content); //生成页面 Voodoo.Basement.CreatePage.CreateBookChapterPage(chapter, chapter.GetBook(), cls); }
public void ChapterInsert(BookChapter chapter, string Content) { DataEntities ent = new DataEntities(); ent.AddToBookChapter(chapter); ent.SaveChanges(); ent.Dispose(); ///保存文件 Class cls = chapter.GetClass();; string txtPath = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterTxtUrl(chapter, cls)); Voodoo.IO.File.Write(txtPath, Content); //生成页面 Voodoo.Basement.CreatePage.CreateBookChapterPage(chapter, chapter.GetBook(), cls); }
/// <summary> /// 生成章节 /// </summary> /// <param name="id"></param> protected void CreateChapter(long id) { DataEntities ent = new DataEntities(); BookChapter cp = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault(); if (cp.ID > 0) { Class c = cp.GetClass(); Book b = cp.GetBook(); Voodoo.Basement.CreatePage.CreateBookChapterPage(cp, b, c); Response.Write(string.Format("书籍《{0}》-章节《{1}》完成", cp.BookTitle, cp.Title)); } else { Response.Write("不存在"); } ent.Dispose(); }
public string GetChapterText(BookChapter chapter) { return(Voodoo.IO.File.Read(System.Web.HttpContext.Current.Server.MapPath(BasePage.GetBookChapterTxtUrl(chapter, chapter.GetClass())))); }