コード例 #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent   = new DataEntities();
            var          books = (from l in ent.Book where l.ID == id select l).ToList();

            Voodoo.Basement.Book book = new Voodoo.Basement.Book();
            if (books.Count > 0)
            {
                book = books.FirstOrDefault();
            }
            book.Title       = txt_Title.Text;
            book.Author      = txt_Author.Text;
            book.ClassID     = ddl_CLass.SelectedValue.ToInt32();
            book.ClassName   = ddl_CLass.SelectedItem.Text;
            book.ClickCount  = txt_ClickCount.Text.ToInt32();
            book.CorpusID    = 0;
            book.CorpusTitle = "";
            book.Enable      = chk_Enable.Checked;
            //book.FaceImage=
            book.Intro       = txt_Intro.Text;
            book.IsFirstPost = chk_IsFirstpost.Checked;
            book.IsVip       = chk_IsVip.Checked;
            book.Length      = txt_Length.Text.ToInt32();
            book.ReplyCount  = txt_Replycount.Text.ToInt32();
            book.SaveCount   = txt_SaveCount.Text.ToInt32();
            book.Status      = ddl_Status.SelectedValue.ToByte();
            book.TjCount     = txt_TjCount.Text.ToInt32();
            book.ZtID        = 0;
            book.ZtName      = "";

            if (books.Count == 0)
            {
                book.Addtime       = DateTime.UtcNow.AddHours(8);
                book.UpdateTime    = DateTime.UtcNow.AddHours(8);
                book.VipUpdateTime = DateTime.UtcNow.AddHours(8);
                ent.AddToBook(book);
                ent.SaveChanges();
            }



            //Deal Book face image
            if (file_Bookfacefile.FileName.IsNullOrEmpty() == false)
            {
                file_Bookfacefile.SaveAs(Server.MapPath("/Book/BookFace/" + book.ID + ".jpg"));
                book.FaceImage = "/Book/BookFace/" + book.ID + ".jpg";
                ent.SaveChanges();
            }


            CreatePage.CreateContentPage(book, book.GetClass());
            Response.Redirect("BookList.aspx?class=" + cls.ToS());
        }
コード例 #2
0
ファイル: BookEdit.aspx.cs プロジェクト: kuibono/KCMS2
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            var books = (from l in ent.Book where l.ID == id select l).ToList();

            Voodoo.Basement.Book book = new Voodoo.Basement.Book();
            if (books.Count > 0)
            {
                book = books.FirstOrDefault();
            }
            book.Title = txt_Title.Text;
            book.Author = txt_Author.Text;
            book.ClassID = ddl_CLass.SelectedValue.ToInt32();
            book.ClassName = ddl_CLass.SelectedItem.Text;
            book.ClickCount = txt_ClickCount.Text.ToInt32();
            book.CorpusID = 0;
            book.CorpusTitle = "";
            book.Enable = chk_Enable.Checked;
            //book.FaceImage=
            book.Intro = txt_Intro.Text;
            book.IsFirstPost = chk_IsFirstpost.Checked;
            book.IsVip = chk_IsVip.Checked;
            book.Length = txt_Length.Text.ToInt32();
            book.ReplyCount = txt_Replycount.Text.ToInt32();
            book.SaveCount = txt_SaveCount.Text.ToInt32();
            book.Status = ddl_Status.SelectedValue.ToByte();
            book.TjCount = txt_TjCount.Text.ToInt32();
            book.ZtID = 0;
            book.ZtName = "";

            if (books.Count == 0)
            {
                book.Addtime = DateTime.UtcNow.AddHours(8);
                book.UpdateTime = DateTime.UtcNow.AddHours(8);
                book.VipUpdateTime = DateTime.UtcNow.AddHours(8);
                ent.AddToBook(book);
                ent.SaveChanges();
            }

            //Deal Book face image
            if (file_Bookfacefile.FileName.IsNullOrEmpty() == false)
            {
                file_Bookfacefile.SaveAs(Server.MapPath("/Book/BookFace/" + book.ID + ".jpg"));
                book.FaceImage = "/Book/BookFace/" + book.ID + ".jpg";
                ent.SaveChanges();
            }

            CreatePage.CreateContentPage(book, book.GetClass());
            Response.Redirect("BookList.aspx?class=" + cls.ToS());
        }
コード例 #3
0
        protected void GetBookInfo()
        {
            int id = WS.RequestInt("id");

            using (DataEntities ent = new DataEntities())
            {
                var bs = from l in ent.Book where l.ID == id select l;
                if (bs.Count() > 0)
                {
                    book = bs.First();
                }
                else
                {
                    book = new Voodoo.Basement.Book();
                }
            }

            Cls       = book.GetClass();
            ParentCls = ClassAction.Classes.Where(p => p.ID == Cls.ParentID).First();
        }
