Ejemplo n.º 1
0
        /// <summary>
        /// 书籍编辑
        /// </summary>
        /// <param name="id">ID</param>
        /// <param name="Title">标题</param>
        /// <param name="Author">作者</param>
        /// <param name="ClassID">类别ID</param>
        /// <param name="Intro">简介</param>
        /// <param name="Length">长度</param>
        protected void BookEdit(int id, string Title, string Author, int ClassID, string Intro, long Length)
        {
            DataEntities ent = new DataEntities();

            Book   b         = (from l in ent.Book where l.ID == id select l).FirstOrDefault();
            string ClassName = ObjectExtents.Class(ClassID).ClassName;

            b.Title     = Title.IsNull(b.Title);
            b.Author    = Author.IsNull(b.Author);
            b.ClassID   = ClassID.IsNull(b.ClassID);
            b.ClassName = ClassName.IsNull(b.ClassName);
            b.Intro     = Intro.IsNull(b.Intro);
            b.Length    = Length == 0 ? b.Length : Length;

            if (b.ID < 0)
            {
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(false));
            }
            try
            {
                ent.SaveChanges();
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(true));
            }
            catch
            {
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(false));
            }
            finally
            {
                ent.Dispose();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            string Title     = WS.RequestString("title");
            string Author    = WS.RequestString("author");
            int    ClassID   = WS.RequestInt("classid");
            string ClassName = ObjectExtents.Class(ClassID).ClassName;
            string Intro     = WS.RequestString("intro").HtmlDeCode();
            int    Length    = WS.RequestInt("length", 0);

            Book b = new Book();

            if (Title.IsNullOrEmpty())
            {
                b.ID = int.MinValue;
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(b));
                return;
            }

            b.Addtime          = DateTime.Now;
            b.Author           = Author;
            b.ClassID          = ClassID;
            b.ClassName        = ClassName;
            b.ClickCount       = 0;
            b.CorpusID         = 0;
            b.Enable           = true;
            b.FaceImage        = "";
            b.Intro            = Intro;
            b.IsFirstPost      = false;
            b.IsVip            = false;
            b.LastChapterID    = 0;
            b.LastVipChapterID = 0;
            b.Length           = Length;
            b.ReplyCount       = 0;
            b.SaveCount        = 0;
            b.Status           = 0;//连载中
            b.Title            = Title;
            b.UpdateTime       = DateTime.Now;
            b.VipUpdateTime    = DateTime.Now;
            b.ZtID             = 0;


            var books = (from l in ent.Book where l.Title == Title && l.Author == Author select l).ToList();

            if (books.Count == 0)
            {
                ent.AddToBook(b);
            }
            else
            {
                b = books.FirstOrDefault();
            }
            ent.SaveChanges();


            Response.Clear();
            Response.Write(Voodoo.IO.XML.Serialize(b));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 生成列表页面
        /// </summary>
        /// <param name="id"></param>
        protected void CreateClassPage(int id, int page)
        {
            Class c = ObjectExtents.Class(id);

            Voodoo.Basement.CreatePage.CreateListPage(c, page, false);
            Response.Write(string.Format("创建分类“{0}”第{1}页完成", c.ClassName, page));
        }
