public ActionResult List() { //设置分页类 int?pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 10; //设置每页显示条数 //获取新闻分类列表的CategoryId int CategoryId = Convert.ToInt32(Request.QueryString["CategoryId"]); db = new biosealEntities(); //获取置顶新闻 var TopNewsId = db.TopNews.Single(); var TopNews = db.News.Where(i => i.Id == TopNewsId.NewsID && i.CategoryId == CategoryId).SingleOrDefault(); ViewBag.TopNews = TopNews; //获取分类列表的前20条记录 var News = db.News.Where(i => i.Id != TopNewsId.NewsID && i.CategoryId == CategoryId).OrderByDescending(i => i.DateTime).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.News.Where(i => i.Id != TopNewsId.NewsID && i.CategoryId == CategoryId).Count()); return(View(News)); }
public ActionResult AjaxRecruits() { db = new biosealEntities(); //获取页面索引pageIndex int?pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); //设置每页显示条数 int pageSize = 8; //查询数据和设置分页Pagination类 var recruits = db.Recruits.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.Recruits.Count()); ViewBag.pageIndex = pageIndex; // 返回json数据集 var results = new List <Recruit>(); foreach (var item in recruits) { results.Add(item); } return(Json(results)); }
public ActionResult NewsMenu(int id) { db = new biosealEntities(); var menu = db.Categories.ToList(); //id 为890413时,代表资料下载位当前样式 //id 为851211时,代表无当前样式 ViewBag.cur = id; return PartialView(menu); }
public ActionResult Index() { db = new biosealEntities(); //group by 分组遍历所有新闻,每个类别取前5条记录 var News = from t in db.News group t by t.CategoryId into g select g.OrderByDescending(i => i.DateTime).Take(5); return View(News); }
public ActionResult NewsMenu(int id) { db = new biosealEntities(); var menu = db.Categories.ToList(); //id 为890413时,代表资料下载位当前样式 //id 为851211时,代表无当前样式 ViewBag.cur = id; return(PartialView(menu)); }
public ActionResult Index() { db = new biosealEntities(); //group by 分组遍历所有新闻,每个类别取前5条记录 var News = from t in db.News group t by t.CategoryId into g select g.OrderByDescending(i => i.DateTime).Take(5); return(View(News)); }
public ActionResult WorkInBioseal() { db = new biosealEntities(); int?pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 20; //设置每页显示条数 var InBioseals = db.InBioseals.OrderByDescending(i => i.Datetime).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.InBioseals.Count()); return(View(InBioseals)); }
public ActionResult Detail() { db = new biosealEntities(); int id = Convert.ToInt32(Request.QueryString["id"]); var news = db.InBioseals.Where(i => i.Id == id).Single(); //获取上一条下一条记录 var prenews = db.InBioseals.Where(i => i.Id < id).OrderByDescending(i => i.Id).FirstOrDefault(); ViewBag.prenews = prenews; var nextnews = db.InBioseals.Where(i => i.Id > id).OrderBy(i => i.Id).FirstOrDefault(); ViewBag.nextnews = nextnews; return View(news); }
public ActionResult Detail() { db = new biosealEntities(); int id = Convert.ToInt32(Request.QueryString["id"]); var news = db.InBioseals.Where(i => i.Id == id).Single(); //获取上一条下一条记录 var prenews = db.InBioseals.Where(i => i.Id < id).OrderByDescending(i => i.Id).FirstOrDefault(); ViewBag.prenews = prenews; var nextnews = db.InBioseals.Where(i => i.Id > id).OrderBy(i => i.Id).FirstOrDefault(); ViewBag.nextnews = nextnews; return(View(news)); }
public ActionResult Process() { db = new biosealEntities(); int?pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 8; //设置每页显示条数 //招聘部分 var Recruits = db.Recruits.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.Recruits.Count()); //签约部分 var Contracts = db.Contracts.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination1 = new Pagination(pageIndex, pageSize, db.Contracts.Count()); ViewBag.Contracts = Contracts; return(View(Recruits)); }
public ActionResult AjaxContract() { //获取pageIndex db = new biosealEntities(); int? pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 8; //设置每页显示条数 var Contracts = db.Contracts.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.Contracts.Count()); ViewBag.pageIndex = pageIndex; // Display the confirmation message var results = new List<Contract>(); foreach (var item in Contracts) { results.Add(item); } return Json(results); }
public ActionResult AjaxRecruits() { db = new biosealEntities(); //获取页面索引pageIndex int? pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); //设置每页显示条数 int pageSize = 8; //查询数据和设置分页Pagination类 var recruits = db.Recruits.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.Recruits.Count()); ViewBag.pageIndex = pageIndex; // 返回json数据集 var results = new List<Recruit>(); foreach (var item in recruits) { results.Add(item); } return Json(results); }
public ActionResult List() { //设置分页类 int? pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 10; //设置每页显示条数 //获取新闻分类列表的CategoryId int CategoryId = Convert.ToInt32(Request.QueryString["CategoryId"]); db = new biosealEntities(); //获取置顶新闻 var TopNewsId = db.TopNews.Single(); var TopNews = db.News.Where(i => i.Id == TopNewsId.NewsID && i.CategoryId == CategoryId).SingleOrDefault(); ViewBag.TopNews = TopNews; //获取分类列表的前20条记录 var News = db.News.Where(i => i.Id != TopNewsId.NewsID && i.CategoryId == CategoryId).OrderByDescending(i => i.DateTime).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.News.Where(i => i.Id != TopNewsId.NewsID && i.CategoryId == CategoryId).Count()); return View(News); }
public ActionResult AjaxContract() { //获取pageIndex db = new biosealEntities(); int?pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 8; //设置每页显示条数 var Contracts = db.Contracts.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.Contracts.Count()); ViewBag.pageIndex = pageIndex; // Display the confirmation message var results = new List <Contract>(); foreach (var item in Contracts) { results.Add(item); } return(Json(results)); }
public ActionResult WorkInBioseal() { db = new biosealEntities(); int? pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 20; //设置每页显示条数 var InBioseals = db.InBioseals.OrderByDescending(i => i.Datetime).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex,pageSize,db.InBioseals.Count()); return View(InBioseals); }
public ActionResult Process() { db = new biosealEntities(); int? pageIndex = Convert.ToInt16(Request.QueryString["pageIndex"]); pageIndex = (pageIndex == null ? 0 : pageIndex); int pageSize = 8; //设置每页显示条数 //招聘部分 var Recruits = db.Recruits.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination = new Pagination(pageIndex, pageSize, db.Recruits.Count()); //签约部分 var Contracts = db.Contracts.OrderByDescending(i => i.Date).Skip(pageIndex.Value * pageSize).Take(pageSize).ToList(); ViewBag.Pagination1 = new Pagination(pageIndex, pageSize, db.Contracts.Count()); ViewBag.Contracts = Contracts; return View(Recruits); }