Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public bool Delete(User value)
        {
            bool result = false;

            UserHibernate hibernate = new UserHibernate();
            result = hibernate.Delete(value);

            return result;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="value">值</param>
        /// <returns>结果</returns>
        public bool Insert(User value)
        {
            bool result = false;

            UserHibernate hibernate = new UserHibernate();
            result = hibernate.Insert(value);

            return result;
        }
Ejemplo n.º 4
0
        public bool ChangePassword(string guid, string password)
        {
            bool result = false;

            UserHibernate hibernate = new UserHibernate();
            result = hibernate.ChangePassword(guid, password);

            return result;
        }
Ejemplo n.º 5
0
        public List<User> QueryByInsertUser(User value)
        {
            List<User> results = null;

            UserHibernate hibernate = new UserHibernate();
            results = hibernate.QueryByInsertUser(value.Guid);

            return results;
        }
Ejemplo n.º 6
0
        public User QueryByGuid(string guid)
        {
            User result = null;

            UserHibernate hibernate = new UserHibernate();
            result = hibernate.QueryByGuid(guid);

            return result;
        }
Ejemplo n.º 7
0
        public User QueryByAccount(string account)
        {
            User result = null;

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

            return result;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="rows">每页行数</param>
        /// <param name="total">总数</param>
        /// <returns>用户集合</returns>
        public List<User> Query(int page, int rows, ref int total)
        {
            List<User> results = new List<User>();

            UserHibernate hibernate = new UserHibernate();
            results = hibernate.Query(page, rows, ref total);

            return results;
        }