Example #1
0
        public SessionDto GetUserInfo(UserDto user)
        {
            SQLExecuteParam param = new SQLExecuteParam();

            param.sql = XMLHelper.GetNodeString("User", "SQL/GetUserInfo");

            user.password = MD5Helper.MD5Encrypt(user.password);
            param.obj     = user;
            return(DBAgent.SQLExecuteSingleData <SessionDto>(param));
        }
Example #2
0
        /// <summary>
        /// 判断是否存在该用户名
        /// </summary>
        /// <param name="username"></param>
        /// <returns>true 存在 false 不存在</returns>
        public bool CheckUserNameExist(string username)
        {
            SQLExecuteParam param = new SQLExecuteParam();

            param.obj = new
            {
                username = username
            };
            param.sql = "select * from tb_user where user_name = @username";
            if (DBAgent.SQLExecuteSingleData <UserDto>(param) != null)
            {
                return(true);
            }
            return(false);
        }
Example #3
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public UserDto Login(string username, string password)
        {
            UserDto         user  = null;
            SQLExecuteParam param = new SQLExecuteParam();

            param.obj = new
            {
                username = username,
                password = password
            };
            param.sql = "select * from tb_user where user_name = @username and `password` = MD5(@password)";
            user      = DBAgent.SQLExecuteSingleData <UserDto>(param);

            return(user);
        }
Example #4
0
        public bool CheckUserExistByName(string name)
        {
            SQLExecuteParam param = new SQLExecuteParam();

            param.sql = "select count(*) from tbUser where name=@name";
            param.dict.Add("name", name);
            if (DBAgent.SQLExecuteSingleData <int>(param) == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }