示例#1
0
        public int GetCount(SearchSpecCP searchSpec)
        {
            var queryBuilder = new AdvancedSearchQueryBuilder(searchSpec.AdvancedSearchCriteria.ToList());

            var where = WhereAnd(queryBuilder.RawSql, searchSpec);
            var orderBy    = queryBuilder.OrderBy(searchSpec);
            var offSet     = queryBuilder.OffsetQuery(searchSpec);
            var parameters = (DynamicParameters)queryBuilder.Parameters;

            parameters.Add("ProjectNumber", searchSpec.ProjectNumber);
            parameters.Add("searchValue", "%" + searchSpec.SearchText + "%");
            var sql = $"select Count(1) from Wbs {where}";

            return(_context.Connection.ExecuteScalar <int>(sql, parameters));
        }
示例#2
0
        public IEnumerable <WbsCP> GetWbs(SearchSpecCP searchSpec)
        {
            var queryBuilder = new AdvancedSearchQueryBuilder(searchSpec.AdvancedSearchCriteria.ToList());

            var where = WhereAnd(queryBuilder.RawSql, searchSpec);
            var orderBy    = queryBuilder.OrderBy(searchSpec);
            var offSet     = queryBuilder.OffsetQuery(searchSpec);
            var parameters = (DynamicParameters)queryBuilder.Parameters;

            parameters.Add("ProjectNumber", searchSpec.ProjectNumber);
            parameters.Add("searchValue", "%" + searchSpec.SearchText + "%");
            var sql = $"select * from Wbs {where} {orderBy} {offSet}";

            return(_context.Connection.Query <WbsCP>(sql, parameters));
        }