public ActionResult AjaxUserInfo(int?UserID, string NickName) { YSWL.MALL.BLL.Members.Users UserBll = new BLL.Members.Users(); YSWL.MALL.BLL.Members.UsersExp UserExBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel UserExModel = new Model.Members.UsersExpModel(); int ID; if (!string.IsNullOrEmpty(NickName)) { if ((ID = UserBll.GetUserIdByNickName(NickName)) > 0) { UserID = ID; } else { return(View("_AjaxUserInfo", UserExModel)); } } if (UserID.HasValue) { UserExModel = UserExBll.GetUsersModel(UserID.Value); YSWL.MALL.BLL.Ms.Regions RegionBll = new BLL.Ms.Regions(); string strAddress = RegionBll.GetRegionNameByRID(Common.Globals.SafeInt(UserExModel.Address, 0)); if (strAddress.Contains("北京北京")) { strAddress = strAddress.Replace("北京北京", "北京"); } else if (strAddress.Contains("上海上海")) { strAddress = strAddress.Replace("上海上海", "上海"); } else if (strAddress.Contains("重庆重庆")) { strAddress = strAddress.Replace("重庆重庆", "重庆"); } else if (strAddress.Contains("天津天津")) { strAddress = strAddress.Replace("天津天津", "天津"); } UserExModel.Address = string.IsNullOrEmpty(UserExModel.Address) ? "暂未设置" : strAddress; } YSWL.MALL.BLL.SNS.UserShip shipBll = new YSWL.MALL.BLL.SNS.UserShip(); if (currentUser != null) { if (currentUser.UserID == UserID.Value) { ViewBag.IsSelf = true; } else { if (shipBll.Exists(currentUser.UserID, UserID.Value)) { ViewBag.IsFellow = true; } } } return(View("_AjaxUserInfo", UserExModel)); }
public void SendMsg(FormCollection collection) { ViewBag.Title = "发信息"; if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null) { RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录 } else { JsonObject json = new JsonObject(); string nickname = collection["NickName"]; string title = collection["Title"]; string content = collection["Content"]; if (string.IsNullOrWhiteSpace(nickname)) { json.Accumulate("STATUS", "NICKNAMENULL"); } else if (string.IsNullOrWhiteSpace(title)) { json.Accumulate("STATUS", "TITLENULL"); } else if (string.IsNullOrWhiteSpace(content)) { json.Accumulate("STATUS", "CONTENTNULL"); } else { BLL.Members.Users bll = new BLL.Members.Users(); if (bll.ExistsNickName(nickname)) { int ReceiverID = bll.GetUserIdByNickName(nickname); YSWL.MALL.Model.Members.SiteMessage modeSiteMessage = new YSWL.MALL.Model.Members.SiteMessage(); modeSiteMessage.Title = title; modeSiteMessage.Content = content; modeSiteMessage.SenderID = CurrentUser.UserID; modeSiteMessage.ReaderIsDel = false; modeSiteMessage.ReceiverIsRead = false; modeSiteMessage.SenderIsDel = false; modeSiteMessage.ReceiverID = ReceiverID; modeSiteMessage.SendTime = DateTime.Now; if (bllSM.Add(modeSiteMessage) > 0) { json.Accumulate("STATUS", "SUCC"); } else { json.Accumulate("STATUS", "FAIL"); } } else { json.Accumulate("STATUS", "NICKNAMENOTEXISTS"); } } Response.Write(json.ToString()); } }
/// <summary> /// 用户中心及其导航条 /// </summary> /// <returns></returns> public PartialViewResult UserInfo(int uid = -1, string nickname = "") { YSWL.MALL.BLL.Members.Users UserBll = new BLL.Members.Users(); YSWL.MALL.Model.Members.UsersExpModel UserModel = new Model.Members.UsersExpModel(); YSWL.MALL.BLL.Ms.Regions RegionBll = new BLL.Ms.Regions(); YSWL.MALL.BLL.SNS.Star starManage = new YSWL.MALL.BLL.SNS.Star(); int ID; if (!string.IsNullOrEmpty(nickname) && ((ID = UserBll.GetUserIdByNickName(nickname)) > 0)) { uid = ID; } //是否是发表动态页面 ViewBag.IsPost = uid == -1; ViewBag.IsCurrentUser = false; uid = uid > -1 ? uid : currentUser.UserID; if (currentUser != null && uid == currentUser.UserID) { ViewBag.IsCurrentUser = true; } UserModel = GetUserModel(uid); string strAddress = RegionBll.GetRegionNameByRID(Common.Globals.SafeInt(UserModel.Address, 0)); if (strAddress.Contains("北京北京")) { strAddress = strAddress.Replace("北京北京", "北京"); } else if (strAddress.Contains("上海上海")) { strAddress = strAddress.Replace("上海上海", "上海"); } else if (strAddress.Contains("重庆重庆")) { strAddress = strAddress.Replace("重庆重庆", "重庆"); } else if (strAddress.Contains("天津天津")) { strAddress = strAddress.Replace("天津天津", "天津"); } UserModel.Address = string.IsNullOrEmpty(UserModel.Address) ? "暂未设置" : strAddress; //是否是达人 ViewBag.IsStar = starManage.IsStar(uid); //用户等级 YSWL.MALL.BLL.SNS.GradeConfig manage = new YSWL.MALL.BLL.SNS.GradeConfig(); ViewBag.Level = manage.GetUserLevel(UserModel.Points); return(PartialView("_UserInfo", UserModel)); }
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)); }