Example #1
0
        public SysUser AutoLogin(string strUser)
        {
            // var strUser = objWI is WindowsIdentity ? SysCommon.GetUserName(objWI) : objWI.Name;
            //数据库获取设置信息
            BaseService <SysUser> objServ = new BaseService <SysUser>();
            var obj = objServ.Repository.Entities.Where(a => (a.LillyId == strUser || a.UserName == strUser) && a.IsDeleted == false).FirstOrDefault();

            if (obj != null)
            {
                SysMenuService objServ1 = new SysMenuService();
                obj.Menus = objServ1.GetMenusByUserID(obj, Store);

                // objLoginInfo = obj;
                //Session["UserInfo"] = objLoginInfo;

                //登录日志
                BaseService <LogsModel> objServLogs = new BaseService <LogsModel>();
                objServLogs.Repository.Insert(new LogsModel()
                {
                    LogCate         = "AdminLogin",
                    LogContent      = "登录成功",
                    CreatedUserID   = obj.Id.ToString(),
                    CreatedUserName = obj.LillyId
                });
            }

            return(obj);
        }
Example #2
0
        public SysUser GetLoginUser(int strUserID)
        {
            SysUser tUser = Repository.GetByKey(strUserID);

            if (tUser != null)
            {
                SysMenuService objServ = new SysMenuService();
                tUser.Menus = objServ.GetMenusByUserID(tUser, Store);
            }

            return(tUser);
        }
Example #3
0
        public SysUser UserLoginAsync(string strUser, string strPassword)
        {
            SysUser tUser = Repository.Entities.Where(a => (a.LillyId == strUser || a.UserName == strUser) && a.IsDeleted == false).FirstOrDefault();
            SysUser result;

            if (tUser == null)
            {
                result = default(SysUser);
            }
            else
            {
                result = ((UserContext.PasswordHasher.VerifyHashedPassword(tUser.PasswordHash, strPassword) != PasswordVerificationResult.Failed) ? tUser : default(SysUser));
                if (result != null)
                {
                    SysMenuService objServ = new SysMenuService();
                    result.Menus = objServ.GetMenusByUserID(result, Store);
                }
            }
            return(result);
        }