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
        /// <summary>
        /// 查询数据
        /// </summary>
        public ActionResult QueryData()
        {
            int    page         = Request.Form["page"] != "" ? Convert.ToInt32(Request.Form["page"]) : 0;
            int    size         = Request.Form["rows"] != "" ? Convert.ToInt32(Request.Form["rows"]) : 0;
            string sort         = Request.Form["sort"] != "" ? Request.Form["sort"] : "";
            string order        = Request.Form["order"] != "" ? Request.Form["order"] : "";
            string title        = Request.Form["Title"] != "" ? Request.Form["Title"] : "";
            string categoryCode = Request.Form["CategoryCode"] != null ?Request.Form["CategoryCode"] : "";
            string keywords     = Request.Form["keywords"] != null ? Request.Form["keywords"] : "";

            if (page < 1)
            {
                return(Content(""));
            }
            int totalCount = 0;
            var result     = MeddocEnterRepository.GetRepositoryEnter().QcArticleRepository.LoadPageList(title, 0, categoryCode, keywords, (page - 1) * size, size, out totalCount).ToList();

            JsonHelper json    = new JsonHelper();
            string     strJson = string.Empty;

            foreach (QcArticle item in result)
            {
                json.AddItem("ID", item.ID.ToString());
                json.AddItem("Title", item.Title);
                json.AddItem("CategoryCode", item.CategoryCode);
                json.AddItem("ImagePath", item.ImagePath);
                json.AddItem("Summary", item.Summary == null?"":item.Summary.Replace("\n", "").Replace("\r", "").Replace("\t", ""));
                json.AddItem("Keywords", item.Keywords);
                json.AddItem("CategoryName", SystemConst.CategoryCode.GetCategoryName(item.CategoryCode));
                json.AddItem("CreateTime", item.CreateTime == null ? "" : item.CreateTime.ToString("yyyy-MM-dd HH:mm"));
                json.AddItem("ModifyTime", item.ModifyTime == null ? "" : item.ModifyTime.ToString("yyyy-MM-dd HH:mm"));
                json.AddItem("Content", HtmlContentHelper.GetSummary(item.Content).Replace("\n", "").Replace("\r", "").Replace("\t", ""));
                json.ItemOk();
            }
            json.totlalCount = totalCount;
            if (json.totlalCount > 0)
            {
                strJson = json.ToEasyuiGridJsonString();
            }
            else
            {
                strJson = @"[]";
            }
            return(Content(strJson));
        }
Esempio n. 6
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()));
        }