public ActionResult EditUser(User user) { try { UserService service = new UserService(); var oldUser = service.GetUserById(UserInfo.UserId); if (oldUser != null) { oldUser.Adress = user.Adress; oldUser.QQ = user.QQ; oldUser.LocationId = Request.Form["LocationId[]"]; if (!string.IsNullOrEmpty(Request.Form["Photo"])) { oldUser.Photo = Request.Form["Photo"]; } if (service.UserUpdate(oldUser)) { Session[USERINFO] = oldUser; } } } catch (Exception ex) { LogService.Log("会员列表", ex.ToString()); } return RedirectToAction("ViewUser"); }
public JsonResult CancelIdentify(int id) { AjaxResult result = new AjaxResult(); try { UserService service = new UserService(); User user = service.GetUserById(id); if (user.Vip.HasValue && user.Vip == (int)VipState.VIP) { result.ExceptionInfo = "该用户是VIP会员,不能取消认证。如确实需要,请先取消VIP会员之后重新尝试"; } else if (!service.CancelIdentify(id)) { result.ExceptionInfo = "取消会员认证失败"; } } catch (Exception ex) { LogService.Log("CancelIdentify", ex.ToString()); result.ExceptionInfo = "取消会员认证失败"; } return Json(result); }
public JsonResult SetUserVip(int id) { AjaxResult result = new AjaxResult(); try { UserService service = new UserService(); User user = service.GetUserById(id); if (user.Vip.HasValue && user.Vip == (int)VipState.VIP) { result.ExceptionInfo = "该用户已经是VIP会员"; } else if (user.Vip.HasValue && (user.Vip == (int)VipState.Normal || user.Vip == (int)VipState.Invalid)) { result.ExceptionInfo = "只有认证会员才能设置VIP,请先通知会员进行认证,保证信息准确"; } else if (!service.SetUserToVip(id)) { result.ExceptionInfo = "用户升级1年VIP失败"; } } catch (Exception ex) { LogService.Log("SetUserVip", ex.ToString()); result.ExceptionInfo = "用户升级1年VIP失败"; } return Json(result); }
public ActionResult EditUser(string UserId, string Cellphone, string Email, string QQ, string Address, string UCard, string SiteUrl) { MemberViewModel viewModel = new MemberViewModel(); try { UserService service = new UserService(); User user = service.GetUserById(int.Parse(UserId)); if (user != null) { user.Cellphone = Cellphone; user.Email = Email; user.QQ = QQ; user.Adress = Address; user.UCard = UCard; user.SiteUrl = SiteUrl; } service.UserUpdate(user); viewModel.SingleUser = service.GetUserById(user.UserId); ; } catch (Exception ex) { LogService.Log("会员列表", ex.ToString()); } return View(viewModel); }
public ActionResult EditUser(int id) { MemberViewModel viewModel = new MemberViewModel(); try { UserService service = new UserService(); viewModel.SingleUser = service.GetUserById(id); } catch (Exception ex) { LogService.Log("会员列表", ex.ToString()); } return View(viewModel); }
/// <summary> /// Clears the current logged on user information. /// </summary> public void RefreshUser() { var userService = new Witbird.SHTS.BLL.Services.UserService(); Session[USERINFO] = userService.GetUserById(UserInfo.UserId); }