public ActionResult Test(int id = 1) { if (Session["CurrentAccountID"] == null) { return(RedirectToAction("Select", "OfficialAccount", new { Area = "Admin" })); } Guid AccountID = Guid.Parse(Session["CurrentAccountID"].ToString()); Subscriber_BLL bll = new Subscriber_BLL(); //List<Subscriber> list = bll.GetListOrderBys(a => a.AccountID == AccountID, false,a => a.Score,a=>a.SubscribeTime).ToList(); List <Subscriber> list = bll.GetPageListOrderBy(id, 50, a => a.AccountID == AccountID, a => a.Score, false).ToList(); return(View(list)); }
public ActionResult ScoreRanking(Guid SubscribeID) { Subscriber_BLL bll = new Subscriber_BLL(); Subscriber my = bll.Get(a => a.SubscribeID == SubscribeID); List <Subscriber> list = bll.GetPageListOrderBy(1, 20, a => a.AccountID == my.AccountID && a.Score > 0, a => a.Score, false).ToList(); AutoMapper.Mapper.CreateMap <Subscriber, Subscriber_ViewModel>(); List <Subscriber_ViewModel> vlist = AutoMapper.Mapper.Map <List <Subscriber_ViewModel> >(list); foreach (var item in vlist) { item.FansCount = bll.GetCount(a => a.FromOpenID == item.OpenID); } ViewBag.SubscribeID = SubscribeID; return(View(vlist)); }
// GET: Admin/Subscriber public ActionResult List(string n, int so = 0, int id = 1) { if (Session["CurrentAccountID"] == null) { return(RedirectToAction("Select", "OfficialAccount", new { Area = "Admin" })); } Guid AccountID = Guid.Parse(Session["CurrentAccountID"].ToString()); ViewBag.SearchParam = n ?? ""; ViewBag.OrderType = so; ViewBag.AccountID = AccountID; Subscriber_BLL bll = new Subscriber_BLL(); List <Subscriber> yuanlist = new List <Subscriber>(); int totalCount = 0; int pageSize = 20; if (so == 0) { if (!String.IsNullOrEmpty(n)) { yuanlist = bll.GetPageListOrderBy(id, pageSize, a => a.AccountID == AccountID && a.NickName.Contains(n), a => a.SubscribeTime, false).ToList(); totalCount = bll.GetCount(a => a.AccountID == AccountID && a.NickName.Contains(n)); } else { yuanlist = bll.GetPageListOrderBy(id, pageSize, a => a.AccountID == AccountID, a => a.SubscribeTime, false).ToList(); totalCount = bll.GetCount(a => a.AccountID == AccountID); } } else { if (!String.IsNullOrEmpty(n)) { yuanlist = bll.GetPageListOrderBy(id, pageSize, a => a.AccountID == AccountID && a.NickName.Contains(n), a => a.Score, false).ToList(); totalCount = bll.GetCount(a => a.AccountID == AccountID && a.NickName.Contains(n)); } else { yuanlist = bll.GetPageListOrderBy(id, pageSize, a => a.AccountID == AccountID, a => a.Score, false).ToList(); totalCount = bll.GetCount(a => a.AccountID == AccountID); } } List <Subscriber> newlist = yuanlist; ViewBag.CurrentQuery = ""; AutoMapper.Mapper.CreateMap <Subscriber, Subscriber_ViewModel>(); List <Subscriber_ViewModel> vlist = AutoMapper.Mapper.Map <List <Subscriber_ViewModel> >(newlist); foreach (var item in vlist) { if (item.FromOpenID != null) { try { Subscriber sub = bll.Get(a => a.AccountID == AccountID && a.OpenID == item.FromOpenID); item.FromNickName = sub.NickName; item.FromHeadImgUrl = sub.HeadImgUrl; } catch (Exception ex) { var aaa = ex; } } item.FansCount = bll.GetCount(a => a.AccountID == AccountID && a.FromOpenID == item.OpenID); item.FansStayCount = bll.GetCount(a => a.AccountID == AccountID && a.FromOpenID == item.OpenID && a.IsOK == true); item.FansLeaveCount = bll.GetCount(a => a.AccountID == AccountID && a.FromOpenID == item.OpenID && a.IsOK != true); double staypercent = 1.00; double leavepercent = 0.00; if (item.FansCount != 0) { staypercent = Math.Round(Convert.ToDouble(item.FansStayCount) / Convert.ToDouble(item.FansCount), 2); leavepercent = Math.Round(Convert.ToDouble(item.FansLeaveCount) / Convert.ToDouble(item.FansCount), 2); } item.FansStayPercent = (staypercent * 100).ToString() + "%"; item.FansLeavePercent = (leavepercent * 100).ToString() + "%"; } var list = new StaticPagedList <Subscriber_ViewModel>(vlist, id, pageSize, totalCount); return(View(list)); }