Пример #1
0
        public void ChapterDelete(string str_sql)
        {
            //删除文件
            var chapters = BookChapterView.GetModelList(str_sql);

            foreach (var chapter in chapters)
            {
                string htmlPath = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterUrl(chapter, BookView.GetClass(chapter)));
                string txtPath  = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterTxtUrl(chapter, BookView.GetClass(chapter)));

                Voodoo.IO.File.Delete(htmlPath);
                Voodoo.IO.File.Delete(txtPath);
            }


            BookChapterView.Del(str_sql);
        }
Пример #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string ids      = WS.RequestString("id");
            var    chapters = BookChapterView.GetModelList(string.Format("id in({0})", ids));

            foreach (var chapter in chapters)
            {
                string FilePath = Server.MapPath(GetBookChapterUrl(chapter, BookView.GetClass(chapter)));
                Voodoo.IO.File.Delete(FilePath);
            }

            BookChapterView.Del(string.Format("id in ({0})", ids));

            var book = BookView.GetModelByID(id.ToS());
            var cls  = BookView.GetClass(book);

            //更新书籍的最新章节
            var lastChapter = BookChapterView.Find(string.Format("bookid={0} order by ChapterIndex,ID desc", id));

            book.LastChapterID    = lastChapter.ID;
            book.LastChapterTitle = lastChapter.Title;
            BookView.Update(book);


            chapters = BookChapterView.GetModelList(string.Format("bookid={0}", id));

            foreach (var chapter in chapters)
            {
                CreatePage.CreateBookChapterPage(chapter, book, cls);
            }

            CreatePage.CreateContentPage(book, cls);

            CreatePage.CreateListPage(cls, 0);

            CreatePage.GreateIndexPage();

            Response.Redirect(string.Format("ChapterList.aspx?bookid={0}", id));
        }