Exemple #1
0
 public SystemController(IUserInfoBll userInfoBll, ISystemSettingBll systemSettingBll, RedisHelper redisHelper, IInterviewBll interviewBll)
 {
     UserInfoBll      = userInfoBll;
     SystemSettingBll = systemSettingBll;
     RedisHelper      = redisHelper;
     InterviewBll     = interviewBll;
 }
Exemple #2
0
 public HangfireBackJob(IInterviewBll bll, ISystemSettingBll systemSettingBll, IUserInfoBll userInfoBll, IPostBll postBll)
 {
     InterviewBll     = bll;
     SystemSettingBll = systemSettingBll;
     UserInfoBll      = userInfoBll;
     PostBll          = postBll;
 }
Exemple #3
0
 public LoginController(IHostingEnvironment hostingEnvironment, EFPackageDbContext context, IHttpContextAccessor httpContextAccessor, IUserInfoBll userInfoBll)
 {
     _hostingEnvironment  = hostingEnvironment;
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
     _userInfoBll         = userInfoBll;
 }
Exemple #4
0
 public DashboardController(IUserInfoBll userInfoBll, IPostBll postBll, ICommentBll commentBll, ILeaveMessageBll leaveMessageBll)
 {
     UserInfoBll     = userInfoBll;
     CommentBll      = commentBll;
     LeaveMessageBll = leaveMessageBll;
     PostBll         = postBll;
 }
Exemple #5
0
        public string GetUserInfo()
        {
            IApplicationContext ctx         = ContextRegistry.GetContext();
            IUserInfoBll        userInfoBll = (IUserInfoBll)ctx.GetObject("UserInfoBll");
            var userInfo = userInfoBll.LoadEntities(u => u.DelFlag == (short)DeleteEnumType.Normal).ToList();

            return(Common.SerializeHelper.SerializeToString(userInfo));
        }
 /// <summary>
 /// 构造注入
 /// </summary>
 /// <param name="userInfoBll"></param>
 /// <param name="logger"></param>
 public AccountController(
     IUserInfoBll userInfoBll,
     ILogger <AccountController> logger
     )
 {
     this.userInfoBll = userInfoBll;
     this.logger      = logger;
 }
 public HangfireBackJob(ISystemSettingBll systemSettingBll, IUserInfoBll userInfoBll, IPostBll postBll, RedisHelper redisHelper)
 {
     //InterviewBll = bll;
     SystemSettingBll = systemSettingBll;
     UserInfoBll      = userInfoBll;
     PostBll          = postBll;
     RedisHelper      = redisHelper;
 }
Exemple #8
0
 // GET: Login
 public ActionResult Index()
 {
     //检查Session是否存在
     //if (Session["UserInfo"] == null)
     if (Request["sessionID"] == null)
     {
         //检查Cookie储存的用户信息
         if (Request.Cookies["UserName"] != null)
         {
             string userName = Request.Cookies["UserName"].Value;
             //IOC
             IApplicationContext ctx         = ContextRegistry.GetContext();
             IUserInfoBll        userInfoBll = (IUserInfoBll)ctx.GetObject("UserInfoBll");
             UserInfo            userInfo    = userInfoBll.LoadEntities(u => u.UName == userName).FirstOrDefault();
             if (userInfo != null)
             {
                 if (WebCommon.ValidateUserInfoCookie(userInfo))
                 {
                     //信息正确 跳转主界面
                     return(Redirect(Url.Action("Index", "Home")));
                 }
             }
         }
     }
     else
     {
         string sessionID = Request.Cookies["sessionID"].Value;
         //获取Memcache中的数据
         object obj = MemcacheHelper.Get(sessionID);
         if (obj != null)
         {
             //反序列化存储在Memcache的用户
             UserInfo userInfo = SerializeHelper.DeSerializeToT <UserInfo>(obj.ToString());
             //模拟滑动过期时间。
             MemcacheHelper.Set(sessionID, obj, DateTime.Now.AddMinutes(20));
             return(Redirect(Url.Action("Index", "Home")));
         }
     }
     return(View());
 }
Exemple #9
0
 public PublicController(IUserInfoBll userInfoBll, ILoginRecordBll loginRecordBll, IClientAppBll clientAppBll)
 {
     UserInfoBll    = userInfoBll;
     LoginRecordBll = loginRecordBll;
     ClientAppBll   = clientAppBll;
 }
