Ejemplo n.º 1
0
        public Response <SysUser> Login(string loginName, string password)
        {
            ISysUserDAL        userDb = new SysUserDALImpl();
            Response <SysUser> res    = userDb.GetUserByNameAndPassWord(loginName, password);
            Response <SysUser> ret    = new Response <SysUser>();

            if (res.isSuccess)
            {
                ret.list = res.list;
                if (res.list[0].DelTime == null)
                {
                    ret.isSuccess = true;
                    ret.message   = "登录成功";
                }
                else
                {
                    ret.isSuccess = false;
                    ret.message   = "用户当前状态不允许登录";
                }
            }
            else
            {
                ret.isSuccess = false;
                ret.message   = "用户名或密码错误";
            }
            return(ret);
        }
Ejemplo n.º 2
0
        public void TestToString()
        {
            //init
            ISysUserDAL target = new SysUserDALImpl();
            //action
            SysUser user = target.GetUserByNameAndPassWord("admin", "123456").list[0];

            //assert
            Assert.AreNotEqual("xxx", user.ToString());
        }
Ejemplo n.º 3
0
        public void TestSysUserLogin()
        {
            ISysUserDAL        userGetter = new SysUserDALImpl();
            Response <SysUser> res        = userGetter.GetUserByNameAndPassWord("admin", "123456");

            Assert.AreEqual(true, res.isSuccess);
            Assert.AreEqual("admin", res.list[0].LoginName);

            res = userGetter.GetUserByNameAndPassWord("admin", "1234");
            Assert.AreEqual(false, res.isSuccess);
        }
Ejemplo n.º 4
0
        /*
         * 获取用户权限
         */
        public Response <SysPower> GetPowerByID(decimal id)
        {
            ISysUserDAL userDAL = new SysUserDALImpl();

            return(userDAL.GetPowerByUserId(id));
        }