public ActionResult Part_Procure_NewsList_AuditDetail(int? id)
 {
     新闻 g = new 新闻();
     if (null != id)
     {
         g = 新闻管理.查找新闻((long)id);
     }
     if (g == null)
     {
         return Content("<script>window.location='/单位用户后台/Procure_NewsList_Audit';</script>");
     }
     return PartialView("Procure_Part/Part_Procure_NewsList_AuditDetail", g);
 }
 public ActionResult Part_Procure_NewsDetail(int? id)
 {
     新闻 g = new 新闻();
     var come = Request.QueryString["come"];
     var comestr = "我的新闻列表";
     if (come == "a")
     {
         comestr = "审核新闻";
     }
     else if (come == "l")
     {
         comestr = "新闻列表";
     }
     if (null != id)
     {
         g = 新闻管理.查找新闻((long)id);
     }
     if (g == null)
     {
         return Content("<script>window.location='/单位用户后台/Procure_NewsList';</script>");
     }
     ViewData["come"] = comestr;
     return PartialView("Procure_Part/Part_Procure_NewsDetail", g);
 }
Esempio n. 3
0
        public ActionResult Part_NewsSearch()
        {
            ViewData["searchtext"] = Request.Form["searchtext"];

            TopDocs serchalllist = SearchIndex("/Lucene.Net/IndexDic/News", Request.Form["searchtext"]);
            if(serchalllist!=null)
            {
                int page = 1;
                ViewData["currentpage"] = page;
                ViewData["pagecount"] = page;
                IList<新闻> serchlist = new List<新闻>();
                var listcount = serchalllist.totalHits > 1000 ? 1000 : serchalllist.totalHits;
                if (serchalllist != null && listcount > 0)
                {
                    int maxpage = Math.Max((listcount + PAGESIZE - 1) / PAGESIZE, 1);

                    int length = PAGESIZE;
                    if (maxpage == page && listcount % PAGESIZE != 0)
                        length = listcount % PAGESIZE;

                    //IndexSearcher search = new IndexSearcher(IndexDic("/Lucene.Net/IndexDic/News"), true);
                    IndexSearcher search = new IndexSearcher(new Lucene.Net.Store.SimpleFSDirectory(new System.IO.DirectoryInfo(IndexDic("/Lucene.Net/IndexDic/News"))), true);
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    dic.Add("title", Request.Form["searchtext"]);
                    for (int i = 0; i < length; i++)
                    {
                        新闻 model = new 新闻();
                        model.Id = long.Parse(search.Doc(serchalllist.scoreDocs[i].doc).Get("NumId"));
                        model.内容主体.标题 = search.Doc(serchalllist.scoreDocs[i].doc).Get("Title");
                        model.内容主体.发布时间 = Convert.ToDateTime(search.Doc(serchalllist.scoreDocs[i].doc).Get("AddTime"));
                        serchlist.Add(SetHighlighter(dic, model));
                    }
                    //ViewData["currentpage"] = page;
                    ViewData["pagecount"] = maxpage;
                }
                ViewData["新闻搜索显示列表"] = serchlist;

                return PartialView("Part_News/Part_NewsSearch");
            }
            else
            {
                return Content("<script>window.location='/新闻/NewsList';</script>");
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 设置关键字高亮
 /// </summary>
 /// <param name="dicKeywords">关键字列表</param>
 /// <param name="model">返回的数据模型</param>
 /// <returns></returns>
 private 新闻 SetHighlighter(Dictionary<string, string> dicKeywords, 新闻 model)
 {
     SimpleHTMLFormatter simpleHTMLFormatter = new PanGu.HighLight.SimpleHTMLFormatter("<font color=\"red\">", "</font>");
     Highlighter highlighter = new PanGu.HighLight.Highlighter(simpleHTMLFormatter, new Segment());
     highlighter.FragmentSize = 50;
     string strTitle = string.Empty;
     dicKeywords.TryGetValue("title", out strTitle);
     if (!string.IsNullOrEmpty(strTitle))
     {
         string title = highlighter.GetBestFragment(strTitle, model.内容主体.标题);
         if (!string.IsNullOrEmpty(title))
             model.内容主体.标题 = title;
     }
     return model;
 }
Esempio n. 5
0
        public ActionResult Part_SearchByCondition()
        {
            int page = int.Parse(Request.Params["page"]);
            string keyword = Request.Params["keyword"];

            TopDocs serchalllist = SearchIndex("/Lucene.Net/IndexDic/News", keyword);

            IList<新闻> serchlist = new List<新闻>();
            var listcount = serchalllist.totalHits > 1000 ? 1000 : serchalllist.totalHits;
            if (serchalllist != null && listcount > 0)
            {
                int maxpage = Math.Max((listcount + PAGESIZE - 1) / PAGESIZE, 1);

                int length = PAGESIZE;
                if (maxpage == page && listcount % PAGESIZE != 0)
                {
                    length = listcount % PAGESIZE;
                }
                //IndexSearcher search = new IndexSearcher(IndexDic("/Lucene.Net/IndexDic/News"), true);
                IndexSearcher search = new IndexSearcher(new Lucene.Net.Store.SimpleFSDirectory(new System.IO.DirectoryInfo(IndexDic("/Lucene.Net/IndexDic/News"))), true);
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add("title", keyword);
                int count = PAGESIZE * ((int)page - 1);
                for (int i = count; i < count + length; i++)
                {
                    新闻 model = new 新闻();
                    model.Id = long.Parse(search.Doc(serchalllist.scoreDocs[i].doc).Get("NumId"));
                    model.内容主体.标题 = search.Doc(serchalllist.scoreDocs[i].doc).Get("Title");
                    model.内容主体.发布时间 = Convert.ToDateTime(search.Doc(serchalllist.scoreDocs[i].doc).Get("AddTime"));
                    serchlist.Add(SetHighlighter(dic, model));
                }

                ViewData["currentpage"] = page;
                ViewData["pagecount"] = maxpage;
            }
            ViewData["新闻搜索显示列表"] = serchlist;

            return PartialView("Part_News/Part_SearchByCondition");
        }
Esempio n. 6
0
 public static bool 更新新闻(新闻 content,bool flage = true)
 {
     return Mongo.更新(content, flage);
 }
Esempio n. 7
0
 public static bool 添加新闻(新闻 content)
 {
     return Mongo.添加(content);
 }