public ActionResult Index() { var loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext); var lstBookmarkInfo = RecommendBo.GetRecommendBookmarkList(loginUID); var dicUserInfo = UserInfoBo.GetListByUIDList(lstBookmarkInfo.Select(model => model.UserInfoID).ToList()) .ToDictionary(model => model.UserInfoID, model => model); var lstModel = new List <UIBookmarkInfo>(); lstModel.AddRange(lstBookmarkInfo.Select(model => new UIBookmarkInfo() { Href = model.Href, BookmarkName = model.BookmarkName, BookmarkInfoID = model.BookmarkInfoID, CreateTime = model.CreateTime, UserWebFolderID = model.UserWebFolderID, UserInfoID = model.UserInfoID, Host = model.Host, UserInfo = dicUserInfo.ContainsKey(model.UserInfoID) ? new UIUserInfo() { UserEmail = dicUserInfo[model.UserInfoID].UserEmail, UserInfoID = dicUserInfo[model.UserInfoID].UserInfoID, UserName = dicUserInfo[model.UserInfoID].UserName, UserImagURL = dicUserInfo[model.UserInfoID].UserImagURL, } : new UIUserInfo() { UserName = "******", UserInfoID = 0 }, })); lstModel = Extend.GetRandomList(lstModel); return(View(lstModel.Count > 15 ? lstModel.Take(15).ToList() : lstModel)); }
public ActionResult ShowUserBeFollwed(long uid = 0) { if (uid == 0)//当前登录用户 { uid = UILoginHelper.GetUIDFromHttpContext(HttpContext); } var dicLoginUserFollower = UserRelationshipBo.GetByFollowUserID(UILoginHelper.GetUIDFromHttpContext(HttpContext)); var dicBeFollower = UserRelationshipBo.GetByBeFollwedUID(uid); var lstUserInfoModel = new List <SearchUserInfo>(); var lstModel = UserInfoBo.GetListByUIDList(dicBeFollower.Keys.ToList()); if (lstModel != null && lstModel.Count > 0) { lstUserInfoModel.AddRange(lstModel.Select(model => new SearchUserInfo() { UserImagURL = model.UserImagURL, UserEmail = model.UserEmail, UserInfoComment = model.UserInfoComment, UserName = model.UserName, CreateTime = model.CreateTime, UserInfoID = model.UserInfoID, IsFollow = dicLoginUserFollower.ContainsKey(model.UserInfoID), })); } return(PartialView("ShowUserBeFollwed", lstUserInfoModel)); }
public ActionResult ShowSameHostBookmarkList(long bookmarkID) { var lstBookmarkInfo = RecommendBo.LoadSameHostBookmarkList(bookmarkID); if (lstBookmarkInfo == null) { return(PartialView("ShowSameHostBookmarkList", null)); } //每个用户只取两个书签数据 var showBookmarkList = new List <BizBookmarkInfo>(); var groupBookmark = lstBookmarkInfo.DistinctBy(model => model.Href).GroupBy(model => model.UserInfoID); foreach (var group in groupBookmark) { if (group.Count() >= 2) { showBookmarkList.AddRange(group.Take(2)); } else { showBookmarkList.AddRange(group); } } var dicUserInfo = UserInfoBo.GetListByUIDList(showBookmarkList.Select(model => model.UserInfoID).ToList()) .ToDictionary(model => model.UserInfoID, model => model); var lstModel = new List <UIBookmarkInfo>(); lstModel.AddRange(showBookmarkList.Select(model => new UIBookmarkInfo() { Href = model.Href, BookmarkName = model.BookmarkName, BookmarkInfoID = model.BookmarkInfoID, CreateTime = model.CreateTime, UserWebFolderID = model.UserWebFolderID, UserInfoID = model.UserInfoID, Host = model.Host, UserInfo = dicUserInfo.ContainsKey(model.UserInfoID) ? new UIUserInfo() { UserEmail = dicUserInfo[model.UserInfoID].UserEmail, UserInfoID = dicUserInfo[model.UserInfoID].UserInfoID, UserName = dicUserInfo[model.UserInfoID].UserName, UserImagURL = dicUserInfo[model.UserInfoID].UserImagURL, } : new UIUserInfo() { UserName = "******", UserInfoID = 0 }, })); lstModel = Extend.GetRandomList(lstModel); return(PartialView("ShowSameHostBookmarkList", lstModel.Count > 15 ? lstModel.Take(15).ToList():lstModel)); }
/// <summary> /// 展示用户所在的群组(已通过审核的) /// </summary> /// <param name="userID"></param> /// <returns></returns> public ActionResult ShowUserGroupListAndPass(long userID) { if (userID == 0) { return(View("ShowUserGroupListAndPass", null)); } List <UIUserGroupInfo> lstUIUserGroupInfo = null; var lstGroupUser = BizGroupUser.LoadGroupUser(userID); if (lstGroupUser == null) { return(View("ShowUserGroupListAndPass", null)); } var lstGroupInfo = BizGroupInfo.LoadByGroupIDList(lstGroupUser.Select(model => model.GroupInfoID).ToList()); var lstUserInfo = UserInfoBo.GetListByUIDList(lstGroupInfo.Select(model => model.CreateUesrID).Distinct().ToList()); Dictionary <long, BizUserInfo> dicUserInfo = new Dictionary <long, BizUserInfo>(); if (lstUserInfo != null) { dicUserInfo = lstUserInfo.ToDictionary(model => model.UserInfoID, model => model); } var dicGroupInfo = lstGroupInfo.Select(info => new UIGroupInfo() { CreateTime = info.CreateTime, CreateUesrID = info.CreateUesrID, GroupInfoID = info.GroupInfoID, GroupIntro = info.GroupIntro, GroupName = info.GroupName, CreateUesrInfo = ToUIUserInfo(info.CreateUesrID, dicUserInfo), }).ToDictionary(model => model.GroupInfoID, model => model); lstUIUserGroupInfo = lstGroupUser.Where(model => model.IsPass == (int)ApplyStatus.Pass).Select(model => new UIUserGroupInfo() { GroupInfo = dicGroupInfo.ContainsKey(model.GroupInfoID) ? dicGroupInfo[model.GroupInfoID] : null, GroupInfoID = model.GroupInfoID, GroupUserID = model.GroupUserID, CreateTime = model.CreateTime, IsPass = model.IsPass, UserInfoID = model.UserInfoID, }).ToList(); return(View("ShowUserGroupListAndPass", lstUIUserGroupInfo)); }
// // GET: /ShowMyHasPassGroup/ public ActionResult Index() { var userID = UILoginHelper.GetUIDFromHttpContext(HttpContext); List <UIUserGroupInfo> lstUIUserGroupInfo = null; var lstGroupUser = BizGroupUser.LoadGroupUser(userID); if (lstGroupUser == null) { return(View()); } var lstGroupInfo = BizGroupInfo.LoadByGroupIDList(lstGroupUser.Select(model => model.GroupInfoID).ToList()); var lstUserInfo = UserInfoBo.GetListByUIDList(lstGroupInfo.Select(model => model.CreateUesrID).Distinct().ToList()); Dictionary <long, BizUserInfo> dicUserInfo = new Dictionary <long, BizUserInfo>(); if (lstUserInfo != null) { dicUserInfo = lstUserInfo.ToDictionary(model => model.UserInfoID, model => model); } var dicGroupInfo = lstGroupInfo.Select(info => new UIGroupInfo() { CreateTime = info.CreateTime, CreateUesrID = info.CreateUesrID, GroupInfoID = info.GroupInfoID, GroupIntro = info.GroupIntro, GroupName = info.GroupName, CreateUesrInfo = GroupInfoController.ToUIUserInfo(info.CreateUesrID, dicUserInfo), }).ToDictionary(model => model.GroupInfoID, model => model); lstUIUserGroupInfo = lstGroupUser.Select(model => new UIUserGroupInfo() { GroupInfo = dicGroupInfo.ContainsKey(model.GroupInfoID) ? dicGroupInfo[model.GroupInfoID] : null, GroupInfoID = model.GroupInfoID, GroupUserID = model.GroupUserID, CreateTime = model.CreateTime, IsPass = model.IsPass, UserInfoID = model.UserInfoID, }).ToList(); return(View(lstUIUserGroupInfo)); }
public static List <BizLikeLog> LoadByBookmarkID(long bookmarkID) { var lstModel = DAL.GetByInfoIDAndInfoType(bookmarkID, (int)InfoTypeEnum.Bookmark); if (lstModel != null && lstModel.Count() > 0) { var dicUserIDToModel = UserInfoBo.GetListByUIDList( lstModel.Select(model => model.UserInfoID).Distinct().ToList() ).ToDictionary(model => model.UserInfoID, model => model); return(lstModel.Select(model => new BizLikeLog(model) { LikeUserInfo = dicUserIDToModel.ContainsKey(model.UserInfoID) ? dicUserIDToModel[model.UserInfoID] :new BizUserInfo() }).ToList()); } return(new List <BizLikeLog>()); }
/// <summary> /// 未通过审核的群组用户 /// </summary> /// <param name="groupID"></param> /// <returns></returns> public ActionResult ShowGroupUserListNotPass(long groupID) { if (groupID == 0) { return(View("ShowGroupUserList", null)); } List <UIUserGroupInfo> lstUIUserGroupInfo = null; var lstGroupUser = BizGroupUser.LoadByGroupID(groupID); var groupInfo = BizGroupInfo.LoadByGroupID(groupID); var lstUID = lstGroupUser.Select(model => model.UserInfoID).ToList(); lstUID.Add(groupInfo.CreateUesrID); var lstUserInfo = UserInfoBo.GetListByUIDList(lstUID.Distinct().ToList()); Dictionary <long, BizUserInfo> dicUserInfo = new Dictionary <long, BizUserInfo>(); if (lstUserInfo != null) { dicUserInfo = lstUserInfo.ToDictionary(model => model.UserInfoID, model => model); } lstUIUserGroupInfo = lstGroupUser.Where(model => model.IsPass == (int)ApplyStatus.Waiting).Select(model => new UIUserGroupInfo() { GroupInfo = new UIGroupInfo() { CreateTime = groupInfo.CreateTime, CreateUesrID = groupInfo.CreateUesrID, CreateUesrInfo = ToUIUserInfo(groupInfo.CreateUesrID, dicUserInfo), GroupInfoID = groupInfo.GroupInfoID, GroupName = groupInfo.GroupName, }, GroupInfoID = model.GroupInfoID, GroupUserID = model.GroupUserID, CreateTime = model.CreateTime, IsPass = model.IsPass, UserInfoID = model.UserInfoID, GroupUserInfo = ToUIUserInfo(model.UserInfoID, dicUserInfo), }).ToList(); return(View("ShowGroupUserList", lstUIUserGroupInfo)); }
public ActionResult ShowBookmarkComment(long bookmarkID) { var lstBookmarkComment = BizBookmarkComment.LoadByBookmarkInfoID(bookmarkID); var loginUserInfo = BizUserInfo.LoadByUserInfoID(UILoginHelper.GetUIDFromHttpContext(HttpContext)); UIUserInfo uiLoginUserInfo = new UIUserInfo() { UserName = loginUserInfo.UserName, UserInfoID = loginUserInfo.UserInfoID, UserImagURL = loginUserInfo.UserImagURL, UserEmail = loginUserInfo.UserEmail, }; var lstUserID = lstBookmarkComment.Select(model => model.CriticsUserID).Distinct().ToList(); var dicUserInfo = UserInfoBo.GetListByUIDList(lstUserID).ToDictionary(model => model.UserInfoID, model => model); IEnumerable <UICommentInfo> lstComment = new List <UICommentInfo>(); lstComment = lstBookmarkComment.Select(model => new UICommentInfo() { BookmarkUserID = model.BookmarkUserID, CommentContent = model.CommentContent, CommentTitle = model.CommentTitle, CommentID = model.BookmarkCommentID, CreateTime = model.CreateTime, CriticsUserID = model.CriticsUserID, InfoID = model.BookmarkInfoID, InfoType = UICommentType.Bookmark, CriticsUserInfo = dicUserInfo.ContainsKey(model.CriticsUserID) ? new UIUserInfo() { UserName = dicUserInfo[model.CriticsUserID].UserName, UserEmail = dicUserInfo[model.CriticsUserID].UserEmail, UserImagURL = dicUserInfo[model.CriticsUserID].UserImagURL, UserInfoID = dicUserInfo[model.CriticsUserID].UserInfoID, }:new UIUserInfo(), }); return(PartialView("ShowBookmarkComment", Tuple.Create <IEnumerable <UICommentInfo>, UIUserInfo>(lstComment, uiLoginUserInfo))); }
/// <summary> /// 未通过审核的群组用户 /// </summary> /// <param name="groupID"></param> /// <returns></returns> public ActionResult ShowUserAllGroupMessage() { long loginUID = UILoginHelper.GetUIDFromHttpContext(HttpContext); List <UIUserGroupInfo> lstUIUserGroupInfo = null; var lstGroupInfo = BizGroupInfo.LoadByCreateUserID(loginUID); if (lstGroupInfo == null) { return(View("ShowUserAllGroupMessage", lstUIUserGroupInfo)); } var lstGroupUser = BizGroupUser.LoadByGroupIDList(lstGroupInfo.Select(info => info.GroupInfoID).ToList()); var dicGroupInfo = lstGroupInfo.ToDictionary(info => info.GroupInfoID, info => info); var dicUserInfo = UserInfoBo.GetListByUIDList(lstGroupUser.Select(model => model.UserInfoID).Distinct().ToList()) .ToDictionary(info => info.UserInfoID, info => info); lstUIUserGroupInfo = lstGroupUser.Where(model => model.IsPass == (int)ApplyStatus.Waiting).Select(model => new UIUserGroupInfo() { GroupInfo = dicGroupInfo.ContainsKey(model.GroupInfoID) ? new UIGroupInfo() { CreateTime = dicGroupInfo[model.GroupInfoID].CreateTime, CreateUesrID = dicGroupInfo[model.GroupInfoID].CreateUesrID, GroupInfoID = dicGroupInfo[model.GroupInfoID].GroupInfoID, GroupName = dicGroupInfo[model.GroupInfoID].GroupName, }:null, GroupInfoID = model.GroupInfoID, GroupUserID = model.GroupUserID, CreateTime = model.CreateTime, IsPass = model.IsPass, UserInfoID = model.UserInfoID, GroupUserInfo = ToUIUserInfo(model.UserInfoID, dicUserInfo), }).ToList(); return(View("ShowUserAllGroupMessage", lstUIUserGroupInfo)); }