public ActionResult Group(int?uid, int?page, int?Type) { if (!LoadUserInfo(uid == null ? 0 : uid.Value)) { if (MvcApplication.MainAreaRoute == AreaRoute.SNS) { //SNS 主域 return(Redirect(ViewBag.BasePath + "Account/Login")); } return(Redirect("/SNS/Account/Login")); } List <YSWL.MALL.Model.SNS.GroupTopics> ListTopic = new List <Model.SNS.GroupTopics>(); YSWL.MALL.BLL.SNS.GroupTopics bll = new YSWL.MALL.BLL.SNS.GroupTopics(); page = page.HasValue && page.Value > 1 ? page.Value : 1; Type = Type.HasValue ? Type.Value : 0; //页大小 int pagesize = 10; //计算分页起始索引 int startIndex = page.Value > 1 ? (page.Value - 1) * pagesize + 1 : 1; //计算分页结束索引 int endIndex = page.Value * pagesize; //总记录数 int toalcount = bll.GetCountByType(this.UserID, (YSWL.MALL.Model.SNS.EnumHelper.UserGroupType)Type.Value); ListTopic = bll.GetUserRelativeTopicByType(this.UserID, (YSWL.MALL.Model.SNS.EnumHelper.UserGroupType)Type.Value, startIndex, endIndex); PagedList <YSWL.MALL.Model.SNS.GroupTopics> PagedTopicList = new PagedList <YSWL.MALL.Model.SNS.GroupTopics>(ListTopic, page ?? 1, pagesize, toalcount); ViewBag.IsCurrentUser = this.IsCurrentUser; ViewBag.UserId = this.UserID; ViewBag.Type = (YSWL.MALL.Model.SNS.EnumHelper.UserGroupType)Type.Value; ViewBag.NickName = this.NickName; if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/UserProfile/TopicList.cshtml", PagedTopicList)); } #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS); ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; if (ViewBag.IsCurrentUser == true) { ViewBag.Title = "我的小组 - " + pageSetting.Title; } else { ViewBag.Title = this.NickName + "的小组 - " + pageSetting.Title; } #endregion return(View(CurrentThemeViewPath + "/UserProfile/Group.cshtml", PagedTopicList)); }
/// <summary> /// 用户的粉丝 /// </summary> /// <returns></returns> public ActionResult Fans(int?uid, int?page) { if (!LoadUserInfo(uid == null ? 0 : uid.Value)) { if (MvcApplication.MainAreaRoute == AreaRoute.SNS) { //SNS 主域 return(Redirect(ViewBag.BasePath + "Account/Login")); } return(Redirect("/SNS/Account/Login")); } YSWL.MALL.BLL.SNS.UserShip bllUserShip = new YSWL.MALL.BLL.SNS.UserShip(); //重置页面索引 page = page.HasValue && page.Value > 1 ? page.Value : 1; //页大小 int pagesize = 10; //计算分页起始索引 int startIndex = page.Value > 1 ? (page.Value - 1) * pagesize + 1 : 1; //计算分页结束索引 int endIndex = page.Value * pagesize; //总记录数 int toalcount = UserModel.FansCount.HasValue ? UserModel.FansCount.Value : 0; PagedList <YSWL.MALL.Model.SNS.UserShip> FansList = null; int Cuid = (this.IsCurrentUser == false && currentUser != null) ? currentUser.UserID : 0; List <YSWL.MALL.Model.SNS.UserShip> list = bllUserShip.GetUsersAllFansByPage(this.UserID, startIndex, endIndex, Cuid); if (list != null && list.Count > 0) { FansList = new PagedList <YSWL.MALL.Model.SNS.UserShip>(list, page ?? 1, pagesize, toalcount); } if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/UserProfile/FansList.cshtml", FansList)); } ViewBag.IsCurrentUser = this.IsCurrentUser; ViewBag.UserId = this.UserID; #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS); ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; if (ViewBag.IsCurrentUser == true) { ViewBag.Title = "我的粉丝 - " + pageSetting.Title; } else { ViewBag.Title = this.NickName + "的粉丝 - " + pageSetting.Title; } #endregion return(View(CurrentThemeViewPath + "/UserProfile/Fans.cshtml", FansList)); }
/// <summary> /// 用户喜欢 /// </summary> /// <returns></returns> public ActionResult Fav(int?uid, int?pageIndex) { if (!LoadUserInfo(uid == null ? 0 : uid.Value)) { if (MvcApplication.MainAreaRoute == AreaRoute.SNS) { //SNS 主域 return(Redirect(ViewBag.BasePath + "Account/Login")); } return(Redirect("/SNS/Account/Login")); } int startIndex, endIndex, totalCount; pageIndex = pageIndex.HasValue ? pageIndex.Value : 1; startIndex = ViewModel.ViewModelBase.GetStartPageIndex(FavBasePageSize, pageIndex.Value); endIndex = startIndex + FavBasePageSize - 1; totalCount = UserModel.FavouritesCount.Value; ViewBag.WaterfallStartIndex = endIndex; ViewBag.WaterfallEndIndex = pageIndex.Value * FavAllPageSize > totalCount ? totalCount : pageIndex.Value * FavAllPageSize; ViewBag.UserId = this.UserID; ViewBag.RequestPage = this.GetType().Name == "UserController" ? "User" : "Profile"; if (totalCount < 0) { return(new EmptyResult()); } YSWL.MALL.BLL.SNS.UserFavourite UfBll = new YSWL.MALL.BLL.SNS.UserFavourite(); YSWL.MALL.ViewModel.SNS.PhotoList models = new MALL.ViewModel.SNS.PhotoList(); ViewBag.IsCurrentUser = this.IsCurrentUser; ViewBag.NickName = this.NickName; models.PhotoPagedList = UfBll.GetFavListByPage(this.UserID, "", startIndex, endIndex).ToPagedList(pageIndex ?? 1, FavBasePageSize); if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/UserProfile/FavList.cshtml", models)); } #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS); ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; if (ViewBag.IsCurrentUser == true) { ViewBag.Title = "我的喜欢 - " + pageSetting.Title; } else { ViewBag.Title = this.NickName + "的喜欢 - " + pageSetting.Title; } #endregion return(View(CurrentThemeViewPath + "/UserProfile/FavIndex.cshtml", models)); }
public ActionResult Albums(int?uid, string IsFav) { if (!LoadUserInfo(uid == null ? 0 : uid.Value)) { if (MvcApplication.MainAreaRoute == AreaRoute.SNS) { //SNS 主域 return(Redirect(ViewBag.BasePath + "Account/Login")); } return(Redirect("/SNS/Account/Login")); } YSWL.MALL.BLL.SNS.AlbumType AlbumTypeBLL = new YSWL.MALL.BLL.SNS.AlbumType(); YSWL.MALL.BLL.SNS.UserAlbums bllAlbums = new YSWL.MALL.BLL.SNS.UserAlbums(); List <MALL.ViewModel.SNS.AlbumIndex> models = new List <MALL.ViewModel.SNS.AlbumIndex>(); if (!string.IsNullOrEmpty(IsFav)) { models = bllAlbums.GetUserFavAlbum(this.UserID); ViewBag.IsFav = true; } else { models = bllAlbums.GetListByUserId(this.UserID, UserAlbumDetailType); } #region 临时方案, ViewBag.AlbumTypeList = AlbumTypeBLL.GetModelListByCache(Model.SNS.EnumHelper.Status.Enabled); #endregion ViewBag.IsCurrentUser = this.IsCurrentUser; ViewBag.NickName = this.NickName; #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS); ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; if (ViewBag.IsCurrentUser == true) { ViewBag.Title = "我的专辑 - " + pageSetting.Title; } else { ViewBag.Title = this.NickName + "的专辑 - " + pageSetting.Title; } #endregion return(View(CurrentThemeViewPath + "/UserProfile/Albums.cshtml", models)); }
public ActionResult Index(int?page, string type, string q, int groupId = 0) { YSWL.MALL.ViewModel.SNS.GroupInfo groupInfo = new MALL.ViewModel.SNS.GroupInfo(); groupId = groupId > 0 ? groupId : GroupId; groupInfo.Group = bllGroups.GetModel(groupId); ViewBag.GroupId = groupId; ViewBag.GetType = type; if (null != groupInfo.Group) { ViewBag.IsCreator = (CurrentUser != null && groupInfo.Group.CreatedUserId == CurrentUser.UserID); //小组帖子数 ViewBag.toalcount = groupInfo.Group.TopicCount; } //重置页面索引 page = page.HasValue && page.Value > 1 ? page.Value : 1; //页大小 int pagesize = 10; //计算分页起始索引 int startIndex = page.Value > 1 ? (page.Value - 1) * pagesize + 1 : 1; //计算分页结束索引 int endIndex = page.Value * pagesize; //总记录数 int toalcount = 0; switch (type) { case "Search": //小组帖子搜索 //推荐帖子 q = Common.InjectionFilter.Filter(q); toalcount = bllTopic.GetCountByKeyWord(q, groupId); ViewBag.q = q; ViewBag.toalcount = toalcount; groupInfo.TopicList = new PagedList <YSWL.MALL.Model.SNS.GroupTopics>( bllTopic.SearchTopicByKeyWord(startIndex, endIndex, q, groupId, "") , page ?? 1, pagesize, toalcount); if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/Group/TopicList.cshtml", groupInfo.TopicList)); } break; case "User": //小组管理员 groupInfo.AdminUserList = bllGroupUser.GetAdminUserList(groupId); if (groupInfo.AdminUserList.Count > 0 && groupInfo.AdminUserList[0].Role == 2) { BLL.Members.UsersExp bllUser = new BLL.Members.UsersExp(); groupInfo.AdminUserList[0].User = bllUser.GetUsersExpModelByCache(groupInfo.AdminUserList[0].UserID); } //小组成员总数 非管理员用户 toalcount = bllGroupUser.GetRecordCount("GroupId=" + groupId + " AND Role = 0"); //小组成员分页加载 非管理员用户 groupInfo.UserList = new PagedList <Model.SNS.GroupUsers>( bllGroupUser.GetUserList(groupId, startIndex, endIndex) , page ?? 1, pagesize, toalcount); if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/Group/UserList.cshtml", groupInfo)); } break; case "Recommand": //推荐帖子 toalcount = bllTopic.GetRecommandCount(groupId); groupInfo.TopicList = new PagedList <YSWL.MALL.Model.SNS.GroupTopics>( bllTopic.GetTopicListPageByGroup(groupId, startIndex, endIndex, true) , page ?? 1, pagesize, toalcount); if (Request.IsAjaxRequest()) { return(PartialView(CurrentThemeViewPath + "/Group/TopicList.cshtml", groupInfo.TopicList)); } break; default: //帖子 toalcount = bllTopic.GetRecordCount(" Status=1 and GroupID=" + groupId); groupInfo.TopicList = new PagedList <YSWL.MALL.Model.SNS.GroupTopics>( bllTopic.GetTopicListPageByGroup(groupId, startIndex, endIndex, false) , page ?? 1, pagesize, toalcount); ViewBag.page = (toalcount + pagesize - 1) / pagesize; if (Request.IsAjaxRequest()) { return(PartialView("_ReplyList", groupInfo)); } break; } groupInfo.NewTopicList = bllTopic.GetNewTopListByGroup(groupId, 10); groupInfo.NewUserList = bllGroupUser.GetNewUserListByGroup(groupId, 9); ViewBag.joined = (currentUser != null && bllGroupUser.Exists(groupId, currentUser.UserID)) ? "ok" : "error"; #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("GroupList", ApplicationKeyType.SNS); pageSetting.Replace( new[] { PageSetting.RKEY_CNAME, null != groupInfo.Group?groupInfo.Group.GroupName:"" }, //小组名称 new[] { PageSetting.RKEY_CTAG, null != groupInfo.Group?groupInfo.Group.Tags:"" }, //小组标签 new[] { PageSetting.RKEY_CDES, null != groupInfo.Group?groupInfo.Group.GroupDescription:"" }); //小组描述 ViewBag.Title = pageSetting.Title; ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; #endregion return(View(groupInfo)); }
public PartialViewResult TopicReply(int Id, int?page, string viewName = "TopicReply", string ajaxvName = "TopicReplyList") { //if (!bllTopic.Exists(Id) || !bllTopic.UpdatePVCount(Id)) //{ // return RedirectToAction("Index", "Group"); // ViewBag.support = "nosupport"; if (null != CurrentUser) { HttpCookie cookie = Request.Cookies["topicFav_" + Id + CurrentUser.UserID]; if (null != cookie) //取消赞 { ViewBag.support = "support"; } } YSWL.MALL.ViewModel.SNS.TopicReply Model = new TopicReply(); Model.Topic = bllTopic.GetModel(Id); ViewBag.Activity = "invalid"; if (null != Model.Topic && null != CurrentUser) { if (Model.Topic.CreatedUserID == CurrentUser.UserID) //自己的帖子 { ViewBag.Activity = "active"; } } //重置页面索引 page = page.HasValue && page.Value > 1 ? page.Value : 1; ViewBag.page = page + 1; //页大小 int pagesize = 10; //计算分页起始索引 int startIndex = page.Value > 1 ? (page.Value - 1) * pagesize + 1 : 1; //计算分页结束索引 int endIndex = page.Value * pagesize; //总记录数 int toalcount = bllReply.GetRecordCount(" Status=1 and TopicID =" + Id); List <YSWL.MALL.Model.SNS.GroupTopicReply> list = bllReply.GetTopicReplyByTopic(Id, startIndex, endIndex); if (list != null && list.Count > 0) { Model.TopicsReply = new PagedList <YSWL.MALL.Model.SNS.GroupTopicReply>(list, page ?? 1, pagesize, toalcount); } if (Request.IsAjaxRequest()) { return(PartialView(ajaxvName, Model)); } Model.UserJoinGroups = bllGroups.GetUserJoinGroup(Model.Topic != null ? Model.Topic.CreatedUserID : 0, 9); Model.HotTopic = bllTopic.GetHotListByGroup(Model.Topic.GroupID, 9); Model.Group = bllGroups.GetModel(Model.Topic.GroupID); Model.UserPostTopics = bllTopic.GetTopicByUserId(Model.Topic.CreatedUserID, 9); #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("GroupDetail", ApplicationKeyType.SNS); pageSetting.Replace( new[] { PageSetting.RKEY_CNAME, Model.Group.GroupName }, //小组名称 new[] { PageSetting.RKEY_CTNAME, Model.Topic.Title }, //帖子标题 new[] { PageSetting.RKEY_CTAG, Model.Topic.Tags }, //帖子标签 new[] { PageSetting.RKEY_CDES, Model.Topic.Description }); //帖子内容 ViewBag.Title = pageSetting.Title; ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; #endregion return(PartialView(viewName, Model)); }
public ActionResult Posts(string type, int?uid, string nickname) { #region 如果传过来的是用户的nickname,则对应相应的用户id YSWL.MALL.BLL.Members.Users UserBll = new BLL.Members.Users(); int ID; if (!string.IsNullOrEmpty(nickname) && ((ID = UserBll.GetUserIdByNickName(nickname)) > 0)) { uid = ID; } #endregion //#region 如果是当前的用户 //if (currentUser != null && currentUser.UserID == uid) //{ // return RedirectToAction("Posts", "Profile"); //} //#endregion ViewBag.IsCurrentUser = uid.HasValue ? false : (currentUser != null ? true : false); #region 进行对用户的id重写复制 if (!LoadUserInfo(uid == null ? 0 : uid.Value) || !this.Activity) { if (MvcApplication.MainAreaRoute == AreaRoute.SNS) { //SNS 主域 return(Redirect("/Error/UserError")); } return(Redirect("/SNS/Error/UserError")); } #endregion YSWL.MALL.BLL.SNS.AlbumType AlbumTypeBLL = new YSWL.MALL.BLL.SNS.AlbumType(); YSWL.MALL.ViewModel.SNS.PostsPage postPage = new MALL.ViewModel.SNS.PostsPage(); YSWL.MALL.BLL.Members.PointsDetail pointBll = new BLL.Members.PointsDetail(); postPage.Type = type; #region 初始化查询动态的类型 if (!string.IsNullOrEmpty(type)) { switch (type) { case "user": DefaultPostType = Model.SNS.EnumHelper.PostType.User; break; case "all": DefaultPostType = Model.SNS.EnumHelper.PostType.All; break; case "referme": DefaultPostType = Model.SNS.EnumHelper.PostType.ReferMe; break; case "eachother": DefaultPostType = Model.SNS.EnumHelper.PostType.EachOther; break; case "photo": DefaultPostType = Model.SNS.EnumHelper.PostType.Photo; break; case "product": DefaultPostType = Model.SNS.EnumHelper.PostType.Product; break; case "video": DefaultPostType = Model.SNS.EnumHelper.PostType.Video; break; case "fellow": DefaultPostType = Model.SNS.EnumHelper.PostType.Fellow; break; } } else { if (this.IsCurrentUser == true) { postPage.Type = "fellow"; DefaultPostType = Model.SNS.EnumHelper.PostType.Fellow; } else { postPage.Type = "user"; DefaultPostType = Model.SNS.EnumHelper.PostType.User; } } #endregion postPage.PageSize = _PostPageSize; postPage.DataCount = PostsBll.GetCountByPostType(UserID, DefaultPostType, IncludeProduct); postPage.AlbumTypeList = AlbumTypeBLL.GetModelListByCache(Model.SNS.EnumHelper.Status.Enabled); postPage.UserID = UserID; postPage.Setting = YSWL.MALL.BLL.SNS.ConfigSystem.GetPostSetByCache(); ViewBag.CurrentUserID = UserID; ViewBag.NickName = this.NickName; #region SEO 优化设置 IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS); ViewBag.Keywords = pageSetting.Keywords; ViewBag.Description = pageSetting.Description; if (ViewBag.IsCurrentUser == true) { ViewBag.Title = "我的首页 - " + pageSetting.Title; } else { ViewBag.Title = this.NickName + "的首页 - " + pageSetting.Title; } #endregion return(View("Posts", postPage)); }