public ActionResult Index(string keyWord, int?page) { try { keyWord = keyWord != null ? keyWord : ""; CMS_News_DAO objDAO = new CMS_News_DAO(); var data = objDAO.LayDanhSachDeCongBo(keyWord, 0); ViewBag.SearchString = keyWord; int pageSize = 10; int pageNumber = (page ?? 1); TempData["DsTinTucNgungCongBo"] = objDAO.Search(keyWord, 0, 5).ToList().ToPagedList(pageNumber, pageSize); TempData.Keep("DsTinTucNgungCongBo"); return(View(data.ToPagedList(pageNumber, pageSize))); } catch (Exception ex) { SetAlert("Lỗi" + ex.Message.ToString(), "error"); Logs.WriteLog(ex); return(View()); } }
public ActionResult DSNgungCongBo(string keyWord1, int?page1) { try { //int categoryID = category != null ? Convert.ToInt32(category) : 0; keyWord1 = keyWord1 != null ? keyWord1 : ""; CMS_News_DAO objDAO = new CMS_News_DAO(); var data = objDAO.Search(keyWord1, 0, 5).ToList(); ViewBag.SearchString = keyWord1; int pageSize1 = 10; int pageNumber1 = (page1 ?? 1); return(PartialView(data.ToPagedList(pageNumber1, pageSize1))); } catch (Exception ex) { SetAlert("Lỗi" + ex.Message.ToString(), "error"); Logs.WriteLog(ex); return(PartialView()); } }
public PartialViewResult TimKiem(string title, string category, string key, string type, int?page) { try { ViewBag.TITLE = title; ViewBag.CATE = category; int typeID = type != null?Convert.ToInt32(type) : 0; key = key != null ? key : ""; CMS_News_DAO objDAO = new CMS_News_DAO(); var data = objDAO.Search(key, typeID, 5); int pageSize = 10; int pageNumber = (page ?? 1); DT_WebGISEntities MyContext = new DT_WebGISEntities(); var listData = MyContext.CMS_Categories.Where(x => x.PUBLISH == true).ToList(); List <SubSelectBox> listCate = new List <SubSelectBox>(); SubSelectBox sc; var listData0 = listData.Where(x => x.PARENTCATE == 0).OrderBy(x => x.ORDERS); string tag = ""; foreach (var item in listData0) { sc = new SubSelectBox(); sc.id = item.ID; sc.name = item.NAME; listCate.Add(sc); BuildSubCate(listCate, item.ID, listData, tag); } TempData["category"] = listCate; TempData.Keep("category"); ViewBag.KEY = key; ViewBag.TYPE = typeID; return(PartialView(data.ToPagedList(pageNumber, pageSize))); } catch (Exception ex) { Logs.WriteLog(ex); return(PartialView()); } }
public ActionResult Index(string keyWord, string category, string newsStatus, int?page) { try { int categoryID = category != null?Convert.ToInt32(category) : 0; int newsStatusID = newsStatus != null?Convert.ToInt32(newsStatus) : 0; keyWord = keyWord != null ? keyWord : ""; CMS_News_DAO objDAO = new CMS_News_DAO(); var data = objDAO.Search(keyWord, categoryID, 2); ViewBag.SearchString = keyWord; int pageSize = 10; int pageNumber = (page ?? 1); return(View(data.ToPagedList(pageNumber, pageSize))); } catch (Exception ex) { SetAlert("Lỗi" + ex.Message.ToString(), "error"); Logs.WriteLog(ex); return(View()); } }