示例#1
0
        public UserInfo GetUserInfo()
        {
            T_UserDataTable userTable   = new UserDataSet.T_UserDataTable();
            var             dataService = DataService.Value;

            dataService.FillBySql(userTable, Sql_QueryUserByID, 0, 1, new DataParameter("@ID", SecurityPublic.CurrentUser.UserID));
            if (userTable.Count == 0)
            {
                return(null);
            }
            return(new UserInfo()
            {
                UserID = userTable[0].ID,
                UserName = userTable[0].Name
            });
        }
示例#2
0
        public string Login(string userID, string password)
        {
            T_UserDataTable userTable   = new UserDataSet.T_UserDataTable();
            var             dataService = DataService.Value;

            dataService.FillBySql(userTable, Sql_QueryUserByName, 0, 1, new DataParameter("@UserName", userID));
            if (userTable.Count == 0)
            {
                throw new Exception("登录失败");
            }
            if (userTable[0].IsPasswordNull())
            {
                if (password != null)
                {
                    throw new Exception("登录失败");
                }
            }
            else if (userTable[0].Password != SecurityPublic.ComputeHashString(password))
            {
                throw new Exception("登录失败");
            }

            return(userTable[0].ID);
        }