Esempio n. 1
0
        public ActionResult Edit(FormCollection form)
        {
            string writeMsg = string.Empty;
            Hotel  item     = new Hotel();

            item.ID         = int.Parse(Request.Form["ID"]);
            item.Title      = Request.Form["Title"];
            item.Keywords   = Request.Form["Keywords"];
            item.Content    = form["Content"];
            item.CategoryID = int.Parse(Request.Form["CategoryID"]);
            item.ModifyID   = WebCookieHelper.GetEmployeeId();
            item.ModifyTime = DateTime.Now;
            item.ImagePath  = HtmlContentHelper.GetFirstImgUrl(item.Content);
            item.Summary    = HtmlContentHelper.GetSummary(item.Content);

            EnterRepository.GetRepositoryEnter().HotelRepository.Get(m => m.ID == item.ID);
            bool result = EnterRepository.GetRepositoryEnter().HotelRepository.EditEntity(item, new string[] { "Title", "Keywords", "CategoryID", "Content", "ModifyID", "ModifyTime", "ImagePath", "Summary" });

            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                writeMsg = "修改成功!";
            }
            else
            {
                writeMsg = "修改失败!";
            }
            return(Content(writeMsg));
        }
Esempio n. 2
0
        public ActionResult Add(FormCollection form)
        {
            string writeMsg = string.Empty;
            Hotel  item     = new Hotel();

            item.Title      = Request.Form["Title"];
            item.Keywords   = Request.Form["Keywords"];
            item.CategoryID = int.Parse(Request.Form["CategoryID"]);
            item.Content    = form["Content"];
            item.CreateID   = WebCookieHelper.GetEmployeeId();
            item.CreateTime = DateTime.Now;
            item.ModifyID   = WebCookieHelper.GetEmployeeId();
            item.ModifyTime = DateTime.Now;
            item.ImagePath  = HtmlContentHelper.GetFirstImgUrl(item.Content);
            item.Summary    = HtmlContentHelper.GetSummary(item.Content);

            EnterRepository.GetRepositoryEnter().HotelRepository.AddEntity(item);
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                writeMsg = "{msg:\"保存成功!\",id:" + item.ID.ToString() + "}";
            }
            else
            {
                writeMsg = "{msg:\"保存失败!\",id:0}";
            }
            return(Content(writeMsg));
        }
Esempio n. 3
0
        public ActionResult Add(FormCollection form)
        {
            string    writeMsg = string.Empty;
            QcArticle item     = new QcArticle();

            item.ID           = item.GetNextID();
            item.Title        = Request.Form["Title"];
            item.Keywords     = Request.Form["Keywords"];
            item.CategoryCode = Request.Form["CategoryCode"];
            item.Content      = form["Content"];
            item.ImagePath    = HtmlContentHelper.GetFirstImgUrl(item.Content);
            item.Summary      = HtmlContentHelper.GetSummary(item.Content);
            item.CreateTime   = DateTime.Now;
            item.ModifyTime   = DateTime.Now;
            MeddocEnterRepository.GetRepositoryEnter().QcArticleRepository.AddEntity(item);
            if (MeddocEnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                writeMsg = "{msg:\"保存成功!\",id:" + item.ID.ToString() + "}";
            }
            else
            {
                writeMsg = "{msg:\"保存失败!\",id:0}";
            }
            return(Content(writeMsg));
        }
Esempio n. 4
0
        public ActionResult Edit(FormCollection form)
        {
            string    writeMsg = string.Empty;
            QcArticle item     = new QcArticle();

            item.ID           = int.Parse(Request.QueryString["ID"]);
            item.Title        = Request.Form["Title"];
            item.Keywords     = Request.Form["Keywords"];
            item.CategoryCode = Request.Form["CategoryCode"];
            item.Content      = form["Content"];
            item.ImagePath    = HtmlContentHelper.GetFirstImgUrl(item.Content);
            item.Summary      = HtmlContentHelper.GetSummary(item.Content);
            item.ModifyTime   = DateTime.Now;

            MeddocEnterRepository.GetRepositoryEnter().QcArticleRepository.Get(m => m.ID == item.ID);
            bool result = MeddocEnterRepository.GetRepositoryEnter().QcArticleRepository.EditEntity(item
                                                                                                    , new string[] { "Title", "Content", "ModifyTime", "CategoryCode", "ImagePath", "Summary", "Keywords" });

            if (MeddocEnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                writeMsg = "{msg:\"保存成功!\",id:" + item.ID.ToString() + "}";
            }
            else
            {
                writeMsg = "{msg:\"保存失败!\",id:" + item.ID.ToString() + "}";
            }
            return(Content(writeMsg));
        }
