예제 #1
0
        protected void BindList()
        {
            var cpl = BookChapterView.GetModelList(string.Format("BookId={0}", id));

            rp_List.DataSource = cpl;
            rp_List.DataBind();
        }
예제 #2
0
        /// <summary>
        /// 搜索章节
        /// </summary>
        /// <param name="BookTitle">书籍标题</param>
        /// <param name="ChapterTitle">章节标题</param>
        /// <param name="IsImagechapter">是否图片章节</param>
        protected void ChapterSearch(string BookTitle, string ChapterTitle, bool IsImagechapter)
        {
            var cs = BookChapterView.GetModelList(string.Format("BookTitle like N'%{0}%' and Title like N'%{1}%' and IsImageChapter={2}", BookTitle, ChapterTitle, IsImagechapter.BoolToShort()));

            Response.Clear();
            Response.Write(XML.Serialize(cs));
        }
예제 #3
0
        protected void GetReadHistory()
        {
            string chapters = "";

            if (Voodoo.Cookies.Cookies.GetCookie("history") != null)
            {
                chapters = Voodoo.Cookies.Cookies.GetCookie("history").Value;
            }
            string[] cs = chapters.Split(',');

            List <Cook> cookie = new List <Cook>();

            string ids = "";

            foreach (string chapter in cs)
            {
                string[] Arr_chapter = chapter.Split('|');
                cookie.Add(new Cook()
                {
                    id = Arr_chapter[0].ToInt64(), time = Arr_chapter[1].ToDateTime()
                });
                ids += Arr_chapter[0] + ",";
            }

            ids = ids.TrimEnd(',');

            ReadingChapters = BookChapterView.GetModelList(string.Format("id in({0})", ids));
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var chapters = BookChapterView.GetModelList("enable=1 order by UpdateTime desc", 500);
            var items    = new List <Voodoo.other.SEO.RssItem>();

            foreach (var chapter in chapters)
            {
                items.Add(new Voodoo.other.SEO.RssItem()
                {
                    Title       = chapter.BookTitle + "-" + chapter.Title,
                    PutTime     = chapter.UpdateTime,
                    Link        = SystemSetting.SiteUrl + GetBookChapterUrl(chapter, BookView.GetClass(chapter)),
                    Description = chapter.BookTitle + "Update to chapter:" + chapter.Title + ", from chanel" + chapter.ClassName
                });
            }

            var movies = MovieInfoView.GetModelList();

            foreach (var m in movies)
            {
                items.Add(new Voodoo.other.SEO.RssItem()
                {
                    Title       = m.Title,
                    PutTime     = m.UpdateTime,
                    Link        = SystemSetting.SiteUrl + GetMovieUrl(m, MovieInfoView.GetClass(m)),// GetBookChapterUrl(chapter, BookView.GetClass(chapter)),
                    Description = m.Title + "Update to :" + m.LastDramaTitle + ", from chanel" + m.ClassName + ", Intro:" + m.Intro
                });
            }

            Response.Clear();
            Voodoo.other.SEO.Rss.GetRss(items, SystemSetting.SiteName, SystemSetting.SiteUrl, SystemSetting.Description, SystemSetting.Copyright);
        }
예제 #5
0
        protected void CreateChapters(int bookid)
        {
            var chapters = BookChapterView.GetModelList(string.Format("bookid={0}", bookid));

            foreach (var c in chapters)
            {
                Voodoo.Basement.CreatePage.CreateBookChapterPage(c, BookView.GetBook(c), BookView.GetClass(c));
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string chapters = "";
                if (Voodoo.Cookies.Cookies.GetCookie("history") != null)
                {
                    chapters = Voodoo.Cookies.Cookies.GetCookie("history").Value;
                }
                string[] cs = chapters.Split(',');

                List <Cook> cookie = new List <Cook>();

                string ids = "";
                foreach (string chapter in cs)
                {
                    string[] Arr_chapter = chapter.Split('|');
                    cookie.Add(new Cook()
                    {
                        id = Arr_chapter[0].ToInt64(), time = Arr_chapter[1].ToDateTime()
                    });
                    ids += Arr_chapter[0] + ",";
                }

                ids = ids.TrimEnd(',');

                List <BookChapter> list_chapter = BookChapterView.GetModelList(string.Format("id in({0})", ids));

                StringBuilder sb = new StringBuilder();
                sb.Append("document.write('");
                foreach (BookChapter bc in list_chapter)
                {
                    Book  b = BookView.GetModelByID(bc.BookID.ToString());
                    Class c = ClassView.GetModelByID(bc.ClassID.ToString());

                    BookChapter new_Chapter = BookChapterView.GetModelByID(b.LastChapterID.ToString());

                    sb.Append(string.Format("<a href=\"{0}\">{1}</a>(<a href=\"{2}\">{3}</a>) 最新:<a href=\"{4}\">{5}</a><br />",
                                            BasePage.GetBookUrl(b, c),
                                            bc.BookTitle,
                                            BasePage.GetBookChapterUrl(bc, c),
                                            bc.Title,
                                            BasePage.GetBookChapterUrl(new_Chapter, c),
                                            b.LastChapterTitle
                                            ));
                }
                sb.Append("');");

                Response.Clear();
                Response.Write(sb.ToS());
            }// end try
            catch
            {
                Voodoo.Cookies.Cookies.Remove("history");
            }
        }
예제 #7
0
        /// <summary>
        /// 获取下一章节
        /// </summary>
        /// <param name="cp"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static BookChapter GetNextChapter(BookChapter cp, Book b)
        {
            List <BookChapter> lresult = BookChapterView.GetModelList(string.Format("BookID={0} and ID>{1} order by ID Asc", b.ID, cp.ID), 1);

            if (lresult.Count == 0)
            {
                return(null);
            }
            else
            {
                return(lresult.First());
            }
        }
