当前位置: 首页>>代码示例>>C#>>正文


C# SearchResult.SetPage方法代码示例

本文整理汇总了C#中SearchResult.SetPage方法的典型用法代码示例。如果您正苦于以下问题:C# SearchResult.SetPage方法的具体用法?C# SearchResult.SetPage怎么用?C# SearchResult.SetPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchResult的用法示例。


在下文中一共展示了SearchResult.SetPage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SearchNews

 public SearchResult<tblNew> SearchNews(int pageSize, int page, String sortColunm, String sortOption)
 {
   SearchResult<tblNew> searchResult = new SearchResult<tblNew>();
   var query1 = _dataContext.tblNews.Where("Title!=null");
   var query = query1;
   if (sortColunm == "Title")
   {
     if (sortOption == ABDHFramework.Data.SortOption.Desc.ToString())
     {
       query = _dataContext.tblNews
         .Where("Title!=null")
         .OrderByDescending(o => o.Title)
         .Take(pageSize * page)
         .Skip((page - 1) * pageSize)
         ;
     }
     else
     {
       query = _dataContext.tblNews
         .Where("Title!=null")
         .OrderBy(o => o.Title)
         .Take(pageSize * page)
         .Skip((page - 1) * pageSize)
         ;
     }
   }
   else
   {
       query = _dataContext.tblNews
       .Where("Title!=null")
       .Take(pageSize * page)
       .Skip((page - 1) * pageSize);
   }
   if (query != null && query1 != null && query.ToList().Count > 0)
   {
     searchResult.Items = query.ToList();
     searchResult.Query = query;
     searchResult.SetMaxResults(pageSize);
     searchResult.SetPage(page);
     searchResult.TotalRows = query1.Count();
   }
   return searchResult;
 }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:43,代码来源:ABDHFrameworkDA.cs

示例2: GetAllProduct

 public SearchResult<tblProduct> GetAllProduct(int pageSize, int page,byte language, String criteria, String sortColunm, String sortOption)
 {
   SearchResult<tblProduct> searchResult = new SearchResult<tblProduct>();
   
     var query1 = _dataContext.tblProducts.Where(item => item.ProductName.Contains(criteria) && item.Language.HasValue && item.Language.Value.Equals(language));
     var query = query1;
     if (sortOption == "Desc")
     {
         query = _dataContext.tblProducts.Where(item => item.ProductName.Contains(criteria) && item.Language.HasValue && item.Language.Value.Equals(language)).Take(pageSize * page).Skip((page - 1) * pageSize).OrderBy(item=>item.ProductName);
     }
     else
     {
         query = _dataContext.tblProducts.Where(item => item.ProductName.Contains(criteria) && item.Language.HasValue && item.Language.Value.Equals(language)).Take(pageSize * page).Skip((page - 1) * pageSize).OrderByDescending(item=>item.ProductName);
     }
     if (query != null && query1 != null && query.ToList().Count > 0)
     {
       searchResult.Items = query.ToList();
       searchResult.Query = query;
       searchResult.SetMaxResults(pageSize);
       searchResult.SetPage(page);
       searchResult.TotalRows = query1.Count();
     }
   
   return searchResult;
 }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:25,代码来源:ABDHFrameworkDA.cs

示例3: GetAllProductByCategory

        public SearchResult<tblProduct> GetAllProductByCategory(int pageSize, int page, Guid? categoryID)
        {
            SearchResult<tblProduct> searchResult = new SearchResult<tblProduct>();

            var query1 = _dataContext.tblProducts.Where("CategoryID.HasValue and CategoryID.Value.ToString()[email protected]", ((Guid)categoryID).ToString());
            var query = _dataContext.tblProducts.Where("CategoryID.HasValue and CategoryID.Value.ToString()[email protected]", ((Guid)categoryID).ToString()).Take(pageSize * page).Skip((page - 1) * pageSize);
            if (query != null && query1 != null && query.ToList().Count > 0)
            {
                searchResult.Items = query.ToList();
                searchResult.Query = query;
                searchResult.SetMaxResults(pageSize);
                searchResult.SetPage(page);
                searchResult.TotalRows = query1.Count();
            }

            return searchResult;
        }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:17,代码来源:ABDHFrameworkDA.cs

