public static void Build(IModelEvent pageDetails)
        {
            string htmlpath = Constants.FullCatalog;

            Directory.CreateDirectory(htmlpath);

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(PageHeaderHelper.PageHeader(new CatalogHeader()));
            stringBuilder.Append("<body>");
            stringBuilder.Append(NavBarHelper.NavBar("../"));
            stringBuilder.AppendLine("<div class='container mt-4'>");
            stringBuilder.Append(Jumbotron(null));

            stringBuilder.Append(AddDetails(htmlpath, htmlpath + "images\\", "Wagons"));
            stringBuilder.Append(AddDetails(htmlpath, htmlpath + "images\\", "Loco"));
            stringBuilder.Append(AddDetails(htmlpath, htmlpath + "images\\", "Coach"));

            stringBuilder.AppendLine("</div>");
            stringBuilder.AppendLine("</div>");

            stringBuilder.AppendLine(HTMLHelper.Modal());

            stringBuilder.Append("<script src='../Scripts/script.js'></script>");
            stringBuilder.Append("</body>");

            File.WriteAllText(htmlpath + "index.html", stringBuilder.ToString());
        }
예제 #2
0
            public EventSourceHandler(UIElement element, IModelEvent ModelEvent)
            {
                _Element    = new WeakReference <UIElement>(element);
                _ModelEvent = new WeakReference <IModelEvent>(ModelEvent);

                ModelEvent.Event += OnEventInvoked;
            }
        private static void AddImagesByLayout(List <string> images, IModelEvent pageDetails, string htmlpath, string imagePath, eWolfBootstrap.Interfaces.IPageBuilder stringBuilder)
        {
            foreach (Data.LayoutDetails layout in pageDetails.Layouts)
            {
                if (!layout.ImagePaths.Any())
                {
                    continue;
                }

                HTMLHelper.Gallery.AddGalleryHeader(stringBuilder, layout.IDName);

                foreach (string layoutImage in layout.ImagePaths)
                {
                    if (images.Contains(layoutImage))
                    {
                        HTMLHelper.AddImageToGallery(htmlpath, imagePath, stringBuilder, layoutImage);
                        images.Remove(layoutImage);
                    }
                }
                HTMLHelper.Gallery.AddGalleryFooter(stringBuilder);
            }

            if (images.Any())
            {
                HTMLHelper.Gallery.AddGalleryHeader(stringBuilder, null);

                foreach (string image in images)
                {
                    HTMLHelper.AddImageToGallery(htmlpath, imagePath, stringBuilder, image);
                }

                HTMLHelper.Gallery.AddGalleryFooter(stringBuilder);
            }
        }
        public static void Build(IModelEvent pageDetails)
        {
            pageDetails.ExtraIncludes.Add(eWolfBootstrap.Enums.BootstrapOptions.GALLERY);

            pageDetails.CopyLayoutsToKeywords();

            Console.WriteLine(pageDetails.Name);

            List <string> images = ImageHelper.GetAllImages(pageDetails.ImagesPath);

            AddImageToLayouts(pageDetails, images);

            // create folders
            Directory.CreateDirectory(Constants.RootPath + "\\" + Constants.ModelEvents);
            Directory.CreateDirectory(Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder);
            Directory.CreateDirectory(Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder + @"\images");

            string htmlpath  = Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder + "\\";
            string imagePath = Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder + @"\images";

            eWolfBootstrap.Interfaces.IPageBuilder pageBuilder = new PageBuilder("index.html", htmlpath, pageDetails, "../../");

            pageBuilder.Append(NavBarHelper.NavBar("../../"));
            pageBuilder.Append("<div class='container mt-4'>");

            pageBuilder.Append(Jumbotron(pageDetails));

            LocationsService ls = ServiceLocator.Instance.GetService <LocationsService>();

            ls.AddLocation(pageDetails);

            AddImagesByLayout(images, pageDetails, htmlpath, imagePath, pageBuilder);

            pageBuilder.Output();
        }