コード例 #4
0
        protected void GetBook(int id)
        {
            DataEntities ent = new DataEntities();

            if (id > 0)
            {
                b = (from l in ent.Book where l.ID == id select l).FirstOrDefault();
            }
            else
            {
                b = (from l in ent.Book orderby l.ID descending select l).FirstOrDefault();
            }

            b.ClickCount++;


            cls = b.GetClass();
            cs  = (from l in ent.BookChapter where l.BookID == id orderby l.ChapterIndex descending orderby l.ID descending select l).ToList();
            ent.Dispose();
        }
コード例 #5
0
ファイル: C.aspx.cs プロジェクト: svn2github/KCMS2
        protected void GetChapter(long id)
        {
            DataEntities ent = new DataEntities();
            if (id > 0)
            {
                c = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault();
            }
            else
            {
                c = (from l in ent.BookChapter  orderby id  select l).FirstOrDefault();
            }
            b = (from l in ent.Book where l.ID==c.BookID select l).FirstOrDefault();
            cls = b.GetClass();

            Content = Voodoo.IO.File.Read(Server.MapPath(Voodoo.Basement.BasePage.GetBookChapterTxtUrl(c, cls)));

            pre = Voodoo.Basement.BasePage.GetPreChapter(c, b);
            next = Voodoo.Basement.BasePage.GetNextChapter(c, b);
            ent.Dispose();
        }
コード例 #6
0
        protected void GetChapter(long id)
        {
            DataEntities ent = new DataEntities();

            if (id > 0)
            {
                c = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault();
            }
            else
            {
                c = (from l in ent.BookChapter orderby id select l).FirstOrDefault();
            }
            b   = (from l in ent.Book where l.ID == c.BookID select l).FirstOrDefault();
            cls = b.GetClass();

            Content = Voodoo.IO.File.Read(Server.MapPath(Voodoo.Basement.BasePage.GetBookChapterTxtUrl(c, cls)));

            pre  = Voodoo.Basement.BasePage.GetPreChapter(c, b);
            next = Voodoo.Basement.BasePage.GetNextChapter(c, b);
            ent.Dispose();
        }
コード例 #7
0
        protected void btn_createPage_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            string[] ids = WS.RequestString("id").Split(',');
            foreach (string id in ids)
            {
                int int_id             = id.ToInt32();
                Voodoo.Basement.Book b = (from l in ent.Book where l.ID == int_id select l).FirstOrDefault();
                Voodoo.Basement.CreatePage.CreateContentPage(b, b.GetClass());

                var chapters = (from l in ent.BookChapter where l.BookID == int_id select l).ToList();
                foreach (var c in chapters)
                {
                    Voodoo.Basement.CreatePage.CreateBookChapterPage(c, c.GetBook(), c.GetClass());
                }
            }


            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
コード例 #8
0
ファイル: ClientService.svc.cs プロジェクト: svn2github/KCMS2
 public void CreateBookPage(Book book)
 {
     Voodoo.Basement.CreatePage.CreateContentPage(book, book.GetClass());
 }
