Пример #1
0
        public AnyServiceConfig()
        {
            MaxMultipartBoundaryLength = 50;
            ErrorEventKey             = LoggingEvents.UnexpectedException.Name;
            MaxValueCount             = 25;
            DefaultPaginationSettings = new PaginationSettings
            {
                DefaultOrderBy   = nameof(IEntity.Id),
                DefaultOffset    = 0,
                DefaultPageSize  = 50,
                DefaultSortOrder = PaginationSettings.Asc,
            };
            FilterFactoryType         = typeof(DefaultFilterFactory);
            ModelPrepararType         = typeof(DummyModelPreparar <>);
            ServiceResponseMapperType = typeof(DataOnlyServiceResponseMapper);
            AuditSettings             = new AuditSettings
            {
                AuditRules = new AuditRules
                {
                    AuditCreate = true,
                    AuditRead   = true,
                    AuditUpdate = true,
                    AuditDelete = true,
                }
            };

            UseLogRecordEndpoint = true;
            UseErrorEndpointForExceptionHandling = true;
            MapperName = "default";
        }
Пример #2
0
        public UserManager(
            IUserRepository userRepository,
            IConfirmationService confirmationService,
            PaginationSettings paginationSettings,
            IProjectMembershipRepostiory projectMembershipRepostiory,
            IMailer mailer,
            ApplicationLocationSettings applicationLocationSettings,
            IPasswordManager passwordManager,
            IEventBus eventBus)
        {
            Require.NotNull(userRepository, nameof(userRepository));
            Require.NotNull(confirmationService, nameof(confirmationService));
            Require.NotNull(paginationSettings, nameof(paginationSettings));
            Require.NotNull(projectMembershipRepostiory, nameof(projectMembershipRepostiory));
            Require.NotNull(mailer, nameof(mailer));
            Require.NotNull(applicationLocationSettings, nameof(applicationLocationSettings));
            Require.NotNull(passwordManager, nameof(passwordManager));
            Require.NotNull(eventBus, nameof(eventBus));

            _userRepository              = userRepository;
            _confirmationService         = confirmationService;
            _paginationSettings          = paginationSettings;
            _projectMembershipRepostiory = projectMembershipRepostiory;
            _mailer = mailer;
            _applicationLocationSettings = applicationLocationSettings;
            _passwordManager             = passwordManager;
            _eventBus = eventBus;
        }
Пример #3
0
        static void Main(string[] args)
        {
            Faker.PopularBase();
            var ctx = new Context();

            var t1 = ctx.TipoParte.ToList();
            var t2 = ctx.ClasseTipoParte.ToList();

            var filter = PredicateBuilder.True <ClasseTipoParte>();

            filter = filter.And(x => x.ExisteVinculo == true);
            //filter = filter.And(x => x.CodigoClasse == 1);
            var exp = filter.Compile();

            var pageSettings = new PaginationSettings();

            pageSettings.SortSettings.OrderBy = "CodigoClasse";

            var result = (from classes in ctx.ClasseTipoParte
                          join tipoparte in ctx.TipoParte
                          on 1 equals 1 into Details
                          from m in Details.DefaultIfEmpty()
                          let tp = m
                                   select  new ClasseTipoParte
            {
                CodigoClasse = classes.CodigoClasse,
                CodigoTipoParte = m.CodigoTipoParte,
                Tipo = classes.Tipo,
                TipoParte = classes.CodigoTipoParte == m.CodigoTipoParte ? tp : null,
                ExisteVinculo = classes.CodigoTipoParte == m.CodigoTipoParte ? true : false,
            }).Where(exp).AsQueryable().Page(pageSettings).ToList();

            Console.WriteLine("Hello World!");
        }