Esempio n. 5
0
        public ActionResult GetHtml()
        {
            string url         = Request.Form["url"];
            string htmlstr     = HtmlContentHelper.WebPageContentGet(url);
            string title       = HtmlContentHelper.WebPageTitleGet(htmlstr).Replace("- 今日头条(TouTiao.com)", "").Replace("- 今日头条(TouTiao.org)", "");
            string description = HtmlContentHelper.WebPageDescriptionGet(htmlstr);
            string keywords    = HtmlContentHelper.WebPageKeywordsGet(htmlstr);
            string article     = HtmlContentHelper.WebPageArticleGet(url, htmlstr);



            var blog = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.ReprintUrl == url).FirstOrDefault();

            if (blog == null)
            {
                blog            = new Models.Blog();
                blog.ReprintUrl = url;
                blog.MemberID   = WebCookieHelper.GetUserId(0);
                blog.CategoryID = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == "blog").FirstOrDefault().ID;
                blog.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                blog.IsPublic   = 1;
                blog.Keywords   = keywords;
                blog.Summary    = description;
                blog.Zhuanzai   = 1;
                blog.ModifyTime = DateTime.Now;
                blog.CreateTime = DateTime.Now;
                blog.Content    = article;
                blog.Title      = title;
                EnterRepository.GetRepositoryEnter().BlogRepository.AddEntity(blog);
            }
            else
            {
                blog.ReprintUrl = url;
                blog.MemberID   = WebCookieHelper.GetUserId(0);
                blog.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                blog.IsPublic   = 1;
                blog.Keywords   = keywords;
                blog.Summary    = description;
                blog.Zhuanzai   = 1;
                blog.ModifyTime = DateTime.Now;
                blog.Content    = article;
                blog.Title      = title;
                EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog, new string[] { "MemberID", "Content", "IsPublic", "ReprintUrl", "Keywords"
                                                                                                    , "ModifyTime", "Summary", "ImagePath", "Title", "Zhuanzai" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                return(Redirect("/blog/view/" + blog.ID + ".htm"));
            }
            return(Content(""));
        }
Esempio n. 6
0
        public ActionResult GetHtmlToutiao()
        {
            string url         = Request.Form["url"];
            string htmlstr     = HtmlContentHelper.WebPageContentGet(url);
            string title       = HtmlContentHelper.WebPageTitleGet(htmlstr).Replace("- 今日头条(TouTiao.com)", "").Replace("- 今日头条(TouTiao.org)", "");
            string description = HtmlContentHelper.WebPageDescriptionGet(htmlstr);
            string keywords    = HtmlContentHelper.WebPageKeywordsGet(htmlstr);
            string article     = HtmlContentHelper.WebPageArticleGet(url, htmlstr);



            var item = EnterRepository.GetRepositoryEnter().ToutiaoRepository.LoadEntities(m => m.ReprintUrl == url).FirstOrDefault();

            if (item == null)
            {
                item            = new Models.Toutiao();
                item.ReprintUrl = url;
                item.MemberID   = WebCookieHelper.GetUserId(0);
                item.CategoryID = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == "toutiao").FirstOrDefault().ID;
                item.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                item.IsPublic   = 1;
                item.Keywords   = keywords;
                item.Summary    = description;
                item.Zhuanzai   = 1;
                item.ModifyTime = DateTime.Now;
                item.CreateTime = DateTime.Now;
                item.Content    = article;
                item.Title      = title;
                EnterRepository.GetRepositoryEnter().ToutiaoRepository.AddEntity(item);
                if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                {
                    return(Redirect("/toutiao/view/" + item.ID + ".htm"));
                }
                return(Content(""));
            }
            else
            {
                return(Redirect("/toutiao/view/" + item.ID + ".htm"));
            }
        }
Esempio n. 7
0
        public ActionResult Write(FormCollection form)
        {
            var blog = new Models.Blog();

            blog.ID         = int.Parse(form["ID"]);
            blog.CategoryID = int.Parse(form["CategoryID"]);
            blog.Content    = form["Content"];
            blog.IsPublic   = int.Parse(form["IsPublic"]);
            blog.Keywords   = form["Keywords"];
            blog.ReprintUrl = form["ReprintUrl"];
            blog.Title      = form["Title"];

            blog.Zhuanzai = int.Parse(form["Zhuanzai"]);

            blog.MemberID  = WebCookieHelper.GetUserId(0);
            blog.Summary   = HtmlContentHelper.GetSummary(blog.Content);
            blog.ImagePath = HtmlContentHelper.GetFirstImgUrl(blog.Content);
            //创建会员信息
            if (blog.ID == 0)
            {
                blog.CreateTime = DateTime.Now;
                blog.ModifyTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().BlogRepository.AddEntity(blog);
            }
            else
            {
                blog.ModifyTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().BlogRepository.Get(m => m.ID == blog.ID);
                EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog
                                                                               , new string[] { "Content", "IsPublic", "ReprintUrl", "Keywords"
                                                                                                , "ModifyTime", "Summary", "ImagePath", "CategoryID", "Title", "Zhuanzai" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
            {
                return(Content("error"));
            }
            return(Content(blog.ID.ToString()));
        }