public ActionResult Index(int?page) { PaginationInfo paging = new PaginationInfo(); IList <Share> shares = ishare.Get(null, UserName, null, null, null, null, 2, 1, page.HasValue ? page.Value : 1, null, out paging); foreach (Share share in shares) { share.Bady = ibady.Get(share.Bady.ID); } PagedList <Share> models = shares.ToPagedList <Share>(paging); //ShareModel sharemodel = new ShareModel { PageInfo = paging , Records = shares }; //IList<Bady> badys = ibady.Get(null, UserName, null, 1, page.HasValue ? page.Value : 1, null, out paging); //PagedList<Bady> models = badys.ToPagedList<Bady>(paging); IList <SettingGroup> groupsettings = iusersetting.GetByUsername(UserName); int likerate = int.Parse(GetSettingVal(groupsettings, "3C309D27-C774-4E60-8706-17EA2C2B0691")); int recordrate = int.Parse(GetSettingVal(groupsettings, "E038EAB0-9F3D-4967-BE16-06E04633D6C8")); int likedrate = int.Parse(GetSettingVal(groupsettings, "6C715AE2-2D77-4827-B4C1-7E5352B7D00B")); int commentrate = int.Parse(GetSettingVal(groupsettings, "4E8E13CA-0726-4610-8CC5-1A5A3191A7BD")); ViewBag.likerate = likerate; ViewBag.recordrate = recordrate; ViewBag.likedrate = likedrate; ViewBag.commentrate = commentrate; return(View(models)); }
public ActionResult GotoFirst(int?page) { try { PaginationInfo paging = new PaginationInfo(); PaginationInfo paging2 = new PaginationInfo(); IList <UserStore> userstores = iuserstore.Get(null, UserName, null, 1, page.HasValue ? page.Value : 1, null, out paging); IList <SettingGroup> systemsettings = isetting.GetSystemSetting(); IList <SettingGroup> usersetings = iusersetting.GetByUsername(UserName); int likedrate = int.Parse(GetSettingVal(systemsettings, "3C309D27-C774-4E60-8706-17EA2C2B0691")); int likerate = int.Parse(GetSettingVal(systemsettings, "6C715AE2-2D77-4827-B4C1-7E5352B7D00B")); float superrate = float.Parse(GetSettingVal(systemsettings, "4657EED5-A7C5-4058-8F37-797B6155B2A0")); foreach (UserStore userstore in userstores) { userstore.Bady = ibady.Get(userstore.Bady.ID); IList <Like> likes = ilike.Get(null, userstore.Bady.ID.ToString(), UserName, null, 1, 1, 0, null, out paging2); if (likes != null && likes.Count > 0) { userstore.taskstatus = likes[0].Runstatues; userstore.Like = likes[0]; } else { userstore.taskstatus = null; } IList <FirstPageArg> firstpageargs = ifirstpagearg.Get(null, userstore.Type, "hot", 1, 0, null, out paging2); if (firstpageargs != null && firstpageargs.Count == 1) { FirstPageArg firstpagearg = firstpageargs[0]; userstore.needlike = firstpagearg.LikeArg - userstore.Liked > 0 ? firstpagearg.LikeArg - userstore.Liked : 0; userstore.needrecord = firstpagearg.RecordArg - userstore.Record > 0 ? firstpagearg.RecordArg - userstore.Record : 0; userstore.needcommment = firstpagearg.CommentArg - userstore.Comment > 0 ? firstpagearg.CommentArg - userstore.Comment : 0; userstore.needliked = userstore.needlike * likerate / likedrate; } else { int likearg = 0; int recordarg = 0; int commentarg = 0; if (firstpageargs.Count > 1) { foreach (FirstPageArg f in firstpageargs) { likearg += f.LikeArg; recordarg += f.RecordArg; commentarg += f.CommentArg; } likearg = likearg / firstpageargs.Count; recordarg = recordarg / firstpageargs.Count; commentarg = commentarg / firstpageargs.Count; userstore.needlike = likearg - userstore.Liked > 0 ? likearg - userstore.Liked : 0; userstore.needrecord = recordarg - userstore.Record > 0 ? recordarg - userstore.Record : 0; userstore.needcommment = commentarg - userstore.Comment > 0 ? commentarg - userstore.Comment : 0; userstore.needliked = userstore.needlike * likerate / likedrate; } else { //默认值 likearg = 500;// recordarg = 50; commentarg = 20; userstore.needlike = likearg - userstore.Liked > 0 ? likearg - userstore.Liked : 0; userstore.needrecord = recordarg - userstore.Record > 0 ? recordarg - userstore.Record : 0; userstore.needcommment = commentarg - userstore.Comment > 0 ? commentarg - userstore.Comment : 0; userstore.needliked = userstore.needlike * likerate / likedrate; } } userstore.needrecord = userstore.needrecord - Convert.ToInt32(userstore.needrecord * superrate); userstore.needsuper = Convert.ToInt32(userstore.needrecord * superrate); //300 60 0 60 } ViewBag.likedprice = decimal.Parse(GetSettingVal(systemsettings, "FB8E6B56-DEA6-4D70-9C52-E451E7423F55")); ViewBag.likeprice = decimal.Parse(GetSettingVal(systemsettings, "65AD5D23-2619-480E-B6A9-84C58AD07DCB")); ViewBag.commentprice = decimal.Parse(GetSettingVal(systemsettings, "4D2E7311-BA9F-468B-BC3B-3F938C9CC3EA")); ViewBag.recordprice = decimal.Parse(GetSettingVal(systemsettings, "88841710-5B5F-4581-9557-85103CD65534")); ViewBag.supperrecordprice = decimal.Parse(GetSettingVal(systemsettings, "6FF927CF-5676-43B2-A9B4-F72C346E22DE")); ViewBag.pricerate = decimal.Parse(GetSettingVal(systemsettings, "2AADE1C6-59BE-4B0E-927C-7B28BFC8C397")); PagedList <UserStore> models = userstores.ToPagedList <UserStore>(paging); return(View(models)); } catch (Exception ex) { string errorMsg = "An application error occurred. Please contact the adminstrator " + "with the following information:/n/n"; errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source; WriteLog(errorMsg); return(View()); } }
public ActionResult UserSetting() { IList <SettingGroup> groups = iusersetting.GetByUsername(UserName); return(View(groups)); }