Пример #4
0
 public ProvideQueryBehaviour(RequestProviderItems providerItems, IHttpContextAccessor accessor, SemanticsDefiner semanticsDefiner)
 {
     _parameters         = providerItems.Parameters;
     _paginationSettings = providerItems.PaginationSettings;
     _httpContext        = accessor.HttpContext;
     _querySemantics     = semanticsDefiner.GetQuery <TResponse>();
 }
        public void Can_Build_Correct_Model_For_10_Items_With_2_Item_Per_Page()
        {
            // Assemble
            var expectedPagination = new List <PaginationLink>()
            {
                new PaginationLink {
                    Active = true, Text = "«", PageNumber = 2, Url = "/test/2"
                },
                new PaginationLink {
                    Active = true, Text = "1", PageNumber = 1, Url = "/test/1"
                },
                new PaginationLink {
                    Active = true, Text = "2", PageNumber = 2, Url = "/test/2"
                },
                new PaginationLink {
                    Active = true, Text = "3", PageNumber = 3, Url = "/test/3", IsCurrent = true
                },
                new PaginationLink {
                    Active = true, Text = "4", PageNumber = 4, Url = "/test/4"
                },
                new PaginationLink {
                    Active = true, Text = "5", PageNumber = 5, Url = "/test/5"
                },
                new PaginationLink {
                    Active = true, Text = "»", PageNumber = 4, Url = "/test/4"
                }
            };

            var settings = new PaginationSettings {
                CurrentPage = 3, ItemsPerPage = 2, TotalItems = 10
            };
            var builder = new PaginationLinkBuilder();

            //Act
            var result = builder.BuildPaginationLinks(
                settings,
                generateUrl,
                firstPageText,
                firstPageTitle,
                previousPageText,
                previousPageTitle,
                nextPageText,
                nextPageTitle,
                lastPageText,
                lastPageTitle,
                spacerText);


            //Assert
            Assert.Equal(expectedPagination.Count, result.Count);
            PaginationComparer comparer = new PaginationComparer();

            for (int i = 0; i < expectedPagination.Count; i++)
            {
                Assert.Equal(expectedPagination[i], result[i], comparer);
            }
        }
 public BlogViewModel(IContentProcessor contentProcessor)
 {
     _contentProcessor = contentProcessor;
     ProjectSettings   = new ProjectSettings();
     Paging            = new PaginationSettings();
     Categories        = new Dictionary <string, int>();
     Archives          = new Dictionary <string, int>();
     BlogRoutes        = new DefaultBlogRoutes();
 }
Пример #7
0
 public BlogViewModel(IHtmlProcessor htmlProcessor)
 {
     ProjectSettings = new ProjectSettings();
     Paging          = new PaginationSettings();
     Categories      = new Dictionary <string, int>();
     Archives        = new Dictionary <string, int>();
     filter          = htmlProcessor;
     BlogRoutes      = new DefaultBlogRoutes();
 }
Пример #8
0
 public CategoryController(ICategoryService service,
                           IMapper mapper,
                           IHostingEnvironment environment,
                           IOptions <PaginationSettings> settings)
 {
     this.mapper      = mapper;
     this.service     = service;
     this.environment = environment;
     this.settings    = settings.Value;
 }
Пример #9
0
 public ImageController(
     IOptions <PaginationSettings> settings,
     IHostingEnvironment environment,
     IMapper mapper,
     IImageService service)
 {
     this.settings    = settings.Value;
     this.environment = environment;
     this.mapper      = mapper;
     this.service     = service;
 }
Пример #10
0
        public BlogViewModel()
        {
            ProjectSettings = new ProjectSettings();
            Paging          = new PaginationSettings();
            Categories      = new Dictionary <string, int>();
            Archives        = new Dictionary <string, int>();

            filter         = new HtmlProcessor();
            cryptoHelper   = new CryptoHelper();
            EditorSettings = new EditorModel();
            BlogRoutes     = new DefaultBlogRoutes();
        }
Пример #11
0
        /// <summary>
        /// Create a Matching UI session to search for resumes or jobs that meet specific criteria
        /// </summary>
        /// <param name="sovClient">The SovrenClient</param>
        /// <param name="indexesToQuery">The indexes to find results in. These must all be of the same type (resumes or jobs)</param>
        /// <param name="query">The search query. A result must satisfy all of these criteria</param>
        /// <param name="settings">The settings for this search request</param>
        /// <param name="pagination">Pagination settings. If not specified the default will be used</param>
        /// <exception cref="SovrenException">Thrown when an API error occurs</exception>
        public static async Task <GenerateUIResponse> Search(
            this SovrenClientWithUI sovClient,
            IEnumerable <string> indexesToQuery,
            FilterCriteria query,
            SearchMatchSettings settings  = null,
            PaginationSettings pagination = null)
        {
            SearchRequest   request   = sovClient.InternalClient.CreateRequest(indexesToQuery, query, settings, pagination);
            UISearchRequest uiRequest = new UISearchRequest(request, sovClient.UISessionOptions);

            return(await sovClient.InternalClient.UISearch(uiRequest));
        }