Ejemplo n.º 4
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();
                News n      = //NewsView.GetModelByID(id);
                              (from l in ent.News where l.ID == int_id select l).FirstOrDefault();

                CreatePage.CreateContentPage(n, n.GetClass());

                News news_pre = GetPreNews(n, n.GetClass());

                if (news_pre != null)
                {
                    CreatePage.CreateContentPage(news_pre, n.GetClass());
                }
            }

            if (cls > 0)
            {
                try
                {
                    CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
                }
                catch { }
            }
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            int   clsid = ddl_Class.SelectedValue.ToInt32();
            int   quID  = WS.RequestInt("id");
            Class cls   = ObjectExtents.Class(clsid);

            Question qu = (from l in ent.Question where l.ID == quID select l).FirstOrDefault();

            qu.ClassID = ddl_Class.SelectedValue.ToInt32();
            qu.Title   = txt_Title.Text.TrimDbDangerousChar();

            try
            {
                qu.UserID   = ddl_Author.SelectedValue.ToInt32();
                qu.UserName = ddl_Author.SelectedItem.Text;
            }
            catch
            {
                qu.UserID   = 0;
                qu.UserName = "";
            }

            qu.ClickCount = txt_ClickCount.Text.ToInt32(0);
            if (qu.ID <= 0)
            {
                qu.AskTime = DateTime.Now;
            }
            qu.Content = txt_Content.Text.TrimDbDangerousChar();

            qu.Title = txt_Title.Text;
            qu.ZtID  = 0;

            if (qu.ID <= 0)
            {
                ent.AddToQuestion(qu);
            }
            ent.SaveChanges();
            ent.Dispose();


            //生成页面
            try
            {
                CreatePage.CreateContentPage(qu, cls);

                Question pre = GetPreQuestion(qu, cls);
                if (pre != null)
                {
                    CreatePage.CreateContentPage(pre, cls);
                }
                CreatePage.CreateListPage(cls, 1);
            }
            catch { }


            Js.AlertAndChangUrl("保存成功!", url);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加书籍
        /// </summary>
        /// <param name="Title">标题</param>
        /// <param name="Author">作者</param>
        /// <param name="ClassID">类别ID</param>
        /// <param name="Intro">简介</param>
        /// <param name="Length">长度</param>
        protected void BookAdd(string Title, string Author, int ClassID, string Intro, long Length)
        {
            string ClassName = ObjectExtents.Class(ClassID).ClassName;

            DataEntities ent = new DataEntities();

            Book b = new Book();

            if (Title.IsNullOrEmpty() && (from l in ent.Book where l.Title == Title && l.Author == Author select l).Count() > 0)
            {
                b.ID = int.MinValue;
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(b));
                return;
            }

            b.Addtime          = DateTime.UtcNow.AddHours(8);
            b.Author           = Author;
            b.ClassID          = ClassID;
            b.ClassName        = ClassName;
            b.ClickCount       = 0;
            b.CorpusID         = 0;
            b.Enable           = true;
            b.FaceImage        = "";
            b.Intro            = Intro;
            b.IsFirstPost      = false;
            b.IsVip            = false;
            b.LastChapterID    = 0;
            b.LastVipChapterID = 0;
            b.Length           = Length;
            b.ReplyCount       = 0;
            b.SaveCount        = 0;
            b.Status           = 0;//连载中
            b.Title            = Title;
            b.UpdateTime       = DateTime.UtcNow.AddHours(8);
            b.VipUpdateTime    = DateTime.UtcNow.AddHours(8);
            b.ZtID             = 0;

            var books = (from l in ent.Book where l.Title == Title && l.Author == Author select l).ToList();

            if (books.Count == 0)
            {
                ent.AddToBook(b);
                ent.SaveChanges();
            }
            else
            {
                b = books.FirstOrDefault();
            }
            ent.Dispose();

            Response.Clear();
            Response.Write(Voodoo.IO.XML.Serialize(b));
        }
Ejemplo n.º 7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string ids = WS.RequestString("id");

            ImageAction.DeleteImageAlbum(string.Format("id in ({0})", ids));

            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.AlertAndChangUrl("删除成功!", url);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 创建列表页面
 /// </summary>
 protected void CreateClassPage(int cls)
 {
     try
     {
         var c = ObjectExtents.Class(cls);
         Voodoo.Basement.CreatePage.CreateListPage(c, 1);
         Response.Clear();
         Response.Write(XML.Serialize(true));
     }
     catch (System.Exception e)
     {
         Response.Clear();
         Response.Write(XML.Serialize(false));
     }
 }