示例4: GetAllCategory

        public SearchResult<tblCategory> GetAllCategory(int pageSize, int page, bool isEN, string criteria, String sortColunm, String sortOption)
        {
            isEN = false;
            SearchResult<tblCategory> searchResult = new SearchResult<tblCategory>();
            if (!isEN)
            {
              var query1 = _dataContext.tblCategories.Where("CategoryName!=null");
                var query = query1;
                if (sortColunm == "CategoryName")
                {
                  if (sortOption == ABDHFramework.Data.SortOption.Desc.ToString())
                  {
                    query = _dataContext.tblCategories
                    .Where(op => op.CategoryName.Contains(criteria))
                    .OrderByDescending(o => o.CategoryName)
                    .Take(pageSize * page)
                    .Skip((page - 1) * pageSize)
                    ;
                  }
                  else
                  {
                    query = _dataContext.tblCategories
                   .Where(op => op.CategoryName.Contains(criteria))
                   .OrderBy(o => o.CategoryName)
                   .Take(pageSize * page)
                   .Skip((page - 1) * pageSize)
                   ;
                  }
                  
                  
                }
                else
                {

                    query = _dataContext.tblCategories
                    .Where(op => op.CategoryName.Contains(criteria))
                    .OrderByDescending(o => o.CategoryName)
                    .Take(pageSize * page)
                    .Skip((page - 1) * pageSize)
                    ;
                }
                if (query != null && query1 != null && query.ToList().Count > 0)
                {
                  searchResult.Items = query.ToList();
                  searchResult.Query = query;
                  searchResult.SetMaxResults(pageSize);
                  searchResult.SetPage(page);
                  searchResult.TotalRows = query1.Count();
                }
            }
            else
            {
                var query1 = _dataContext.tblCategories.Where("CategoryName!=null");
                var query = _dataContext.tblCategories.Where("CategoryName!=null").Take(pageSize * page).Skip((page - 1) * pageSize);
                if (query != null && query1 != null && query.ToList().Count > 0)
                {
                    searchResult.Items = query.ToList();
                    searchResult.Query = query;
                    searchResult.SetMaxResults(pageSize);
                    searchResult.SetPage(page);
                    searchResult.TotalRows = query1.Count();
                }
            }
            return searchResult;
        }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:65,代码来源:ABDHFrameworkDA.cs

示例5: GetAllProduct

 public SearchResult<tblProduct> GetAllProduct(int pageSize, int page,bool isEN)
 {
     SearchResult<tblProduct> searchResult = new SearchResult<tblProduct>();
     if (isEN)
     {
         var query1 = _dataContext.tblProducts.Where("ProductNameEN!=null");
         var query = _dataContext.tblProducts.Where("ProductNameEN!=null").Take(pageSize * page).Skip((page - 1) * pageSize);
         if (query != null && query1 != null && query.ToList().Count > 0)
         {
             searchResult.Items = query.ToList();
             searchResult.Query = query;
             searchResult.SetMaxResults(pageSize);
             searchResult.SetPage(page);
             searchResult.TotalRows = query1.Count();
         }
     }
     else
     {
         var query1 = _dataContext.tblProducts.Where("ProductNameVN!=null");
         var query = _dataContext.tblProducts.Where("ProductNameVN!=null").Take(pageSize * page).Skip((page - 1) * pageSize);
         if (query != null && query1 != null && query.ToList().Count > 0)
         {
             searchResult.Items = query.ToList();
             searchResult.Query = query;
             searchResult.SetMaxResults(pageSize);
             searchResult.SetPage(page);
             searchResult.TotalRows = query1.Count();
         }
     }
     return searchResult;
 }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:31,代码来源:NguyenHiepDA.cs

示例6: GetAllNews

 public SearchResult<tblNew> GetAllNews(int pageSize, int page,byte type,bool isEN)
 {
     SearchResult<tblNew> searchResult = new SearchResult<tblNew>();
     if (!isEN)
     {
         var query1 = _dataContext.tblNews.Where("[email protected] and SubjectVN!=null", type);
         var query = _dataContext.tblNews.Where("[email protected] and SubjectVN!=null", type).Take(pageSize * page).Skip((page - 1) * pageSize);
         if (query != null && query1 != null && query.ToList().Count > 0)
         {
             searchResult.Items = query.ToList();
             searchResult.Query = query;
             searchResult.SetMaxResults(pageSize);
             searchResult.SetPage(page);
             searchResult.TotalRows = query1.Count();
         }
     }
     else
     {
         var query1 = _dataContext.tblNews.Where("[email protected] and SubjectEN!=null", type);
         var query = _dataContext.tblNews.Where("[email protected] and SubjectEN!=null", type).Take(pageSize * page).Skip((page - 1) * pageSize);
         if (query != null && query1 != null && query.ToList().Count > 0)
         {
             searchResult.Items = query.ToList();
             searchResult.Query = query;
             searchResult.SetMaxResults(pageSize);
             searchResult.SetPage(page);
             searchResult.TotalRows = query1.Count();
         }
     }
     return searchResult;
 }
开发者ID:nahmedsoftsource,项目名称:framework-abdh,代码行数:31,代码来源:NguyenHiepDA.cs


注:本文中的SearchResult.SetPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。