예제 #5
0
        private static void AddImagesByLayout(List <string> images, IModelEvent pageDetails, string htmlpath, string imagePath, StringBuilder stringBuilder)
        {
            bool any   = false;
            int  count = 2;

            foreach (Data.LayoutDetails layout in pageDetails.Layouts)
            {
                if (!layout.ImagePaths.Any())
                {
                    continue;
                }

                stringBuilder.AppendLine("</div>");
                stringBuilder.Append($"<hr/><h2><a id='{layout.IDName}'> {layout.Name}</a></h2>");
                stringBuilder.AppendLine("<div class='row'>");

                count = 2;
                foreach (string layoutImage in layout.ImagePaths)
                {
                    if (images.Contains(layoutImage))
                    {
                        HTMLHelper.AddImageToPage(htmlpath, imagePath, stringBuilder, layoutImage);
                        if (count-- == 0)
                        {
                            count = 2;
                            stringBuilder.AppendLine("</div></div>");
                            stringBuilder.AppendLine("<div class='container mt-4'><div class='row'>");
                        }
                        any = true;
                        images.Remove(layoutImage);
                    }
                }
            }
            if (images.Any())
            {
                count = 2;
                if (any)
                {
                    stringBuilder.AppendLine("</div>");
                    stringBuilder.Append("<hr/><h4>Others</h4>");
                    stringBuilder.AppendLine("<div class='row'>");
                }
                foreach (string image in images)
                {
                    HTMLHelper.AddImageToPage(htmlpath, imagePath, stringBuilder, image);
                    if (count-- == 0)
                    {
                        count = 2;
                        stringBuilder.AppendLine("</div>");
                        stringBuilder.AppendLine("</div>");
                        stringBuilder.AppendLine("<div class='container mt-4'>");
                        stringBuilder.AppendLine("<div class='row'>");
                    }
                }
            }
        }
예제 #6
0
        public static void Build(IModelEvent pageDetails)
        {
            GetLayoutDetails();

            string htmlpath = Constants.FullMyLayouts;

            Directory.CreateDirectory(htmlpath);

            int totalPages = (_orderedDetails.Count(x => x.Active) / DetailsPerPage);

            int pageIndex = 0;

            while (_orderedDetails.Any())
            {
                string pageIndexDisplay = NavBarHelper.GetHtmlPageName(pageIndex);

                var pageBuilder = new PageBuilder($"{pageIndexDisplay}", htmlpath, new MyLayoutHeader(), "../");

                pageBuilder.Append(NavBarHelper.NavBar("../"));

                pageBuilder.Append("<div class='container mt-4'>");

                string imageName     = Constants.DriveLetter + "Trains/_WebsiteData/Others/images/";
                string imageHtmlName = "../Others/images/";

                pageBuilder.JumbotronWithImage("<h1>Cattington</h1>",
                                               "<p'>Now it's our turn, We have just started to build our first layout." +
                                               "</br>We are Building Cattington, and we are updatd details here every week or so.</p>",
                                               imageName,
                                               imageHtmlName,
                                               "CATTINGTON.png");

                pageBuilder.Append(NavBarHelper.Pagination(pageIndex, totalPages));

                for (int i = 0; i < DetailsPerPage; i++)
                {
                    if (_orderedDetails.Any())
                    {
                        BuildDetails(pageBuilder, _orderedDetails[0]);
                        _orderedDetails.RemoveAt(0);
                    }
                }
                pageBuilder.Append(NavBarHelper.Pagination(pageIndex, totalPages));
                pageBuilder.Append("</div>");
                pageBuilder.Append(HTMLRailHelper.Modal());
                pageBuilder.Append("<script src='../Scripts/script.js'></script>");

                pageBuilder.Output();

                pageIndex++;
            }
        }
 private static void AddImageToLayouts(IModelEvent pageDetails, List <string> images)
 {
     foreach (string imageName in images)
     {
         foreach (Data.LayoutDetails layout in pageDetails.Layouts)
         {
             if (layout.Path != null && imageName.Contains(layout.Path))
             {
                 layout.ImagePaths.Add(imageName);
             }
         }
     }
 }
        private static string CreateBlog(IModelEvent blog)
        {
            StringBuilder blogHtml = new StringBuilder();

            blogHtml.AppendLine("<div class='col-md-6'>");
            blogHtml.AppendLine("<div class='card border-dark mb-3'>");
            blogHtml.AppendLine($"<h5 class='card-header'>{blog.Title}</h5>");
            blogHtml.AppendLine("<div class='card-body'>");
            blogHtml.AppendLine($"<h6>{blog.TripDate.ToShortDateString()}</h6>");
            blogHtml.AppendLine($"      <a href='{blog.ImageFolder}/index.html'><img class='rounded float-right' width='214px' height ='160px'src='{blog.ImageFolder}\\images\\{blog.ImagePreview}'></a>");
            blogHtml.AppendLine($"<p class='col-md-6 card-text float-left'>{blog.Descrption}</p>");
            blogHtml.AppendLine($"<p class='col-md-6 '><a href='{blog.ImageFolder}/index.html' class='font-weight-bold'>See more</a></p>");
            blogHtml.AppendLine("</div>");
            blogHtml.AppendLine("</div>");
            blogHtml.AppendLine("</div>");

            return(blogHtml.ToString());
        }
