예제 #1
0
파일: ZzBS.cs 프로젝트: bnhomework/zzzs
        public PageResult <ZZDesign> GetDesginList(PageSearch <DesginQuery> condition)
        {
            using (var db = GetDbContext())
            {
                var prd = PredicateBuilder.New <ZZ_Desgin>(x => x.CustomerId == condition.q.OpenId);

                var items = from d in db.ZZ_Desgin.AsExpandable().Where(prd)
                            join t in db.ZZ_Template on d.TemplateId equals t.TemplateId
                            join c in db.ZZ_Category on t.Category equals c.CategoryId
                            join u in db.ZY_Customer on d.CustomerId equals u.OpenId
                            orderby d.CreatedTime descending
                            select new ZZDesign()
                {
                    Id             = d.DesginId,
                    TemplateId     = d.TemplateId,
                    CustomerId     = d.CustomerId,
                    Name           = d.Name,
                    Tags           = d.Tags,
                    Preview1       = d.Preview1,
                    Preview2       = d.Preview2,
                    UnitPrice      = c.UnitPrice,
                    Designer       = u.UserName,
                    DesignerAvatar = u.Avatar,
                    IsPublic       = d.IsPublic,
                    Follows        = db.ZZ_DesginFollow.Count(x => x.DesginId == d.DesginId),
                };
                var lists = items //.OrderBy(u => u.CreatedTime)
                            .Skip(condition.SkipCount)
                            .Take(condition.pageSize)
                            .ToList();
                var total = items.Count();
                return(new PageResult <ZZDesign>(lists, total));
            }
        }
예제 #2
0
        public static PageSearch <T> Build <T>(HttpRequestBase Request, T condition)
        {
            var ps = new PageSearch <T>();

            ps.pageIndex = int.Parse(Request.Params["page"] ?? "1");
            ps.pageSize  = int.Parse(Request.Params["pageSize"] ?? "20");
            ps.q         = condition;
            return(ps);
        }
예제 #3
0
        public async Task <PageDate <T> > GetPageDate <T>(PageSearch pageSearch) where T : class
        {
            var result = new PageDate <T>();

            result.Data = await GlobalIFreeSql.Select <T>().Count(out var total).Page(pageSearch.PageIndex, pageSearch.PageSize).ToListAsync();

            result.TotalCount = Convert.ToInt32(total);
            result.PageIndex  = pageSearch.PageIndex;
            result.PageSize   = pageSearch.PageSize;
            return(result);
        }
예제 #4
0
        public void Delete(PageSearch request)
        {
            var matches = Get(request) as List <Page>;

            if (true != matches?.Any())
            {
                throw new HttpError(HttpStatusCode.NotFound, "No matches for request");
            }
            matches.ForEach(match =>
            {
                Delete(match);
            });
        }
        public PagedListData <List <SysOperationLog> > GetListByQuery(QueryOperationLogModel query)
        {
            var model = new PageListModel()
            {
                WithColumn = @"[Id]
                              ,[AccessChannelId]
                              ,[UserId]
                              ,[CustomerId]
                              ,[ClientIpAddress]
                              ,[MenuName]
                              ,[MenuId]
                              ,[MenuActionId]
                              ,[MenuActionName]
                              ,[ServiceName]
                              ,[FunctionController]
                              ,[MethodAction]
                              ,[Parameters]
                              ,[ExecutionTime]
                              ,[ExecutionDuration]
                              ,[ClientName]
                              ,[BrowserInfo]
                              ,[Exception]
                              ,[Description]
                              ,[SourceEquipment]
                              ,[CustomData]
                              ,[IPNum]
                              ,[Token]
                              ,[Navigator]
                              ,[RequestUri]
                              ,[UrlReferrer]
                              ,[RequestType]
                              ,[Enabled]
                              ,[InUser]
                              ,[InDate]
                              ,[DelUser]
                              ,[DelState]
                              ,[DelDate]",
                WithWhere  = " 1=1",
                LeftColumn = " B.UserName",
                LeftJoin   = " Left join SysUser B on  A.UserId =B.Id",
            };
            var pageSearch = new PageSearch()
            {
                OrderBy   = query.OrderBy,
                PageIndex = query.PageIndex,
                PageSize  = query.PageSize,
                Where     = query.Where
            };

            return(this.PagedListQuery(model, pageSearch));
        }
