Exemplo n.º 1
0
 public static void AddGalleryPageFooter(IPageBuilder pageBuilder)
 {
     pageBuilder.Append("<script src='https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js'></script>");
     pageBuilder.Append("<script>");
     pageBuilder.Append("baguetteBox.run('.grid-gallery', { animation: 'slideIn'});");
     pageBuilder.Append("</script>");
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a collection of entities from the <typeparamref name="TEntity"/> table which match the <paramref name="conditions"/>.
        /// </summary>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// [Table("Users")]
        /// public class UserEntity
        /// {
        ///     [Key]
        ///     public int Id { get; set; }
        ///
        ///     public string Name { get; set; }
        ///
        ///     public int Age { get; set; }
        /// }
        /// ...
        /// var pageBuilder = new PageIndexPageBuilder(3, 10);
        /// var users = await this.connection.GetPageAsync<UserEntity>(pageBuilder, new { Age = 10 }, "Age DESC");
        /// ]]>
        /// </code>
        /// </example>
        public static async Task <PagedList <TEntity> > GetPageAsync <TEntity>(
            this IDbConnection connection,
            IPageBuilder pageBuilder,
            object conditions,
            string orderBy,
            IDbTransaction transaction          = null,
            IDialect dialect                    = null,
            int?commandTimeout                  = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.NotNull(connection, nameof(connection));

            var totalNumberOfItems = await connection.CountAsync <TEntity>(conditions, transaction, dialect, commandTimeout, cancellationToken)
                                     .ConfigureAwait(false);

            var page = pageBuilder.GetCurrentPage(totalNumberOfItems);

            if (page.IsEmpty)
            {
                return(PagedList <TEntity> .Empty(totalNumberOfItems, page));
            }

            var itemsCommand = CommandFactory.MakeGetPageCommand <TEntity>(page, conditions, orderBy, transaction, dialect, commandTimeout, cancellationToken);
            var items        = await connection.QueryAsync <TEntity>(itemsCommand).ConfigureAwait(false);

            return(PagedList <TEntity> .Create(totalNumberOfItems, page, items));
        }
        /// <summary>
        /// Gets a collection of entities from the <typeparamref name="TEntity"/> table which match the <paramref name="conditions"/>.
        /// </summary>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// [Table("Users")]
        /// public class UserEntity
        /// {
        ///     [Key]
        ///     public int Id { get; set; }
        ///
        ///     public string Name { get; set; }
        ///
        ///     public int Age { get; set; }
        /// }
        /// ...
        /// var pageBuilder = new PageIndexPageBuilder(3, 10);
        /// var users = this.connection.GetPage<UserEntity>(pageBuilder, "WHERE Age > @MinAge", "Age DESC", new { MinAge = 18 });
        /// ]]>
        /// </code>
        /// </example>
        public static PagedList <TEntity> GetPage <TEntity>(
            this IDbConnection connection,
            IPageBuilder pageBuilder,
            string conditions,
            string orderBy,
            object parameters          = null,
            IDbTransaction transaction = null,
            IDialect dialect           = null,
            int?commandTimeout         = null)
        {
            Ensure.NotNull(connection, nameof(connection));

            var totalNumberOfItems = connection.Count <TEntity>(conditions, parameters, transaction, dialect, commandTimeout);
            var page = pageBuilder.GetCurrentPage(totalNumberOfItems);

            if (page.IsEmpty)
            {
                return(PagedList <TEntity> .Empty(totalNumberOfItems, page));
            }

            var itemsCommand = CommandFactory.MakeGetPageCommand <TEntity>(page, conditions, orderBy, parameters, transaction, dialect, commandTimeout);
            var items        = connection.Query <TEntity>(itemsCommand);

            return(PagedList <TEntity> .Create(totalNumberOfItems, page, items));
        }
Exemplo n.º 4
0
 public static void AddGalleryHeaderWithDate(IPageBuilder builder, string name)
 {
     builder.Append("<section class='gallery-block grid-gallery'>");
     builder.Append("<div class='container'>");
     builder.Append("<div class='col-md-12'>");
     builder.Append($"<hp>{name}</hp>");
     builder.Append("</div>");
     builder.Append("<div class='row'>");
 }
Exemplo n.º 5
0
 public static void AddGalleryHeaderLocos(IPageBuilder builder, string name)
 {
     builder.Append("<section class='gallery-block grid-gallery'>");
     builder.Append("<div class='container'>");
     builder.Append("<div class='row'>");
     if (!string.IsNullOrWhiteSpace(name))
     {
         builder.Append($"<h2><a id='{name}'>{name}</a></h2>");
     }
 }
 public NavigationService(
     NavigationProvider navigationProvider,
     ICompositeNavigationPerformer navigationPerformer,
     IViewModelBuilder viewModelBuilder,
     IPageBuilder pageBuilder)
 {
     _navigationProvider  = navigationProvider;
     _navigationPerformer = navigationPerformer;
     _pageBuilder         = pageBuilder;
     _viewModelBuilder    = viewModelBuilder;
 }
        /// <summary>
        /// Gets a collection of entities from the <typeparamref name="TEntity"/> table which match the <paramref name="conditions"/>.
        /// </summary>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// var pageBuilder = new PageIndexPageBuilder(3, 10);
        /// var users = this.connection.GetPage<UserEntity>(pageBuilder, new { Age = 10 }, "Age DESC");
        /// ]]>
        /// </code>
        /// </example>
        public static PagedList <TEntity> GetPage <TEntity>(
            this IDapperConnection connection,
            IPageBuilder pageBuilder,
            object conditions,
            string orderBy,
            IDbTransaction transaction = null,
            IDialect dialect           = null,
            int?commandTimeout         = null)
        {
            Ensure.NotNull(connection, nameof(connection));

            return(connection.DbConnection.GetPage <TEntity>(pageBuilder, conditions, orderBy, connection.Transaction, connection.Dialect, commandTimeout));
        }
        public PagedList <TEntity> GetPage <TEntity>(IPageBuilder pageBuilder, string orderBy, object conditions, int?commandTimeout = null)
        {
            var totalNumberOfItems = this.Count <TEntity>(conditions, commandTimeout);
            var page = pageBuilder.GetCurrentPage(totalNumberOfItems);

            if (page.IsEmpty)
            {
                return(PagedList <TEntity> .Empty(totalNumberOfItems, page));
            }

            var pageCommand = this.commandFactory.MakeGetPageCommand <TEntity>(page, conditions, orderBy);
            var items       = this.Query <TEntity>(pageCommand.CommandText, pageCommand.Parameters, CommandType.Text, commandTimeout);

            return(PagedList <TEntity> .Create(totalNumberOfItems, page, items));
        }
Exemplo n.º 9
0
        public static void AddImageToGallery(string htmlpath, string imagePath, IPageBuilder stringBuilder, string image, string offSetFolder = "")
        {
            htmlpath  = htmlpath.Replace("\\\\", "\\");
            imagePath = imagePath.Replace("\\\\", "\\");

            string newImagePath      = ImageHelper.CopyImageTo(imagePath, image);
            string newImagePathThumb = ImageHelper.CopyImageToThumb(imagePath, image);

            newImagePath      = newImagePath.Replace(htmlpath, string.Empty);
            newImagePathThumb = newImagePathThumb.Replace(htmlpath, string.Empty);

            string imageTitle = Path.GetFileNameWithoutExtension(newImagePath);

            stringBuilder.Append(HTMLHelper.BuildImageGalleryCard(offSetFolder + newImagePath, offSetFolder + newImagePathThumb, imageTitle));
        }
Exemplo n.º 10
0
 public PageDirector(IPageBuilder builder)
 {
     _builder = builder;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PageProcessor"/> class.
 /// </summary>
 /// <param name="pageBuilder">The page builder.</param>
 /// <param name="responseWriter">The response writer.</param>
 /// <param name="redirector">The redirector.</param>
 public PageProcessor(IPageBuilder pageBuilder, IResponseWriter responseWriter, IRedirector redirector)
 {
     _pageBuilder = pageBuilder;
     _responseWriter = responseWriter;
     _redirector = redirector;
 }
Exemplo n.º 12
0
 public PageDirector(IPageBuilder builder)
 {
     this._builder = builder;
 }
Exemplo n.º 13
0
 public static void AddGalleryFooter(IPageBuilder builder)
 {
     builder.Append("</div></div></section>");
 }
Exemplo n.º 14
0
        public static string ConvertImageToGallery(string htmlpath, string imagePath, IPageBuilder stringBuilder, string image)
        {
            htmlpath  = htmlpath.Replace("\\\\", "\\");
            imagePath = imagePath.Replace("\\\\", "\\");

            string newImagePath      = ImageHelper.CopyImageTo(imagePath, image);
            string newImagePathThumb = ImageHelper.CopyImageToThumb(imagePath, image);

            newImagePath = newImagePath.Replace(htmlpath, string.Empty);
            //newImagePathThumb = newImagePathThumb.Replace(htmlpath, string.Empty);

            //string imageTitle = Path.GetFileNameWithoutExtension(newImagePath);
            return(newImagePath);
            //stringBuilder.Append(HTMLHelper.BuildImageGalleryCard(newImagePath, newImagePathThumb, imageTitle));
        }