コード例 #9
0
ファイル: TemplateHelper.cs プロジェクト: svn2github/KCMS2
        /// <summary>
        /// 替换小说
        /// </summary>
        /// <param name="TempString"></param>
        /// <param name="q"></param>
        /// <param name="c"></param>
        /// <returns></returns>
        public string ReplaceContent(TemplateList temp, string TempString, Book b, Class c)
        {
            string str_lst = TempString;

            str_lst = str_lst.Replace("[!--class.name--]", c.ClassName);
            str_lst = str_lst.Replace("[!--class.id--]", c.ID.ToS());
            str_lst = str_lst.Replace("[!--class.url--]", BasePage.GetClassUrl(c));

            str_lst = str_lst.Replace("[!--book.url--]", BasePage.GetBookUrl(b, b.GetClass()));//书籍
            str_lst = str_lst.Replace("[!--book.lastchapterurl--]", BasePage.GetBookChapterUrl(ObjectExtents.Chapter(b.LastChapterID), b.GetClass()));//书籍
            str_lst = str_lst.Replace("[!--book.id--]", b.ID.ToString());
            str_lst = str_lst.Replace("[!--book.classid--]", b.ClassID.ToS());
            str_lst = str_lst.Replace("[!--book.classname--]", b.ClassName);
            str_lst = str_lst.Replace("[!--book.ztid--]", b.ZtID.ToS());
            str_lst = str_lst.Replace("[!--book.ztname--]", b.ZtName);
            str_lst = str_lst.Replace("[!--book.title--]", temp.CutTitle > 0 ? b.Title.CutString(temp.CutTitle.ToInt32()) : b.Title);
            str_lst = str_lst.Replace("[!--book.oldtitle--]", b.Title);
            str_lst = str_lst.Replace("[!--book.author--]", b.Author);
            str_lst = str_lst.Replace("[!--book.intro--]", b.Intro.HtmlDeCode());
            str_lst = str_lst.Replace("[!--book.length--]", b.Length.ToS());
            str_lst = str_lst.Replace("[!--book.replycount--]", b.ReplyCount.ToS());
            str_lst = str_lst.Replace("[!--book.addtime--]", b.Addtime.ToDateTime().ToString(temp.TimeFormat));
            str_lst = str_lst.Replace("[!--book.status--]", b.Status.ToS());
            str_lst = str_lst.Replace("[!--book.isvip--]", b.IsVip.ToBoolean().ToChinese());
            str_lst = str_lst.Replace("[!--book.faceimage--]", b.FaceImage);
            str_lst = str_lst.Replace("[!--book.savecount--]", b.SaveCount.ToS());
            str_lst = str_lst.Replace("[!--book.enable--]", b.Enable.ToBoolean().ToChinese());
            str_lst = str_lst.Replace("[!--book.isfirstpost--]", b.IsFirstPost.ToBoolean().ToChinese());
            str_lst = str_lst.Replace("[!--book.lastchapterid--]", b.LastChapterID.ToS());
            str_lst = str_lst.Replace("[!--book.lastchaptertitle--]", b.LastChapterTitle);
            str_lst = str_lst.Replace("[!--book.updatetime--]", b.UpdateTime.ToDateTime().ToString(temp.TimeFormat));
            str_lst = str_lst.Replace("[!--book.lastvipchapterid--]", b.LastVipChapterID.ToS());
            str_lst = str_lst.Replace("[!--book.lastvipchaptertitle--]", b.LastVipChapterTitle);
            str_lst = str_lst.Replace("[!--book.vipupdatetime--]", b.VipUpdateTime.ToDateTime().ToString(temp.TimeFormat));
            str_lst = str_lst.Replace("[!--book.corpusid--]", b.CorpusID.ToS());
            str_lst = str_lst.Replace("[!--book.corpustitle--]", b.CorpusTitle);
            str_lst = str_lst.Replace("[!--book.clickcount--]", b.ClickCount.ToS());
            str_lst = str_lst.Replace("[!--book.tjcount--]", b.TjCount.ToS());
            return str_lst;
        }
コード例 #10
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            var chapters = (from l in ent.BookChapter where l.ID == id select l).ToList();

            var chapter = new Voodoo.Basement.BookChapter();

            if (chapters.Count > 0)
            {
                chapter = chapters.FirstOrDefault();
            }
            chapter.Title          = txt_Title.Text;
            chapter.IsVipChapter   = chk_IsVip.Checked;
            chapter.Enable         = chk_IsEnable.Checked;
            chapter.IsTemp         = chk_IsTemp.Checked;
            chapter.IsFree         = chk_IsFree.Checked;
            chapter.IsImageChapter = chk_IsImageChapter.Checked;
            if (chapters.Count == 0)
            {
                Voodoo.Basement.Book book = (from l in ent.Book where l.ID == bookid select l).FirstOrDefault();
                chapter.BookID     = book.ID;
                chapter.BookTitle  = book.Title;
                chapter.ClassID    = book.ClassID;
                chapter.ClassName  = book.ClassName;
                chapter.UpdateTime = DateTime.UtcNow.AddHours(8);


                ent.AddToBookChapter(chapter);
                ent.SaveChanges();



                book.LastChapterID    = chapter.ID;
                book.LastChapterTitle = chapter.Title;
                book.UpdateTime       = chapter.UpdateTime;
                if (SystemSetting.EnableStatic)
                {
                    CreatePage.CreateContentPage(book, book.GetClass());
                }
            }

            if (chapter.TxtPath.IsNullOrEmpty())
            {
                chapter.TxtPath = BasePage.GetChapterTxtStorePath(chapter, chapter.GetBook());
            }

            ent.SaveChanges();
            ent.Dispose();

            Voodoo.IO.File.Write(
                Server.MapPath(chapter.TxtPath),
                txt_Content.Text);
            //生成章节页面
            if (SystemSetting.EnableStatic)
            {
                CreatePage.CreateBookChapterPage(chapter, chapter.GetBook(), chapter.GetClass());
            }

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