예제 #6
0
        /// <summary>
        /// Скачивает полную информацию по трекам в отдельном потоке.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void LoadTraksThread(object sender, EventArgs e)
        {
            //Создние нового процесса.
            ThreadPool.QueueUserWorkItem((object o) =>
            {
                if (PageSearch.GetElement(PageSearch.TextErrorFindBy) == null)
                {
                    ListArtists   = Browser.FindElements(PageSearch.TextArtistBy).ToList();
                    ListTracks    = Browser.FindElements(PageSearch.TextTrackBy).ToList();
                    ListDurations = Browser.FindElements(PageSearch.TextDurationBy).ToList();
                    ListDownloads = Browser.FindElements(PageSearch.IconDownloadBy).ToList();
                    ListPlays     = Browser.FindElements(PageSearch.IconPlayBy).ToList();

                    for (int i = 0; i < ListArtists.Count; i++)
                    {
                        int durationTrack = mainForm.TimeStringToInt(ListDurations[i].Text);

                        if ((durationTrack < mainForm.DurationSetUser) || (mainForm.DurationSetUser == -1))
                        {
                            TrackOptions trackOptions = new TrackOptions(
                                i,
                                ListArtists[i].Text,
                                ListTracks[i].Text,
                                ListDurations[i].Text,
                                ListDownloads[i].GetAttribute("href"),
                                ListTracks[i].Text + ".mp3");
                            ListTrackOptions.Add(trackOptions);
                        }
                    }

                    //Обращение к элементам формы основного потока и закрытие прелоадера в основном потоке.
                    mainForm.Invoke(new MethodInvoker(() =>
                    {
                        mainForm.ShowFromSiteToForm(this.ListTrackOptions, mainForm.GetPanelResult(), mainForm.SetCountShowTracks());
                        formPreloaderTracks.Close();
                    }));
                }
                else
                {
                    //Обращение к элементам формы основного потока и закрытие прелоадера в основном потоке.
                    mainForm.Invoke(new MethodInvoker(() =>
                    {
                        mainForm.ShowFromSiteToForm(this.ListTrackOptions, mainForm.GetPanelResult(), mainForm.SetCountShowTracks());
                        formPreloaderTracks.Close();
                    }));

                    MessageBox.Show("Запрашиваемые треки не найдены");
                }
            });
        }
예제 #7
0
        public WebpageReaderTests()
        {
            ContentExtractionStrategyFactory contentExtractionStrategyFactory = new ContentExtractionStrategyFactory();

            INodeContentExtractionStrategy extractContentAttribute =
                contentExtractionStrategyFactory.ExtractAttributeByName("content");
            INodeContentExtractionStrategy extractInnerText =
                contentExtractionStrategyFactory.ExtractInnerText();

            _webpageTitleSearch = PageSearch.NewBuilder()
                                  .AddSearchCriteria("/html/head/meta[@property='og:title']", extractContentAttribute)
                                  .AddSearchCriteria("/html/head/meta[@name='twitter:title']", extractContentAttribute)
                                  .AddSearchCriteria("/html/head/title", extractInnerText)
                                  .SetDefault("Untitled")
                                  .Build();
        }