Пример #12
0
        public PaginationQuery(IPaginateable pagination, PaginationSettings settings)
        {
            PageNumber =
                pagination?.PageNumber < 1 ? _defaultPageNumber
                : pagination.PageNumber;

            PageSize =
                pagination.PageSize <1 ? settings.DefaultPageSize
                : pagination.PageSize> settings.MaxPageSize ? settings.MaxPageSize
                : pagination.PageSize;

            IsApplied =
                !(pagination.PageSize < 1 && pagination.PageNumber < 1);
        }
Пример #13
0
 protected string GetPaginationCommand(string command, PaginationSettings paginationSettings)
 {
     if (!string.IsNullOrEmpty(paginationSettings.Where))
     {
         command += $" WHERE {paginationSettings.Where}";
     }
     command += $" ORDER BY {paginationSettings.OrderColumn.FullName}";
     if (paginationSettings.OrderColumn.IsDesc)
     {
         command += $" DESC";
     }
     command += $" LIMIT {paginationSettings.Limit} OFFSET {paginationSettings.Offset}";
     return(command);
 }
Пример #14
0
        public ProjectProvider(
            IProjectManagerGateway projectManagerGateway,
            IVersionControlSystemGateway versionControlSystemGateway,
            IProjectRepository projectRepository,
            IEventSink eventSink,
            IUserRepository userRepository,
            PaginationSettings paginationSettings, IssuePaginationSettings issuePaginationSettings)
        {
            Require.NotNull(projectManagerGateway, nameof(projectManagerGateway));
            Require.NotNull(versionControlSystemGateway, nameof(versionControlSystemGateway));
            Require.NotNull(projectRepository, nameof(projectRepository));
            Require.NotNull(eventSink, nameof(eventSink));
            Require.NotNull(userRepository, nameof(userRepository));
            Require.NotNull(paginationSettings, nameof(paginationSettings));

            _projectManagerGateway = projectManagerGateway;
            _versionControlSystemGateway = versionControlSystemGateway;
            _projectRepository = projectRepository;
            _eventSink = eventSink;
            _userRepository = userRepository;
            _paginationSettings = paginationSettings;
            _issuePaginationSettings = issuePaginationSettings;
        }
Пример #15
0
        protected string GetPaginationByLastIdCommand(string command, string fromTableName, Guid?id,
                                                      PaginationSettings paginationSettings)
        {
            if (id.HasValue)
            {
                command += $" WHERE (({paginationSettings.OrderColumn.FullName}) ";
                if (paginationSettings.OrderColumn.IsDesc)
                {
                    command += "<";
                }
                else
                {
                    command += ">";
                }
                command +=
                    $" (SELECT ({paginationSettings.OrderColumn.FullName}) FROM {fromTableName} WHERE id='{id}'))";

                if (!string.IsNullOrEmpty(paginationSettings.Where))
                {
                    command += $" AND ({paginationSettings.Where})";
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(paginationSettings.Where))
                {
                    command += $" WHERE {paginationSettings.Where}";
                }
            }
            command += $" ORDER BY {paginationSettings.OrderColumn.FullName}";
            if (paginationSettings.OrderColumn.IsDesc)
            {
                command += $" DESC";
            }
            command += $" LIMIT {paginationSettings.Limit}";
            return(command);
        }
 public PagedContentListViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #17
0
 public ProductPagingViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #18
