protected override void OnActionExecuting(ActionExecutingContext filterContext) { mapper = MyMapper.Instance(); mapper.BeginTransaction(System.Data.IsolationLevel.Serializable); if (Session["UserSession"] == null || !Session.IsNewSession) { HttpCookie cookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (cookie != null) { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value); if (ticket.IsPersistent) { SysUserDAO sysUserDAO = new SysUserDAO(this.mapper); SysUserModels user = sysUserDAO.GetUserByUserCode(ticket.Name); if (user != null) { FormsAuthentication.SetAuthCookie(user.userCode, true); Session["UserSession"] = user; } } } } base.OnActionExecuting(filterContext); }
public ActionResult Profile() { SysUserDAO userDAO = new SysUserDAO(this.mapper); SysUserModels user = (SysUserModels)Session["UserSession"]; user = userDAO.GetUserByUserCode(user.userCode); SysUserProfileModels model = userDAO.GetUserProfile(user); return View(model); }