예제 #8
0
        public PagedListData <List <SysExceptionLog> > GetListByQuery(QueryExceptionLogModel query)
        {
            var model = new PageListModel()
            {
                WithColumn = @"[Id]
                              ,[AccessChannelId]
                              ,[UserId]
                              ,[CustomerId]
                              ,[ExceptionDate]
                              ,[ExceptionFunction]
                              ,[ExceptionVersions]
                              ,[ExceptionSource]
                              ,[ExceptionDescription]
                              ,[ExceptionStackTrace]
                              ,[ExceptionType]
                              ,[ExceptionTargetSite]
                              ,[ExceptionTypeName]
                              ,[ExceptionIP]
                              ,[IPNum]
                              ,[ComputerName]
                              ,[ExploreName]
                              ,[ExplorerVersions]
                              ,[SourceEquipment]
                              ,[Enabled]
                              ,[InUser]
                              ,[InDate]
                              ,[DeleteState]
                              ,[DeleteUser]
                              ,[DeleteDate]",
                WithWhere  = " 1=1",
                LeftColumn = " B.UserName",
                LeftJoin   = " Left join SysUser B on  A.UserId =B.Id",
            };
            var pageSearch = new PageSearch()
            {
                OrderBy   = query.OrderBy,
                PageIndex = query.PageIndex,
                PageSize  = query.PageSize,
                Where     = query.Where
            };

            return(this.PagedListQuery(model, pageSearch));
        }
예제 #9
0
 public ResponseResult <PagedListData <List <ShipInfo> > > GetPage(PageSearch page)
 {
     try
     {
         var service = GetService <ShipInfoService>();
         var result  = service.GetPage(page);
         if (result.PagingData != null && result.PagingData.Any())
         {
             foreach (var item in result.PagingData)
             {
                 item.PlatName = EnumHelper.GetEnumByValue <ApiPlatform>(item.Plat).GetDescription();
             }
         }
         return(ResponseResult <PagedListData <List <ShipInfo> > > .GenSuccessResponse(result));
     }
     catch (Exception ex)
     {
         return(ResponseResult <PagedListData <List <ShipInfo> > > .GenFaildResponse(ex.Message));
     }
 }
예제 #10
0
        public PagedListData <List <SysLoginLog> > GetListByQuery(QueryLoginLogModel query)
        {
            var model = new PageListModel()
            {
                WithColumn = @"[Id]
                              ,[AccessChannelId]
                              ,[UserId]
                              ,[UserName]
                              ,[LogDate]
                              ,[Token]
                              ,[LogOutDate]
                              ,[ClientIpAddress]
                              ,[ClientName]
                              ,[OnlineDate]
                              ,[IsSucceed]
                              ,[LogReason]
                              ,[SessionId]
                              ,[InUserType]
                              ,[IPNum]
                              ,[Enabled]
                              ,[DelUser]
                              ,[DelState]
                              ,[DelDate]",
                WithWhere  = " 1=1",
                LeftColumn = string.Empty,
                LeftJoin   = string.Empty,
            };


            var pageSearch = new PageSearch()
            {
                OrderBy   = " LogDate desc",
                PageIndex = query.PageIndex,
                PageSize  = query.PageSize,
                Where     = query.Where
            };

            return(this.PagedListQuery(model, pageSearch));
        }
예제 #11
0
        /// <summary>
        /// 获取分页
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagedListData <List <ShipInfo> > GetPage(PageSearch query)
        {
            var model = new PageListModel()
            {
                WithColumn = @"Id
                              ,UserId
                              ,Code
                              ,Name
                              ,Plat
                              ,Description
                              ,AppKey
                              ,AppSecret
                              ,DeliveryAddress
                              ,InDate
                              ,Contract
                              ,Status
                              ,Remark",
                WithWhere  = " Status=1 ",
                LeftColumn = " B.UserName",
                LeftJoin   = @" LEFT JOIN SysUser B ON A.UserId=B.Id ",
            };

            return(this.PagedListQuery(model, query));
        }