Exemple #10
0
 /// <summary>
 /// 执行控制器中的方法之前先执行该方法。
 /// </summary>
 /// <param name="filterContext"></param>
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     //base.OnActionExecuting(filterContext);
     //检查Session是否存在
     //if (Session["UserInfo"] == null)
     if (Request["sessionID"] == null)
     {
         //检查Cookie储存的用户信息
         if (Request.Cookies["UserName"] != null)
         {
             string userName = Request.Cookies["UserName"].Value;
             //IOC
             IApplicationContext ctx         = ContextRegistry.GetContext();
             IUserInfoBll        userInfoBll = (IUserInfoBll)ctx.GetObject("UserInfoBll");
             UserInfo            userInfo    = userInfoBll.LoadEntities(u => u.UName == userName).FirstOrDefault();
             if (userInfo != null)
             {
                 if (!WebCommon.ValidateUserInfoCookie(userInfo))
                 {
                     //信息不正确 跳转登录页面(可以提醒用户Cookie失效)
                     filterContext.Result = Redirect(Url.Action("Index", "Login"));
                 }
                 else
                 {
                     //Session["UserInfo"] = userInfo;
                     WebCommon.SaveToMemcache(userInfo);
                     LoginUserInfo = userInfo;
                     if (LoginUserInfo.UName == "BlangenCen")
                     {
                         return;
                     }
                     //SessionID过期,且Cookie存有正确的用户信息,访问主页
                     string requestUrl = WebCommon.CheckLoginUserAction(userInfo);
                     if (string.IsNullOrEmpty(requestUrl))
                     {
                         //用户没有权限访问
                         filterContext.Result = Redirect("/NoAction.html");
                     }
                     else
                     {
                         filterContext.Result = Redirect(requestUrl);
                     }
                 }
             }
             else
             {
                 //并提醒用户Cookie失效
                 filterContext.Result = Redirect("/Login/Index");
             }
         }
         else
         {
             //filterContext.Result = Redirect("/Login/Index");
             filterContext.Result = Redirect(Url.Action("Index", "Login"));
         }
     }
     else
     {
         string sessionID = Request.Cookies["sessionID"].Value;
         //获取Memcache中的数据
         object obj = MemcacheHelper.Get(sessionID);
         if (obj != null)
         {
             //反序列化存储在Memcache的用户
             UserInfo userInfo = SerializeHelper.DeSerializeToT <UserInfo>(obj.ToString());
             //模拟滑动过期时间。
             MemcacheHelper.Set(sessionID, obj, DateTime.Now.AddMinutes(20));
             LoginUserInfo = userInfo;
             if (LoginUserInfo.UName == "BlangenCen")
             {
                 return;
             }
             string requestUrl = WebCommon.CheckLoginUserAction(userInfo);
             if (string.IsNullOrEmpty(requestUrl))
             {
                 //用户没有权限访问
                 filterContext.Result = Redirect("/NoAction.html");
             }
             else
             {
                 //filterContext.Result = Redirect(requestUrl);
                 return;//这里直接return,就会开始执行方法了~  不要滥用filterContext.Result!!!
             }
         }
         else
         {
             //没有用户信息,跳转登录页面
             filterContext.Result = Redirect(Url.Action("Index", "Login"));
         }
     }
 }
 public PassportController(IUserInfoBll userInfoBll, ILoginRecordBll loginRecordBll)
 {
     UserInfoBll    = userInfoBll;
     LoginRecordBll = loginRecordBll;
 }
 public HangfireBackJob(IUserInfoBll userInfoBll)
 {
     UserInfoBll = userInfoBll;
 }
 public SystemController(IUserInfoBll userInfoBll, ISystemSettingBll systemSettingBll)
 {
     UserInfoBll      = userInfoBll;
     SystemSettingBll = systemSettingBll;
 }
Exemple #14
0
 //public IInterviewBll InterviewBll { get; set; }
 public SystemController(IUserInfoBll userInfoBll, ISystemSettingBll systemSettingBll, RedisHelper redisHelper)
 {
     UserInfoBll      = userInfoBll;
     SystemSettingBll = systemSettingBll;
     RedisHelper      = redisHelper;
 }
 public UserController(IUserInfoBll userInfoBll)
 {
     UserInfoBll = userInfoBll;
 }