当前位置: 首页>>代码示例>>C#>>正文


C# DataEntities.AddToBookChapter方法代码示例

本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToBookChapter方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToBookChapter方法的具体用法?C# DataEntities.AddToBookChapter怎么用?C# DataEntities.AddToBookChapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Voodoo.Basement.DataEntities的用法示例。


在下文中一共展示了DataEntities.AddToBookChapter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btn_Save_Click

        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));
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:57,代码来源:ChapterEdit.aspx.cs

示例2: ChapterInsert

        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);
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:15,代码来源:ClientService.svc.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            int BookID = WS.RequestInt("bookid");
            string BookTitle = WS.RequestString("booktitle");
            int ClassID = WS.RequestInt("classid");
            string ClassName = WS.RequestString("classname");
            string Content = WS.RequestString("content").HtmlDeCode();
            string Title=WS.RequestString("title");

            Class cls = ObjectExtents.Class(ClassID);

            BookChapter c = new BookChapter();

            if (Title.Trim().Length == 0)
            {
                c.ID = -1;
                c.Title = "采集失败";
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(c));
                return;
            }

            if ((from l in ent.BookChapter where l.Title==Title && l.BookTitle ==BookTitle select l).Count()>0)
            {
                c.Title = "已经存在";
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(c));
                return;
            }

            c.BookID = BookID;
            c.BookTitle = BookTitle;
            c.ChapterIndex = 0;
            c.ClassID = ClassID;
            c.ClassName = ClassName;
            c.ClickCount = 0;
            //c.Content = Content;

            c.Enable = true;
            c.IsFree = true;
            c.IsImageChapter = false;
            c.IsTemp = false;
            c.IsVipChapter = false;
            c.TextLength = Content.TrimHTML().Length;
            c.Title = Title;
            c.UpdateTime = DateTime.Now;
            c.ValumeID = 0;

            ent.AddToBookChapter(c);
            //创建内容txt
            Voodoo.IO.File.Write(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Content);

            Book b = (from l in ent.Book where l.ID == BookID select l).FirstOrDefault();
            b.LastChapterID = c.ID;
            b.LastChapterTitle = c.Title;
            b.UpdateTime = c.UpdateTime;

            ent.SaveChanges();

            Response.Clear();
            Response.Write(Voodoo.IO.XML.Serialize(c));
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:64,代码来源:ChapterAdd.aspx.cs

示例4: ChapterAdd

        /// <summary>
        /// 添加章节
        /// </summary>
        /// <param name="BookID">书籍ID</param>
        /// <param name="Title">标题</param>
        /// <param name="Content">内容</param>
        /// <param name="IsImageChapter">是否图片章节</param>
        protected void ChapterAdd(int BookID, string Title, string Content, bool IsImageChapter, bool IsTemp = false)
        {
            DataEntities ent = new DataEntities();

            Book b = (from l in ent.Book where l.ID == BookID select l).FirstOrDefault();
            Class cls = b.GetClass();
            BookChapter c = //BookChapterView.Find(string.Format("BookTitle=N'{0}' and Title=N'{1}'", b.Title, Title));
                (from l in ent.BookChapter where l.BookTitle == b.Title && l.Title == Title select l).FirstOrDefault();
            if (c.ID <= 0)
            {
                c.BookID = b.ID;
                c.BookTitle = b.Title;
                c.ChapterIndex = 0;
                c.ClassID = cls.ID;
                c.ClassName = cls.ClassName;
                c.ClickCount = 0;
                c.Enable = true;
                c.IsFree = true;
                c.IsImageChapter = IsImageChapter;
                c.IsTemp = IsTemp;
                c.IsVipChapter = false;
                c.TextLength = Content.Length;
                c.Title = Title;
                c.UpdateTime = DateTime.UtcNow.AddHours(8);//东八区时间

                ent.AddToBookChapter(c);
                ent.SaveChanges();

                //创建内容txt
                Voodoo.IO.File.Write(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Content);

                b.LastChapterID = c.ID;
                b.LastChapterTitle = c.Title;
                b.UpdateTime = c.UpdateTime;
                ent.SaveChanges();
            }
            ent.Dispose();
            Response.Clear();
            Response.Write(Voodoo.IO.XML.Serialize(c));
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:47,代码来源:xmlrpc.aspx.cs


注:本文中的Voodoo.Basement.DataEntities.AddToBookChapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。