private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int pageSize = 10;//页面记录数 int manId = Convert.ToInt32(Session["ManId"]); List <SignUp> list = new List <SignUp>(); int listCount = 0; //绑定记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { list = Entity.SignUp.Where(a => a.ManId == manId).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.OperTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { list = Entity.SignUp.Where(a => a.ManId == manId && a.SportsItem.Name.Contains(SreachWhere.Text)).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.OperTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } string strBar = PageBar.GetPageBarType(pageIndex, listCount, pageSize); mPageBar = strBar; this.Repeater1.DataSource = list; this.Repeater1.DataBind(); }
private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int pageSize = 10;//页面记录数 List <SignUp> list = new List <SignUp>(); //记录 int listCount = 0; //导航条 string strBar = string.Empty; //判断条件 if (Request.QueryString["type"] != null) { list = Entity.SignUp.Where(a => a.State != "待审").ToList(); //查询记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { list = list.Where(a => true).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.ItemId).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { list = list.Where(a => a.SportsItem.Name.Contains(SreachWhere.Text) || a.SportsMan.Name.Contains(SreachWhere.Text)).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.ItemId).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } strBar = PageBar.GetPageBarType(pageIndex, listCount, pageSize); } else { list = Entity.SignUp.Where(a => a.State == "待审").ToList(); //查询记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { list = list.Where(a => true).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.ItemId).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { list = list.Where(a => a.SportsItem.Name.Contains(SreachWhere.Text) || a.SportsMan.Name.Contains(SreachWhere.Text)).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.ItemId).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } listCount = Entity.SignUp.Where(a => a.State == "待审").Count(); strBar = PageBar.GetPageBar(pageIndex, listCount, pageSize); } //生成导航条 mPageBar = strBar; this.Repeater1.DataSource = list; this.Repeater1.DataBind(); }
private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int pageSize = 10;//页面记录数 List <SportsMan> list = new List <SportsMan>(); List <Rank> RankList = new List <Rank>(); list = Entity.SportsMan.Where(a => true).ToList(); foreach (var item in list) { Rank rank = new Rank(); rank.SportsMan = item; if (item.SignUp == null || item.SignUp.Count <= 0) { continue; } rank.FirstNum = item.SignUp.Where(a => a.FinalRanK == 1).Count(); rank.SecondNum = item.SignUp.Where(a => a.FinalRanK == 2).Count(); rank.ThirdNum = item.SignUp.Where(a => a.FinalRanK == 3).Count(); rank.AllNum = rank.FirstNum + rank.SecondNum + rank.ThirdNum; RankList.Add(rank); } int listCount = 0; //绑定记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { RankList = RankList.Where(a => true).ToList(); listCount = RankList.Count; RankList = RankList.OrderByDescending(a => a.AllNum).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { RankList = RankList.Where(a => a.SportsMan.Name.Contains(SreachWhere.Text)).ToList(); listCount = RankList.Count; RankList = RankList.OrderByDescending(a => a.AllNum).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } string strBar = PageBar.GetPageBarType(pageIndex, listCount, pageSize); mPageBar = strBar; this.Repeater1.DataSource = RankList; this.Repeater1.DataBind(); }
private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int pageSize = 10;//页面记录数 var className = Entity.SportsMan.GroupBy(a => a.Class).ToList(); List <ClassRank> classRankList = new List <ClassRank>(); foreach (var item in className) { ClassRank classRank = new ClassRank(); classRank.ClassName = item.Key; var list = Entity.SignUp.Where(a => a.SportsMan.Class == item.Key); classRank.FirstNum = list.Where(a => a.FinalRanK == 1).Count(); classRank.SecondNum = list.Where(a => a.FinalRanK == 1).Count(); classRank.ThirdNum = list.Where(a => a.FinalRanK == 3).Count(); classRank.AllNum = classRank.FirstNum + classRank.SecondNum + classRank.ThirdNum; classRankList.Add(classRank); } int listCount = 0; //绑定记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { classRankList = classRankList.Where(a => true).ToList(); listCount = classRankList.Count; classRankList = classRankList.OrderByDescending(a => a.AllNum).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { classRankList = classRankList.Where(a => a.ClassName.Contains(SreachWhere.Text)).ToList(); listCount = classRankList.Count; classRankList = classRankList.OrderByDescending(a => a.AllNum).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } string strBar = PageBar.GetPageBarType(pageIndex, listCount, pageSize); mPageBar = strBar; this.Repeater1.DataSource = classRankList; this.Repeater1.DataBind(); }
private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int pageSize = 10;//页面记录数 List <SportsItem> list = new List <SportsItem>(); int listCount = 0; //总记录数 string strBar = string.Empty; //导航条 //裁判权限 if (Request.QueryString["type"] != null) { int RefereeId = Convert.ToInt32(Session["RefereeId"]); list = Entity.SportsItem.Where(a => a.RefereeId == RefereeId).ToList(); listCount = list.Count; strBar = PageBar.GetPageBarType(pageIndex, listCount, pageSize); } else { list = Entity.SportsItem.Where(a => true).ToList(); listCount = list.Count; strBar = PageBar.GetPageBar(pageIndex, listCount, pageSize); } //分页查询记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { list = list.Where(a => true).OrderByDescending(a => a.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { list = list.Where(a => a.Name.Contains(SreachWhere.Text)).OrderByDescending(a => a.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } //生成导航条 mPageBar = strBar; this.Repeater1.DataSource = list; this.Repeater1.DataBind(); }