Ejemplo n.º 9
0
        protected void btn_createPage_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            Class c = //ClassView.GetModelByID(cls.ToS());
                      ObjectExtents.Class(cls);

            string[] ids = WS.RequestString("id").Split(',');
            foreach (string id in ids)
            {
                int intid = id.ToInt32();

                MovieInfo mv = //MovieInfoView.GetModelByID(id);
                               (from l in ent.MovieInfo where l.id == intid select l).FirstOrDefault();
                CreatePage.CreateContentPage(mv, c);
                var kuaibos = //MovieUrlKuaibView.GetModelList(string.Format("MovieID={0}",id));
                              (from l in ent.MovieUrlKuaib where l.MovieID == intid select l).ToList();
                var baidus =  //MovieUrlBaiduView.GetModelList(string.Format("MovieID={0}", id));
                             (from l in ent.MovieUrlBaidu where l.MovieID == intid select l).ToList();
                var dramas =  //MovieDramaView.GetModelList(string.Format("MovieID={0}", id));
                             (from l in ent.MovieDrama where l.MovieID == intid select l).ToList();
                foreach (var kuaib in kuaibos)
                {
                    CreatePage.CreateDramapage(kuaib, c);
                }
                foreach (var baidu in baidus)
                {
                    CreatePage.CreateDramapage(baidu, c);
                }
                foreach (var drama in dramas)
                {
                    CreatePage.CreateDramapage(drama, c);
                }
            }

            if (cls > 0)
            {
                try
                {
                    CreatePage.CreateListPage(c, 1);
                }
                catch { }
            }
            ent.Dispose();
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
Ejemplo n.º 10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var          ids = WS.RequestString("id").Split(',').ToList();
            DataEntities ent = new DataEntities();

            #region  除目录
            List <Voodoo.Basement.Book> books = (from l in ent.Book where ids.IndexOf(l.ID.ToString()) > 0 select l).ToList();
            foreach (var book in books)
            {
                Voodoo.Basement.BookChapter firstChapter = (from l in ent.BookChapter where l.BookID == book.ID select l).FirstOrDefault();

                DirectoryInfo dir = new FileInfo(
                    Server.MapPath(
                        GetBookUrl(
                            book,
                            book.GetClass()
                            )
                        )
                    ).Directory;
                if (dir.Exists)
                {
                    dir.Delete(true);
                }


                DirectoryInfo dirTxt = new FileInfo(
                    Server.MapPath(
                        GetBookChapterTxtUrl(firstChapter, book.GetClass())
                        )
                    ).Directory;
                if (dirTxt.Exists)
                {
                    dirTxt.Delete(true);
                }
            }
            #endregion  除目录

            GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("delete from  Book where id in({0}); delete from BookChapter where BookId in({0})", ids));
            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.AlertAndChangUrl("删除成功!", url);
        }
Ejemplo n.º 11
0
        protected void btn_createPage_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            string ids = WS.RequestString("id");
            var    qus =
                ent.CreateQuery <Question>(string.Format("select * from Question where id in ({0})", ids)).ToList();

            foreach (var qu in qus)
            {
                CreatePage.CreateContentPage(qu, qu.GetClass());
            }


            CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);

            Js.AlertAndChangUrl("生成成功!", url);
        }
Ejemplo n.º 12
0
        protected void btn_SetTop_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            var          ids = WS.RequestString("id").Split(',').ToList();
            var          q   = from l in ent.ImageAlbum where ids.IndexOf(l.ID.ToString()) > 0 select l;

            foreach (var mq in q)
            {
                mq.SetTop = true;
            }
            ent.SaveChanges();

            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
Ejemplo n.º 13
0
        protected void btn_First_Click(object sender, EventArgs e)
        {
            var          ids = WS.RequestString("id").Split(',').ToList();
            DataEntities ent = new DataEntities();
            var          qs  = from l in ent.News where ids.IndexOf(l.ID.ToString()) > 0 select l;

            foreach (var q in qs)
            {
                q.Toutiao = true;
            }
            ent.SaveChanges();;
            ent.Dispose();

            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
Ejemplo n.º 14
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            var          ids = WS.RequestString("id").Split(',').ToList();
            DataEntities ent = new DataEntities();
            var          qs  = from l in ent.Question where ids.IndexOf(l.ID.ToString()) > 0 select l;

            foreach (var q in qs)
            {
                ent.DeleteObject(q);
            }
            ent.SaveChanges();
            ent.Dispose();

            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.AlertAndChangUrl("删除成功!", url);
        }