예제 #12
0
        private IQueryable <DocEntityPage> _ExecSearch(PageSearch request, DocQuery query)
        {
            request = InitSearch <Page, PageSearch>(request);
            IQueryable <DocEntityPage> entities = null;

            query.Run(session =>
            {
                entities = query.SelectAll <DocEntityPage>();
                if (!DocTools.IsNullOrEmpty(request.FullTextSearch))
                {
                    var fts  = new PageFullTextSearch(request);
                    entities = GetFullTextSearch <DocEntityPage, PageFullTextSearch>(fts, entities);
                }

                if (null != request.Ids && request.Ids.Any())
                {
                    entities = entities.Where(en => en.Id.In(request.Ids));
                }

                if (!DocTools.IsNullOrEmpty(request.Updated))
                {
                    entities = entities.Where(e => null != e.Updated && e.Updated.Value.Date == request.Updated.Value.Date);
                }
                if (!DocTools.IsNullOrEmpty(request.UpdatedBefore))
                {
                    entities = entities.Where(e => null != e.Updated && e.Updated <= request.UpdatedBefore);
                }
                if (!DocTools.IsNullOrEmpty(request.UpdatedAfter))
                {
                    entities = entities.Where(e => null != e.Updated && e.Updated >= request.UpdatedAfter);
                }
                if (!DocTools.IsNullOrEmpty(request.Created))
                {
                    entities = entities.Where(e => null != e.Created && e.Created.Value.Date == request.Created.Value.Date);
                }
                if (!DocTools.IsNullOrEmpty(request.CreatedBefore))
                {
                    entities = entities.Where(e => null != e.Created && e.Created <= request.CreatedBefore);
                }
                if (!DocTools.IsNullOrEmpty(request.CreatedAfter))
                {
                    entities = entities.Where(e => null != e.Created && e.Created >= request.CreatedAfter);
                }
                if (true == request.Archived?.Any() && currentUser.HasProperty(DocConstantModelName.PAGE, nameof(Reference.Archived), DocConstantPermission.VIEW))
                {
                    entities = entities.Where(en => en.Archived.In(request.Archived));
                }
                else
                {
                    entities = entities.Where(en => !en.Archived);
                }
                if (true == request.Locked?.Any())
                {
                    entities = entities.Where(en => en.Locked.In(request.Locked));
                }
                if (true == request.AppsIds?.Any())
                {
                    entities = entities.Where(en => en.Apps.Any(r => r.Id.In(request.AppsIds)));
                }
                if (!DocTools.IsNullOrEmpty(request.Description))
                {
                    entities = entities.Where(en => en.Description.Contains(request.Description));
                }
                if (!DocTools.IsNullOrEmpty(request.Descriptions))
                {
                    entities = entities.Where(en => en.Description.In(request.Descriptions));
                }
                if (true == request.GlossaryIds?.Any())
                {
                    entities = entities.Where(en => en.Glossary.Any(r => r.Id.In(request.GlossaryIds)));
                }
                if (true == request.HelpIds?.Any())
                {
                    entities = entities.Where(en => en.Help.Any(r => r.Id.In(request.HelpIds)));
                }
                if (!DocTools.IsNullOrEmpty(request.Name))
                {
                    entities = entities.Where(en => en.Name.Contains(request.Name));
                }
                if (!DocTools.IsNullOrEmpty(request.Names))
                {
                    entities = entities.Where(en => en.Name.In(request.Names));
                }
                if (true == request.RolesIds?.Any())
                {
                    entities = entities.Where(en => en.Roles.Any(r => r.Id.In(request.RolesIds)));
                }

                entities = ApplyFilters <DocEntityPage, PageSearch>(request, entities);

                if (request.Skip > 0)
                {
                    entities = entities.Skip(request.Skip.Value);
                }
                if (request.Take > 0)
                {
                    entities = entities.Take(request.Take.Value);
                }
                if (true == request?.OrderBy?.Any())
                {
                    entities = entities.OrderBy(request.OrderBy);
                }
                if (true == request?.OrderByDesc?.Any())
                {
                    entities = entities.OrderByDescending(request.OrderByDesc);
                }
            });
            return(entities);
        }
예제 #13
0
 public object Get(PageSearch request) => GetSearchResultWithCache <Page, DocEntityPage, PageSearch>(DocConstantModelName.PAGE, request, _ExecSearch);