0
        protected override void Render(Microsoft.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
        {
            PaginationSettings paginationSettings = new PaginationSettings(report, deviceInfo);

            paginationSettings.UseEmSquare       = true;
            paginationSettings.MeasureTextDpi    = 1000;
            paginationSettings.UseGenericDefault = false;
            if (paginationSettings.DynamicImageDpiX == 96)
            {
                paginationSettings.DynamicImageDpiX = 300;
            }
            if (paginationSettings.DynamicImageDpiY == 96)
            {
                paginationSettings.DynamicImageDpiY = 300;
            }
            BufferedStream bufferedStream;

            using (Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing hPBProcessing = new Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing(report, paginationSettings, createAndRegisterStream, ref renderProperties))
            {
                hPBProcessing.SetContext(hPBProcessing.PaginationSettings.StartPage, hPBProcessing.PaginationSettings.EndPage);
                using (Renderer renderer = new Renderer(physicalPagination: true))
                {
                    bufferedStream = new BufferedStream(createAndRegisterStream(report.Name, "pdf", null, "application/pdf", willSeek: false, StreamOper.CreateAndRegister));
                    using (PDFWriter pDFWriter = new PDFWriter(renderer, bufferedStream, disposeRenderer: false, createAndRegisterStream, hPBProcessing.PaginationSettings.DpiX, hPBProcessing.PaginationSettings.DpiY))
                    {
                        pDFWriter.HumanReadablePDF = m_humanReadablePDF;
                        pDFWriter.PrintOnOpen      = m_printOnOpen;
                        pDFWriter.Test             = m_test;
                        pDFWriter.EmbedFonts       = m_embedFonts;
                        if (report.HasDocumentMap)
                        {
                            DocumentMap documentMap = null;
                            try
                            {
                                documentMap = report.DocumentMap;
                                if (documentMap != null)
                                {
                                    if (documentMap.MoveNext())
                                    {
                                        DocumentMapNode current = documentMap.Current;
                                        HandleDocumentMap(documentMap, pDFWriter.DocumentMapRootLabel = new PDFLabel(current.Id, current.Label), 1);
                                    }
                                    if (pDFWriter.DocumentMapRootLabel.Children == null || pDFWriter.DocumentMapRootLabel.Children.Count == 0)
                                    {
                                        pDFWriter.DocumentMapRootLabel = null;
                                    }
                                    else
                                    {
                                        pDFWriter.DocumentMapLabelPoints = new Dictionary <string, PDFPagePoint>();
                                    }
                                }
                            }
                            finally
                            {
                                documentMap?.Dispose();
                            }
                        }
                        int num = hPBProcessing.PaginationSettings.StartPage;
                        pDFWriter.BeginReport(hPBProcessing.PaginationSettings.MeasureTextDpi, hPBProcessing.PaginationSettings.MeasureTextDpi);
                        while (true)
                        {
                            hPBProcessing.GetNextPage(out RPLReport rplReport);
                            if (rplReport == null)
                            {
                                break;
                            }
                            renderer.ProcessPage(rplReport, num, hPBProcessing.SharedFontCache, hPBProcessing.GlyphCache);
                            rplReport.Release();
                            rplReport = null;
                            num++;
                        }
                        pDFWriter.EndReport();
                    }
                }
            }
            bufferedStream.Flush();
        }
Пример #19
0
 public RoleListViewModel()
 {
     SiteRoles = new List <ISiteRole>();
     Paging    = new PaginationSettings();
 }
Пример #20
0
 public PagedAdminCategoryViewModel()
 {
     Paging = new PaginationSettings();
 }
 public PagedAdminContactUsViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #22
0
 public PagedAppLogItemsDto()
 {
     Paging = new PaginationSettings();
 }
Пример #23
0
 public UserListViewModel()
 {
     UserList = new List <IUserInfo>();
     Paging   = new PaginationSettings();
 }
Пример #24
0
 protected IEnumerable <TModel> GetPaginationDefaultCommand(PaginationSettings paginationSettings)
 {
     return(GetPagination(GetSelectAllCommand(), paginationSettings));
 }
 public PagedUsersListViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #26
0
 protected IEnumerable <TModel> GetPagination(string command, PaginationSettings paginationSettings)
 {
     return(RunCommand(GetPaginationCommand(command, paginationSettings)).Select(MapToModel));
 }
Пример #27
0
 public PagedAdminSlideShowViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #28
0
 public PagedAppLogItemsViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #29
0
 public PagedCategoryCommentViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #30
0
 public PagedNotificationViewModel()
 {
     Paging = new PaginationSettings();
 }
Пример #31
0
 public ScopeListViewModel()
 {
     Scopes = new List <Scope>();
     Paging = new PaginationSettings();
 }