示例#1
0
 public PartialViewResult ChiTietTinTuc(string title, string id)
 {
     try
     {
         ViewBag.TITLE = title;
         int newsid = Convert.ToInt32(id);
         using (DT_WebGISEntities MyContext = new DT_WebGISEntities())
         {
             var news = MyContext.CMS_News.Find(newsid);
             if (news != null)
             {
                 int    cateid  = (int)news.ID_CATEGORIES;
                 var    cate    = MyContext.CMS_Categories.Find(cateid);
                 string catekey = cate.KEY;
                 ViewBag.CateName = cate.NAME;
                 HomeController hController = new HomeController();
                 var            listData    = hController.GetCacheTinBai().Where(s => s.CateKey == catekey).Where(x => x.ID != newsid).Take(5).ToList();
                 if (listData != null && listData.Count() > 0)
                 {
                     TempData["tinbaikhac"] = listData;
                     TempData.Keep("tinbaikhac");
                 }
             }
             return(PartialView(news));
         }
     }
     catch (Exception ex)
     {
         Logs.WriteLog(ex);
         return(PartialView());
     }
 }
示例#2
0
        public PartialViewResult GioiThieu(string title, string category)
        {
            try
            {
                ViewBag.CategoryTitle = title;
                CMS_News_DAO objNewDao = new CMS_News_DAO();
                List <CMS_News_LayTinBaiCongKhaiTheoCateKey_Result> lstGioiThieu = new List <CMS_News_LayTinBaiCongKhaiTheoCateKey_Result>();
                lstGioiThieu = objHomeController.GetCacheTinBai().Where(s => s.CateKey == "gioi-thieu-chung").ToList();
                if (lstGioiThieu != null && lstGioiThieu.Count > 0)
                {
                    ViewBag.TITLE    = lstGioiThieu[0].TITLE;
                    ViewBag.EXCERPT  = lstGioiThieu[0].EXCERPT;
                    ViewBag.CONTENTS = lstGioiThieu[0].CONTENTS;
                }

                return(PartialView());
            }
            catch (Exception ex)
            {
                Logs.WriteLog(ex);
                return(PartialView());
            }
        }
示例#3
0
 public PartialViewResult DSTinTucTheoChuyenMuc(string title, string category, int?page)
 {
     try
     {
         ViewBag.TITLE = title;
         ViewBag.CATE  = category;
         HomeController hController = new HomeController();
         var            listData    = hController.GetCacheTinBai().Where(x => x.CateKey == category).ToList();
         int            pageSize    = 15;
         int            pageNumber  = (page ?? 1);
         return(PartialView(listData.ToPagedList(pageNumber, pageSize)));
     }
     catch (Exception ex)
     {
         Logs.WriteLog(ex);
         return(PartialView());
     }
 }
示例#4
0
        //
        // GET: /TinTucSuKien/

        public PartialViewResult TinTucSuKien(string title, string category, int?page)
        {
            try
            {
                ViewBag.TITLE = title;
                ViewBag.CATE  = category;

                HomeController hController = new HomeController();
                var            listData    = hController.GetCacheTinBai().Where(t => t.CateKey.Contains("dt-")).OrderByDescending(s => s.CREATEDATE).ToList();
                //var listData = hController.GetCacheTinBai().Where(t => t.CateKey.Contains("dt-")).OrderByDescending(s => s.CREATEDATE).ToList();
                int pageSize   = 15;
                int pageNumber = (page ?? 1);
                return(PartialView(listData.ToPagedList(pageNumber, pageSize)));
            }
            catch (Exception ex)
            {
                Logs.WriteLog(ex);
                return(PartialView());
            }
        }
示例#5
0
 public PartialViewResult DSDuAnHangMuc(string title, string category, int?page)
 {
     try
     {
         ViewBag.TITLE = title;
         ViewBag.CATE  = category;
         //if (category.Trim()=="du-an-nhiem-vu")
         //{
         //    category = "du-an-hang-muc-dau-tu";
         //}
         HomeController hController = new HomeController();
         var            listData    = hController.GetCacheTinBai().Where(x => x.CateKey == category).ToList();
         int            pageSize    = 15;
         int            pageNumber  = (page ?? 1);
         return(PartialView(listData.ToPagedList(pageNumber, pageSize)));
     }
     catch (Exception ex)
     {
         Logs.WriteLog(ex);
         return(PartialView());
     }
 }
示例#6
0
        public ActionResult RSSTheoChuyenMuc(string cm, string iNew)
        {
            try
            {
                string catekey = cm;
                int    iNews   = iNew != null?Convert.ToInt32(iNew) : 0;

                SyndicationFeed feed = null;
                string          siteTitle, description, siteUrl;
                siteTitle = "Danh sách tin tức";
                if (cm == "tin-khoa-hoc-cong-nghe-cua-bo")
                {
                    siteTitle = "Tin khoa học công nghệ của Bộ";
                }
                if (cm == "tin-khoa-hoc-cong-nghe-trong-nuoc")
                {
                    siteTitle = "Tin Khoa học Công nghệ trong nước";
                }
                if (cm == "tin-khoa-hoc-cong-nghe-quoc-te")
                {
                    siteTitle = "Tin Khoa học Công nghệ quốc tế";
                }
                if (cm == "su-kien-khoa-hoc-cong-nghe")
                {
                    siteTitle = "Sự kiện Khoa học Công nghệ";
                }
                siteUrl     = Utilities.UrlContent("su-kien-khoa-hoc-cong-nghe", "", "tt", "");
                description = "";
                // CMS_News_DAO objDAO = new CMS_News_DAO();
                var c           = objHomeController.GetCacheTinBai().Where(s => s.CateKey == catekey).Take(5).ToList();
                var d           = objHomeController.GetCacheTinBai().Where(s => s.CateKey == catekey).Where(x => x.ID == iNews).ToList();
                List <SyndicationItem> items = new List <SyndicationItem>();
                string imageUrl = "";
                foreach (var i in c)
                {
                    string abc = Utilities.UrlContent(cm, GetPlainText(i.TITLE, 200), "tt", i.ID.ToString());
                    //string img = "<a title=" + i.TITLE + " href=" + abc + "> <img src=" + abc + " alt='ảnh tin bài'> </a>";
                    imageUrl = Utilities.SiteURL_Resources() + i.PICTURE;
                    SyndicationItem item = new SyndicationItem
                    {
                        Title       = new TextSyndicationContent(i.TITLE),
                        Content     = new TextSyndicationContent(GetPlainText(i.CONTENTS, 200)), //here content may be Html content so we should use plain text
                        PublishDate = Convert.ToDateTime(i.CREATEDATE),
                    };

                    item.Links.Add(new SyndicationLink(new Uri(abc), "alternate", "Link Title", "text/html", 1000));
                    item.AttributeExtensions.Add(new XmlQualifiedName("myAttribute", ""), "someValue");

                    items.Add(item);
                }
                feed       = new SyndicationFeed(siteTitle, description, new Uri(siteUrl));
                feed.Items = items;
                return(new RSSResult {
                    feedData = feed
                });
            }
            catch (Exception ex)
            {
                return(PartialView());
            }
        }