示例#1
0
        public static async Task <(GenerationReturn generationReturn, PointContentDto pointContent)> SaveAndGenerateHtml(
            PointContentDto toSave, DateTime?generationVersion, IProgress <string> progress)
        {
            var validationReturn = await Validate(toSave);

            if (validationReturn.HasError)
            {
                return(validationReturn, null);
            }

            Db.DefaultPropertyCleanup(toSave);
            toSave.Tags = Db.TagListCleanup(toSave.Tags);

            var savedPoint = await Db.SavePointContent(toSave);

            GenerateHtml(savedPoint, generationVersion, progress);
            await Export.WriteLocalDbJson(Db.PointContentDtoToPointContentAndDetails(savedPoint).content);

            DataNotifications.PublishDataNotification("Point Generator", DataNotificationContentType.Point,
                                                      DataNotificationUpdateType.LocalContent, new List <Guid> {
                savedPoint.ContentId
            });

            return(await GenerationReturn.Success($"Saved and Generated Content And Html for {savedPoint.Title}"),
                   savedPoint);
        }
示例#2
0
        public static async Task <(GenerationReturn generationReturn, LinkContent linkContent)> SaveAndGenerateHtml(
            LinkContent toSave, DateTime?generationVersion, IProgress <string> progress)
        {
            var validationReturn = await Validate(toSave);

            if (validationReturn.HasError)
            {
                return(validationReturn, null);
            }

            Db.DefaultPropertyCleanup(toSave);
            toSave.Tags = Db.TagListCleanup(toSave.Tags);

            await Db.SaveLinkContent(toSave);

            await SaveLinkToPinboard(toSave, progress);

            GenerateHtmlAndJson(generationVersion, progress);

            DataNotifications.PublishDataNotification("Link Generator", DataNotificationContentType.Link,
                                                      DataNotificationUpdateType.LocalContent, new List <Guid> {
                toSave.ContentId
            });

            return(
                await GenerationReturn.Success($"Saved and Generated Content And Html for Links to Add {toSave.Title}"),
                toSave);
        }
        public static async Task <(GenerationReturn generationReturn, FileContent fileContent)> SaveAndGenerateHtml(
            FileContent toSave, FileInfo selectedFile, bool overwriteExistingFiles, DateTime?generationVersion,
            IProgress <string> progress)
        {
            var validationReturn = await Validate(toSave, selectedFile);

            if (validationReturn.HasError)
            {
                return(validationReturn, null);
            }

            Db.DefaultPropertyCleanup(toSave);
            toSave.Tags = Db.TagListCleanup(toSave.Tags);

            toSave.OriginalFileName = selectedFile.Name;
            FileManagement.WriteSelectedFileContentFileToMediaArchive(selectedFile);
            await Db.SaveFileContent(toSave);

            WriteFileFromMediaArchiveToLocalSite(toSave, overwriteExistingFiles, progress);
            GenerateHtml(toSave, generationVersion, progress);
            await Export.WriteLocalDbJson(toSave, progress);

            DataNotifications.PublishDataNotification("File Generator", DataNotificationContentType.File,
                                                      DataNotificationUpdateType.LocalContent, new List <Guid> {
                toSave.ContentId
            });

            return(await GenerationReturn.Success($"Saved and Generated Content And Html for {toSave.Title}"), toSave);
        }
示例#4
0
        public static async Task <(GenerationReturn generationReturn, MapComponentDto mapDto)> SaveAndGenerateData(
            MapComponentDto toSave, DateTime?generationVersion, IProgress <string> progress)
        {
            var validationReturn = await Validate(toSave);

            if (validationReturn.HasError)
            {
                return(validationReturn, null);
            }

            Db.DefaultPropertyCleanup(toSave);

            var savedComponent = await Db.SaveMapComponent(toSave);

            await GenerateData(savedComponent, progress);

            await Export.WriteLocalDbJson(savedComponent.Map);

            DataNotifications.PublishDataNotification("Map Component Generator", DataNotificationContentType.Map,
                                                      DataNotificationUpdateType.LocalContent, new List <Guid> {
                savedComponent.Map.ContentId
            });

            return(
                await GenerationReturn.Success(
                    $"Saved and Generated Map Component {savedComponent.Map.ContentId} - {savedComponent.Map.Title}"),
                savedComponent);
        }
示例#5
0
        public static async Task <(GenerationReturn generationReturn, NoteContent noteContent)> SaveAndGenerateHtml(
            NoteContent toSave, DateTime?generationVersion, IProgress <string> progress)
        {
            var validationReturn = await Validate(toSave);

            if (validationReturn.HasError)
            {
                return(validationReturn, null);
            }

            Db.DefaultPropertyCleanup(toSave);
            toSave.Tags = Db.TagListCleanup(toSave.Tags);

            await Db.SaveNoteContent(toSave);

            GenerateHtml(toSave, generationVersion, progress);
            await Export.WriteLocalDbJson(toSave, progress);

            DataNotifications.PublishDataNotification("Note Generator", DataNotificationContentType.Note,
                                                      DataNotificationUpdateType.LocalContent, new List <Guid> {
                toSave.ContentId
            });

            return(await GenerationReturn.Success($"Saved and Generated Content And Html for {toSave.Title}"), toSave);
        }