예제 #8
0
        /// <summary>
        /// 生成站点地图
        /// </summary>
        protected void CreateSitemap()
        {
            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List <PageInfo>();

            sm.url.Add(new PageInfo()
            {
                changefreq = "always", lastmod = DateTime.Now, loc = Voodoo.Basement.BasePage.SystemSetting.SiteUrl, priority = "1.0"
            });
            List <Voodoo.Model.Book> bs = BookView.GetModelList("id>0 order by UpdateTime desc", 100);

            foreach (Voodoo.Model.Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod    = b.UpdateTime,
                    loc        = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookUrl(b, BookView.GetClass(b))).Replace("//Book/", "/Book/"),
                    priority   = "0.8"
                });
            }

            List <BookChapter> bcs = BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);

            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod    = bc.UpdateTime,
                    loc        = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, BookView.GetClass(bc))).Replace("//Book/", "/Book/"),
                    priority   = "0.7"
                });
            }
            try
            {
                sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
                Response.Clear();
                Response.Write(XML.Serialize(true));
            }
            catch
            {
                Response.Clear();
                Response.Write(XML.Serialize(false));
            }
        }
예제 #9
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);
        }
예제 #10
0
        protected void GetBook(int id)
        {
            if (id > 0)
            {
                b = BookView.GetModelByID(id.ToS());
            }
            else
            {
                b = BookView.Find("id>0 order by id desc");
            }

            b.ClickCount++;
            BookView.Update(b);

            cls = BookView.GetClass(b);
            cs  = BookChapterView.GetModelList(string.Format("bookid={0} order by ChapterIndex,id desc", b.ID));
        }
예제 #11
0
        protected void btn_createPage_Click(object sender, EventArgs e)
        {
            string[] ids = WS.RequestString("id").Split(',');
            foreach (string id in ids)
            {
                Voodoo.Model.Book b = BookView.GetModelByID(id);
                Voodoo.Basement.CreatePage.CreateContentPage(b, BookView.GetClass(b));

                var chapters = BookChapterView.GetModelList(string.Format("bookid={0}", b.ID));
                foreach (var c in chapters)
                {
                    Voodoo.Basement.CreatePage.CreateBookChapterPage(c, BookView.GetBook(c), BookView.GetClass(c));
                }
            }


            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
예제 #12
0
        protected void CreateTxt(int Bookid)
        {
            Book  b   = BookView.GetModelByID(Bookid.ToS());
            Class cls = BookView.GetClass(b);
            var   cs  = BookChapterView.GetModelList(string.Format("bookid={0} order by ChapterIndex,id", b.ID));

            StringBuilder sb = new StringBuilder();

            foreach (var c in cs)
            {
                sb.AppendLine(c.Title);
                sb.AppendLine(Voodoo.IO.File.Read(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Voodoo.IO.File.EnCode.UTF8).TrimHTML());
            }

            HttpContext.Current.Response.ContentType = "application/text";
            HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.txt", b.Title));
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.BinaryWrite(sb.ToS().ToByteArray(Encoding.UTF8));
            HttpContext.Current.Response.End();
        }
예제 #13
0
        protected void btn_Chapter_Click(object sender, EventArgs e)
        {
            Response.Buffer = false;
            var chapters = BookChapterView.GetModelList();

            foreach (var c in chapters)
            {
                try
                {
                    Response.Write(string.Format("正在生成章节:{0}<br/>", c.Title));
                    CreatePage.CreateBookChapterPage(c, BookView.GetBook(c), BookView.GetClass(c));
                    Js.ScrollEndStart();
                }
                catch (Exception ex)
                {
                    Response.Write(string.Format("{0}<br/>", ex.Message));
                }
            }

            Js.AlertAndGoback("成功!");
        }
예제 #14
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //Class cls = ClassView.GetModelList().First();
            //Voodoo.Html.Class.ClassPage cp = new Voodoo.Html.Class.ClassPage();
            //string path = cp.GetHtml(cls);
            //Response.Write(path);

            Class cls = ClassView.GetModelList().Where(p => p.ModelID == 4).First();

            CreatePage.CreateListPage(cls, 1);

            Book b = BookView.GetModelList().First();

            CreatePage.CreateContentPage(b, cls);

            var cps = BookChapterView.GetModelList();

            foreach (var cp in cps)
            {
                CreatePage.CreateBookChapterPage(cp, b, cls);
            }
        }
예제 #15
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));
        }
예제 #16
0
        protected void btn_GenSitreMap_Click(object sender, EventArgs e)
        {
            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List <PageInfo>();

            sm.url.Add(new PageInfo()
            {
                changefreq = "always", lastmod = DateTime.Now, loc = SystemSetting.SiteUrl, priority = "1.0"
            });
            List <Voodoo.Model.Book> bs = BookView.GetModelList("id>0 order by UpdateTime desc", 100);

            foreach (Voodoo.Model.Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod    = b.UpdateTime,
                    loc        = (SystemSetting.SiteUrl + BasePage.GetBookUrl(b, BookView.GetClass(b))).Replace("//Book/", "/Book/"),
                    priority   = "0.8"
                });
            }

            List <BookChapter> bcs = BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);

            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod    = bc.UpdateTime,
                    loc        = (SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, BookView.GetClass(bc))).Replace("//Book/", "/Book/"),
                    priority   = "0.7"
                });
            }


            sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
        }
예제 #17
0
 public List <BookChapter> ChapterSearch(string str_sql)
 {
     return(BookChapterView.GetModelList(str_sql));
 }