public YSWL.MALL.Model.Members.UsersExpModel GetUserModel(int UserID) { YSWL.MALL.BLL.Members.UsersExp UserExBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel UserExModel = new Model.Members.UsersExpModel(); UserExModel = UserExBll.GetUsersModel(UserID); return(UserExModel); }
protected void Page_Load(object sender, EventArgs e) { if (Session[YSWL.Common.Globals.SESSIONKEY_ADMIN] != null) { YSWL.Accounts.Bus.User currentUser = (YSWL.Accounts.Bus.User)Session[YSWL.Common.Globals.SESSIONKEY_ADMIN]; LogHelp.AddUserLog(currentUser.UserName, currentUser.UserType, "退出系统", this); #region 更新最新的登录时间 ColoPay.BLL.Members.UsersExp uBll = new BLL.Members.UsersExp(); Model.Members.UsersExpModel uModel = new Model.Members.UsersExpModel(); uModel = uBll.GetUsersExpModel(currentUser.UserID); if (uModel != null) { uModel.LastAccessIP = Request.UserHostAddress; uModel.LastLoginTime = DateTime.Now; uBll.Update(uModel); } #endregion } FormsAuthentication.SignOut(); Session.Remove(Globals.SESSIONKEY_ADMIN); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Write("<script language='javascript'>window.top.location='" + defaullogin + "'</script>"); Response.End(); }
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 ActionResult UserInfo() { //YSWL.Accounts.Bus.User currentUser = this.CurrentUser; BLL.Members.UsersExp userEXBll = new BLL.Members.UsersExp(); Model.Members.UsersExpModel model = userEXBll.GetUsersModel(CurrentUser.UserID); ViewBag.userIP = Request.UserHostAddress; return(View(model)); }
public ActionResult UserModify() { if (HttpContext.User.Identity.IsAuthenticated) { BLL.Members.UsersExp userEXBll = new BLL.Members.UsersExp(); Model.Members.UsersExpModel model = userEXBll.GetUsersModel(CurrentUser.UserID); if (null != model) { return(View(model)); } } return(RedirectToAction("Login", "Account"));//去登录 }
public ActionResult StarDPI(int?UserId) { if (UserId.HasValue) { YSWL.MALL.BLL.Members.UsersExp UserBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel UserModel = UserBll.GetUsersExpModelByCache(UserId.Value); if (UserModel != null && UserModel.IsUserDPI) { ViewBag.IsUserDPI = true; } else { ViewBag.IsUserDPI = false; } } else { ViewBag.IsUserDPI = false; } return(View("_StarDPI")); }
/// <summary> /// 用户中心右边信息的分布试图 /// </summary> /// <returns></returns> public PartialViewResult ProfileLeft(int?uid) { YSWL.MALL.BLL.SNS.UserShip shipBll = new YSWL.MALL.BLL.SNS.UserShip(); YSWL.MALL.BLL.Members.UsersExp userBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel userModel = new Model.Members.UsersExpModel(); YSWL.MALL.BLL.SNS.Groups groupBll = new YSWL.MALL.BLL.SNS.Groups(); int UserId = uid.HasValue ? uid.Value : (currentUser != null ? currentUser.UserID : 0); List <YSWL.MALL.Model.SNS.UserShip> ListShip = shipBll.GetToListByFansPage(UserId, "", 0, 9); List <YSWL.MALL.Model.SNS.Groups> ListGroupJoin = groupBll.GetUserJoinGroup(UserId, 9); List <YSWL.MALL.Model.SNS.Groups> ListGroupCreate = groupBll.GetModelList("CreatedUserId=" + UserId + ""); userModel = userBll.GetUsersExpModel(UserId); ViewBag.FansCount = userModel != null ? userModel.FansCount : 0; ViewBag.IsCurrentUser = uid.HasValue ? false : (currentUser != null ? true : false); ViewBag.UserId = UserId; YSWL.MALL.ViewModel.SNS.ProfileLeft model = new MALL.ViewModel.SNS.ProfileLeft(); model.joingroupList = ListGroupJoin; model.shipList = ListShip; model.creategroupList = ListGroupCreate; return(PartialView("_ProfileLeft", model)); }
/// <summary> /// 个人中心右侧信息 /// </summary> /// <returns></returns> public PartialViewResult SelfRight() { YSWL.MALL.BLL.Members.UsersExp userBll = new BLL.Members.UsersExp(); YSWL.MALL.Model.Members.UsersExpModel userModel = new Model.Members.UsersExpModel(); YSWL.MALL.BLL.SNS.Groups groupBll = new YSWL.MALL.BLL.SNS.Groups(); YSWL.MALL.BLL.SNS.UserAlbums bllAlbums = new YSWL.MALL.BLL.SNS.UserAlbums(); YSWL.MALL.ViewModel.SNS.SelfRight model = new MALL.ViewModel.SNS.SelfRight(); model.MyGroups = groupBll.GetUserJoinGroup(currentUser.UserID, 9); YSWL.MALL.BLL.Ms.Regions RegionBll = new BLL.Ms.Regions(); YSWL.MALL.BLL.SNS.Star starManage = new YSWL.MALL.BLL.SNS.Star(); model.UserInfo = GetUserModel(currentUser.UserID); string strAddress = RegionBll.GetRegionNameByRID(Common.Globals.SafeInt(model.UserInfo.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("天津天津", "天津"); } model.UserInfo.Address = string.IsNullOrEmpty(model.UserInfo.Address) ? "暂未设置" : strAddress; YSWL.MALL.BLL.SNS.AlbumType AlbumTypeBLL = new YSWL.MALL.BLL.SNS.AlbumType(); model.MyAlbum = bllAlbums.GetListByUserId(currentUser.UserID, UserAlbumDetailType); return(PartialView("_SelfRight", model)); }
public ActionResult Logout() { if (Session[Globals.SESSIONKEY_SUPPLIER] != null) { User currentUser = (User)Session[Globals.SESSIONKEY_SUPPLIER]; LogHelp.AddUserLog(currentUser.UserName, currentUser.UserType, "退出系统"); #region 更新最新的登录时间 ColoPay.BLL.Members.UsersExp uBll = new BLL.Members.UsersExp(); Model.Members.UsersExpModel uModel = new Model.Members.UsersExpModel(); uModel = uBll.GetUsersExpModel(currentUser.UserID); if (uModel != null) { uModel.LastAccessIP = Request.UserHostAddress; uModel.LastLoginTime = DateTime.Now; uBll.Update(uModel); } #endregion } FormsAuthentication.SignOut(); Session.Remove(Globals.SESSIONKEY_SUPPLIER); Session.Clear(); Session.Abandon(); return(RedirectToAction("Login", "Account")); }
public ActionResult Register(MALL.ViewModel.SNS.RegisterModel model) { ViewBag.Title = "注册"; bool IsCloseLogin = YSWL.MALL.BLL.SysManage.ConfigSystem.GetBoolValueByCache("System_Close_Register"); if (IsCloseLogin) { return(RedirectToAction("TurnOff", "Error")); } if (ModelState.IsValid) { //判断昵称是否已存在 //判断邮箱是否已存在 User newUser = new User(); //DONE: 警告DB字段未对应: Email 字段 varchar(100) UserName 字段 varchar(50) 已完成 BEN DONE 2012-11-22 newUser.UserName = model.Email; newUser.NickName = model.NickName; //昵称名称相同 newUser.Password = AccountsPrincipal.EncryptPassword(model.Password); newUser.Email = model.Email; newUser.Activity = true; newUser.UserType = "UU"; newUser.Style = 1; newUser.User_dateCreate = DateTime.Now; newUser.User_cLang = "zh-CN"; int userid = newUser.Create(); if (userid == -100) { ModelState.AddModelError("Message", ErrorCodeToString(MembershipCreateStatus.DuplicateUserName)); } else { //添加用户扩展表数据 BLL.Members.UsersExp ue = new BLL.Members.UsersExp(); ue.UserID = userid; ue.BirthdayVisible = 0; ue.BirthdayIndexVisible = false; ue.Gravatar = string.Format("/{0}/User/Gravatar/{1}", MvcApplication.UploadFolder, userid); ue.ConstellationVisible = 0; ue.ConstellationIndexVisible = false; ue.NativePlaceVisible = 0; ue.NativePlaceIndexVisible = false; ue.RegionId = 0; ue.AddressVisible = 0; ue.AddressIndexVisible = false; ue.BodilyFormVisible = 0; ue.BodilyFormIndexVisible = false; ue.BloodTypeVisible = 0; ue.BloodTypeIndexVisible = false; ue.MarriagedVisible = 0; ue.MarriagedIndexVisible = false; ue.PersonalStatusVisible = 0; ue.PersonalStatusIndexVisible = false; ue.LastAccessIP = ""; ue.LastAccessTime = DateTime.Now; ue.LastLoginTime = DateTime.Now; ue.LastPostTime = DateTime.Now; if (!ue.Add(ue)) { userManage.Delete(userid); userExpManage.Delete(userid); ModelState.AddModelError("Message", "注册失败!"); return(View(model)); } FormsAuthentication.SetAuthCookie(model.Email, false /* createPersistentCookie */); #region //注册加积分 YSWL.MALL.BLL.Members.PointsDetail pointBll = new BLL.Members.PointsDetail(); pointBll.AddPoints(2, userid, "注册成功"); BLL.Members.RankDetail.AddScore(2, userid, "注册成功"); YSWL.MALL.Model.SNS.UserAlbums AlbumsModel = new Model.SNS.UserAlbums(); YSWL.MALL.BLL.SNS.UserAlbums AlbumsBll = new YSWL.MALL.BLL.SNS.UserAlbums(); YSWL.MALL.BLL.SNS.UserShip ShipBll = new YSWL.MALL.BLL.SNS.UserShip(); AlbumsModel.AlbumName = "默认专辑"; AlbumsModel.CreatedDate = DateTime.Now; AlbumsModel.CreatedNickName = model.NickName; AlbumsModel.CreatedUserID = userid; AlbumsBll.AddEx(AlbumsModel, 1); string DefaultGravatar = BLL.SysManage.ConfigSystem.GetValueByCache("DefaultGravatar"); DefaultGravatar = string.IsNullOrEmpty(DefaultGravatar) ? "/Upload/User/Gravatar/Default.jpg" : DefaultGravatar; string TargetGravatarFile = BLL.SysManage.ConfigSystem.GetValueByCache("TargetGravatarFile"); TargetGravatarFile = string.IsNullOrEmpty(TargetGravatarFile) ? "/Upload/User/Gravatar/" : TargetGravatarFile; string path = ControllerContext.HttpContext.Server.MapPath("/"); if (System.IO.File.Exists(path + DefaultGravatar)) { System.IO.File.Copy(path + DefaultGravatar, path + TargetGravatarFile + userid + ".jpg", true); } //自动给是粉丝 ShipBll.GiveUserFellow(userid); #endregion ////return Content("<script >alert('注册成功!');</script >", "text/html"); //通用后,放到基类里 //string script = String.Format("<script defer>alert('注册成功!');location.href='{0}'</script>", Url.Action("Login")); //return Content(script, "text/html"); return(Redirect("/MSNS/Home/Index")); } } return(View(model)); }
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)); }