Ejemplo n.º 15
0
        protected void btn_Status0_Click(object sender, EventArgs e)
        {
            string[]     ids = WS.RequestString("id").Split(',');
            DataEntities ent = new DataEntities();

            foreach (string id in ids)
            {
                int int_id = id.ToInt32();
                var item   = (from l in ent.Book where l.ID == int_id select l).FirstOrDefault();
                item.Status = 0;
            }
            ent.SaveChanges();
            ent.Dispose();

            if (cls > 0)
            {
                CreatePage.CreateListPage(ObjectExtents.Class(cls), 1);
            }
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
Ejemplo n.º 16
0
        protected void DeleteAnswer(int id)
        {
            int clsid = WS.RequestInt("class");
            int quID  = WS.RequestInt("id");

            DataEntities ent = new DataEntities();
            var          q   = (from l in ent.Answer where l.ID == id select l).FirstOrDefault();

            ent.DeleteObject(q);


            Class    cls = ObjectExtents.Class(clsid);
            Question qu  = //QuestionView.GetModelByID(WS.RequestString("id"));
                           (from l in ent.Question where l.ID == quID select l).FirstOrDefault();

            if (cls.ID > 0 && qu.ID > 0)
            {
                CreatePage.CreateContentPage(qu, cls);
            }
            rp_list.DataSource = from l in ent.Answer where l.QuestionID == qu.ID select l;
            rp_list.DataBind();
            ent.SaveChanges();
            ent.Dispose();
        }
Ejemplo n.º 17
0
        protected void LoadList()
        {
            ddl_ModelID.DataSource     = TemplateAction.AllSysModel;
            ddl_ModelID.DataTextField  = "ModelName";
            ddl_ModelID.DataValueField = "ID";
            ddl_ModelID.DataBind();
            DataEntities ent = new DataEntities();

            var templates = (from l in ent.TemplateList select l).ToList().ToDataTable();

            ddl_Template.Bind(templates, "TempName", "ID");
            ddl_Template.Items.Add(new ListItem("--默认--", "0"));
            ddl_Template.SelectedValue = "0";

            var templatecontents = (from l in ent.TemplateContent select l).ToList().ToDataTable();

            ddl_TemplateContent.Bind(templatecontents, "TempName", "ID");
            ddl_TemplateContent.Items.Add(new ListItem("--默认--", "0"));
            ddl_TemplateContent.SelectedValue = "0";

            lbox_ParentID.Bind(NewsAction.NewsClass.ToDataTable(), "ClassName", "ID");
            lbox_ParentID.Items.Add(new ListItem("--根栏目--", "0"));
            lbox_ParentID.SelectedValue = "0";

            cbl_VisitRole.Bind(UserAction.GetUserGroups().ToDataTable(), "GroupName", "ID");
            cbl_PostRoles.Bind(UserAction.GetUserGroups().ToDataTable(), "GroupName", "ID");
            ddl_PostcreateList.DataSource = CreatePageOptions;
            ddl_PostcreateList.DataBind();

            ddl_EditcreateList.Bind(CreatePageOptions);

            ddl_PostManagement.Bind(CreatePageOptions);


            int id = WS.RequestInt("id");

            if (id <= 0)
            {
                return;
            }

            Class cls = //ClassView.GetModelByID(id.ToString());
                        ObjectExtents.Class(id);

            txt_ClassName.Text          = cls.ClassName;
            txt_Alter.Text              = cls.Alter;
            lbox_ParentID.SelectedValue = cls.ParentID.ToString();
            chk_IsLeafClass.Checked     = cls.IsLeafClass.ToBoolean();

            txt_ParentClassForder.Text = cls.ParentClassForder;
            txt_ClassForder.Text       = cls.ClassForder;
            ddl_ModelID.SelectedValue  = cls.ModelID.ToS();

            txt_ClassICON.Text        = cls.ClassICON;
            txt_ClassKeywords.Text    = cls.ClassKeywords;
            txt_ClassDescription.Text = cls.ClassDescription;

            chk_ShowInNav.Checked  = cls.ShowInNav.ToBoolean();
            chk_EnablePost.Checked = cls.EnablePost.ToBoolean();
            txt_NavIndex.Text      = cls.NavIndex.ToS();
            cbl_VisitRole.SetValue(cls.VisitRole.Split(','));

            cbl_PostRoles.SetValue(cls.PostRoles.Split(','));
            ddl_PostcreateList.SelectedValue = cls.PostcreateList.ToString();
            txt_PostAddCent.Text             = cls.PostAddCent.ToS();
            ddl_PostManagement.SelectedValue = cls.PostManagement.ToS();

            ddl_EditcreateList.SelectedValue = cls.EditcreateList.ToS();
            chk_AutoAudt.Checked             = cls.AutoAudt.ToBoolean();

            chk_EnableReply.Checked    = cls.EnableReply.ToBoolean();
            chk_ReplyNeedAudit.Checked = cls.ReplyNeedAudit.ToBoolean();

            ddl_ModelID.SelectedValue = cls.ModelID.ToS();

            txt_ImageHeight.Text = cls.ImageHeight.ToS();
            txt_ImageWidth.Text  = cls.ImageHeight.ToS();

            txt_ManagementUrl.Text = cls.ManagementUrl;

            ddl_Template.SelectedValue = cls.ListTemplateID.ToS();

            ddl_TemplateContent.SelectedValue = cls.ContentTemplateID.ToS();
        }
Ejemplo n.º 18
0
        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));
        }