예제 #9
0
        public async Task <int> AppendEventAsync(IModelEvent <Guid> eventModel)
        {
            var settings = new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.Auto
            };
            var eventObjJson = JsonConvert.SerializeObject(eventModel, typeof(object), settings);

            await _dbContext.InventoryEventItems.AddAsync(
                new InventoryItemEventDto()
            {
                AggregateId  = eventModel.AggregateId,
                Timestamp    = eventModel.Timestamp,
                EventName    = eventModel.EventName,
                EventObjJson = eventObjJson
            }
                );

            await _dbContext.SaveChangesAsync();

            return(_dbContext.InventoryEventItems.Select(i => i.AggregateId == eventModel.AggregateId).Count());
        }
예제 #10
0
        public static void Build(IModelEvent pageDetails)
        {
            pageDetails.CopyLayoutsToKeywords();

            Console.WriteLine(pageDetails.Name);

            List <string> images = ImageHelper.GetAllImages(pageDetails.ImagesPath);

            AddImageToLayouts(pageDetails, images);

            // create folders
            Directory.CreateDirectory(Constants.RootPath + "\\" + Constants.ModelEvents);
            Directory.CreateDirectory(Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder);
            Directory.CreateDirectory(Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder + @"\images");

            string htmlpath  = Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder + "\\";
            string imagePath = Constants.RootPath + "\\" + Constants.ModelEvents + "\\" + pageDetails.ImageFolder + @"\images";

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(PageHeaderHelper.PageHeader(pageDetails));
            stringBuilder.Append("<body>");
            stringBuilder.Append(NavBarHelper.NavBar("../../"));
            stringBuilder.AppendLine("<div class='container mt-4'>");
            stringBuilder.Append(Jumbotron(pageDetails));

            stringBuilder.AppendLine("<div class='row'>");

            AddImagesByLayout(images, pageDetails, htmlpath, imagePath, stringBuilder);

            stringBuilder.AppendLine("</div>");
            stringBuilder.AppendLine("</div>");

            stringBuilder.AppendLine(HTMLHelper.Modal());

            stringBuilder.Append("<script src='../../Scripts/script.js'></script>");
            stringBuilder.Append("</body>");

            File.WriteAllText(htmlpath + "index.html", stringBuilder.ToString());
        }
예제 #11
0
        public static void BuildOld(IModelEvent pageDetails)
        {
            string htmlpath = Constants.FullMyLayouts;

            Directory.CreateDirectory(htmlpath);

            var pageBuilder = new PageBuilder("index.html", htmlpath, new MyLayoutHeader(), "../");

            pageBuilder.Append(NavBarHelper.NavBar("../"));
            pageBuilder.Append("<div class='container mt-4'>");
            pageBuilder.Jumbotron("<h1>Home layouts</h1>", "<p'>It's now our turn, I've just started to build our new layout, currently on the floor!</p>");

            GetLayoutDetails();

            pageBuilder.Append("</div>");
            pageBuilder.Append("</div>");

            pageBuilder.Append(HTMLRailHelper.Modal());

            pageBuilder.Append("<script src='../Scripts/script.js'></script>");

            pageBuilder.Output();
        }
예제 #12
0
        public static void Build(IModelEvent pageDetails)
        {
            string htmlpath = Constants.FullCatalog;

            Directory.CreateDirectory(htmlpath);

            eWolfBootstrap.Interfaces.IPageBuilder pageBuilder = new PageBuilder("index.html", htmlpath, new CatalogHeader(), "../");
            pageBuilder.Append(NavBarHelper.NavBar("../"));
            pageBuilder.Append("<div class='container mt-4'>");
            pageBuilder.Append(Jumbotron(null));

            pageBuilder.Append(AddDetails(htmlpath, htmlpath + "images\\", "Wagons"));
            pageBuilder.Append(AddDetails(htmlpath, htmlpath + "images\\", "Loco"));
            pageBuilder.Append(AddDetails(htmlpath, htmlpath + "images\\", "Coach"));

            pageBuilder.Append("</div>");
            pageBuilder.Append("</div>");

            pageBuilder.Append(HTMLRailHelper.Modal());

            pageBuilder.Append("<script src='../Scripts/script.js'></script>");

            pageBuilder.Output();
        }
예제 #13
0
 /// <summary>
 /// Appends the event model
 /// </summary>
 /// <returns>The aggregate model</returns>
 /// <param name="eventModel">Event source model.</param>
 public async Task <int> AppendEventAsync(IModelEvent <IdT> eventModel)
 {
     return(await _eventStore.AppendEventAsync(eventModel));
 }