Пример #1
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="account">帐号</param>
        /// <param name="password">密码</param>
        /// <returns>用户</returns>
        public User Login(string account, string password)
        {
            User result = null;

            UserHibernate hibernate = new UserHibernate();
            User user = hibernate.SelectByAccount(account);
            if (user != null)
            {
                if ((user.Password == password) && (user.Validity))
                {
                    result = user;
                    user.Authentication = true;
                }
            }
            else
            {
                int count = hibernate.Count();
                if (count == 0)
                {
                    result = new User();
                    result.Guid = "Prerogative";
                    result.Prerogative = true;
                    result.Authentication = true;
                }
            }
            if ((result != null) && (result.Authentication))
            {
                this.Refresh(result);
            }

            return result;
        }
Пример #2
0
        public User QueryByAccount(string account)
        {
            User result = null;

            UserHibernate hibernate = new UserHibernate();
            result = hibernate.SelectByAccount(account);

            return result;
        }