示例#1
0
        /// <summary>
        /// 用户分页查询
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <returns>结果</returns>
        public IEnumerable <MAccount> QueryAccountByPaging(TAccountCondition condition)
        {
            this.ClearParameters();
            StringBuilder sqlCondition = new StringBuilder();

            if (!string.IsNullOrWhiteSpace(condition.AccountNo))
            {
                sqlCondition.Append(" AND AccountNo = @AccountNo ");
                this.AddParameter("@AccountNo", condition.AccountNo);
            }
            if (!string.IsNullOrWhiteSpace(condition.AccountName))
            {
                sqlCondition.Append(" AND AccountName = @AccountName ");
                this.AddParameter("@AccountName", condition.AccountName);
            }

            if (condition.GetRowsCount)
            {
                string sqlCount = "SELECT COUNT(0) FROM Account WHERE 1 = 1 " + sqlCondition + ";";
                object obj      = this.ExecuteScalar(sqlCount);
                condition.RowsCount = obj == null ? 0 : Convert.ToInt32(obj);
            }

            string sqlData = string.Format("SELECT TOP {0} * FROM Account WHERE Id NOT IN( SELECT TOP {1} Id  FROM Account);", condition.PageSize, condition.StratRows);

            return(this.BuildEntitiesFromSql(sqlData));
        }
示例#2
0
        /// <summary>
        /// 用户分页查询
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <returns>结果</returns>
        public IEnumerable <MAccount> QueryAccountByPaging(TAccountCondition condition)
        {
            this.ClearParameters();
            StringBuilder sqlCondition = new StringBuilder();

            if (!string.IsNullOrWhiteSpace(condition.AccountNo))
            {
                sqlCondition.Append(" AND AccountNo = @AccountNo ");
                this.AddParameter("@AccountNo", condition.AccountNo);
            }
            if (!string.IsNullOrWhiteSpace(condition.AccountName))
            {
                sqlCondition.Append(" AND AccountName = @AccountName ");
                this.AddParameter("@AccountName", condition.AccountName);
            }

            if (condition.GetRowsCount)
            {
                string sqlCount = "SELECT COUNT(0) FROM Account WHERE 1 = 1 " + sqlCondition + ";";
                object obj      = this.ExecuteScalar(sqlCount);
                condition.RowsCount = obj == null ? 0 : Convert.ToInt32(obj);
            }

            string sqlData = "SELECT * FROM Account WHERE 1 = 1 " + sqlCondition + " ORDER BY IsAdmin DESC, CreateTime DESC  OFFSET @StratRows ROWS FETCH NEXT @PageSize ROWS ONLY;";

            this.AddParameter("@StratRows", condition.StratRows);
            this.AddParameter("@PageSize", condition.PageSize);
            return(this.BuildEntitiesFromSql(sqlData));
        }
示例#3
0
 /// <summary>
 /// 用户分页查询
 /// </summary>
 /// <param name="condition">查询条件</param>
 /// <returns>结果</returns>
 public static IEnumerable <TAccount> QueryAccountByPagings(TAccountCondition condition)
 {
     using (var accountesRepository = DbContext.CreateIAccountesRepository())
     {
         var data = accountesRepository.QueryAccountByPaging(condition).ToTAccounts();
         return(data);
     }
 }
示例#4
0
        public ActionResult UserListVal(TAccountCondition condition)
        {
            var data = AccountService.QueryAccountByPaging(condition);

            return(new MyJsonResult {
                Data = data
            });
        }
示例#5
0
 /// <summary>
 /// 用户分页查询
 /// </summary>
 /// <param name="condition">查询条件</param>
 /// <returns>结果</returns>
 public static EsayUIQueryResult <TAccount> QueryAccountByPaging(TAccountCondition condition)
 {
     using (var accountesRepository = DbContext.CreateIAccountesRepository())
     {
         var data = accountesRepository.QueryAccountByPaging(condition).ToTAccounts();
         EsayUIQueryResult <TAccount> roles = new EsayUIQueryResult <TAccount>
         {
             rows  = data,
             total = condition.RowsCount
         };
         return(roles);
     }
 }
示例#6
0
 /// <summary>
 /// 用户分页查询
 /// </summary>
 /// <param name="condition">查询条件</param>
 /// <returns>结果</returns>
 public static QueryResult <TAccount> QueryAccountByPaging(TAccountCondition condition)
 {
     using (var accountesRepository = DbContext.CreateIAccountesRepository())
     {
         var data = accountesRepository.QueryAccountByPaging(condition).ToTAccounts();
         QueryResult <TAccount> roles = new QueryResult <TAccount>
         {
             Data   = data,
             Paging = condition.Paging
         };
         return(roles);
     }
 }
示例#7
0
 /// <summary>
 /// 用户列表
 /// </summary>
 /// <returns>结果</returns>
 public IActionResult UserList(TAccountCondition condition)
 {
     if (condition != null)
     {
         //var data = AccountService.QueryAccountByPagings(condition);
         //PagedList<TAccount> pageList = new PagedList<TAccount>(data, condition.PageIndex, condition.PageSize, condition.RowsCount);
         //ViewModel<TAccountCondition, PagedList<TAccount>> result = new ViewModel<TAccountCondition, PagedList<TAccount>>
         //{
         //    Condition = condition,
         //    Data = pageList
         //};
         return(this.View());
     }
     else
     {
         return(this.View());
     }
 }
示例#8
0
        public IActionResult UserListVal([FromBody] TAccountCondition condition)
        {
            var data = AccountService.QueryAccountByPaging(condition);

            return(MyJson(data));
        }