예제 #14
0
 public object Post(PageSearch request) => Get(request);
예제 #15
0
        /// <summary>
        /// 分页查询,传入参数
        /// </summary>
        /// <param name="obj">分页条件</param>
        /// <param name="info">查询条件</param>
        /// <returns></returns>
        public PagedListData <List <T> > PagedListQuery(PageListModel obj, PageSearch info)
        {
            if (IsConnection())
            {
                var sql = $@"DECLARE @Sql NVARCHAR(MAX);
                       DECLARE @Order NVARCHAR(200);      
                       IF ( @OrderBy IS NOT  NULL AND  @OrderBy<>'')
                            BEGIN
				                SET @Order = 'ORDER BY ' + @OrderBy;
                            END;
                       ELSE
                            BEGIN
                                SET @Order = '  ORDER BY InDate DESC ';
                            END;
                       IF ( @Where IS  NULL)
                            BEGIN
				                SET @Where = '';
                            END;
                       SET @Sql = N' 
                   WITH  Select_List  AS
                   (
					   SELECT  ROW_NUMBER() OVER ( ' + @Order + ' ) RowNumber,
                        {obj.WithColumn}
                        FROM {GetTableName()}
						WHERE {obj.WithWhere} ' + @Where + '
                  )
                  SELECT
			          A.* "            ;
                sql += !string.IsNullOrWhiteSpace(obj.LeftColumn) ? $@",{obj.LeftColumn}" : "";

                sql += $@" FROM Select_List A 
                  {obj.LeftJoin}
                  WHERE (RowNumber BETWEEN ( @PageSize * ( @CurrentPageIndex - 1 ) + 1 )  AND  @PageSize * @CurrentPageIndex )
          
                 SELECT @Count = COUNT(1) FROM {GetTableName()} WHERE {obj.WithWhere} ' + @Where;              
                       EXECUTE sp_executesql @Sql,N' 
                       @CurrentPageIndex INT,
                       @PageSize  INT,
                       @Where NVARCHAR(1000),
                       @OrderBy NVARCHAR(200),         
                       @Count int OUT',
                       @CurrentPageIndex,
			           @PageSize,
                       @Where,
                       @OrderBy,
                       @Count OUTPUT; ";

                var model = new PagedListData <List <T> >();
                var dp    = new DynamicParameters();
                dp.Add("@CurrentPageIndex", info.PageIndex);
                dp.Add("@PageSize", info.PageSize);
                dp.Add("@Where", info.Where);
                dp.Add("@OrderBy", info.OrderBy);
                dp.Add("@Count", 0, DbType.Int32, ParameterDirection.Output);
                var data     = this.Query(sql, dp);
                var pageInfo = new PagingInfo(info.PageSize, info.PageIndex);
                if (data != null)
                {
                    model.PagingData    = data.ToList();
                    pageInfo.TotalCount = dp.Get <int>("@Count");
                    model.PagingInfo    = pageInfo;
                }
                else
                {
                    model.PagingData    = new List <T>();
                    pageInfo.TotalCount = 0;
                    model.PagingInfo    = pageInfo;
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #16
0
        public static PageResponse <TDto> Paged <TDto, TEntity>(this IQueryable <TEntity> query, PageSearch search, IMapper mapper) where TDto : class
        {
            var skipCount = search.PerPage * (search.Page - 1);

            var skipped  = query.Skip(skipCount).Take(search.PerPage);
            var response = new PageResponse <TDto>
            {
                CurrentPage  = search.Page,
                ItemsPerPage = search.PerPage,
                TotalCount   = query.Count(),
                Items        = mapper.Map <IEnumerable <TDto> >(skipped)
            };

            return(response);
        }
예제 #17
0
 /// <summary>
 /// 获取分页
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public PagedListData <List <ShipInfo> > GetPage(PageSearch query)
 {
     return(this._ShipInfoRepository.GetPage(query));
 }