Exemple #1
0
        static async Task AddCoversToIssuesInTimeRange(Retriever retriever, DateOptions dateOptions, string tableName)
        {
            var ids = GetIdsForIssuesInTimeRange(retriever, dateOptions, tableName);

            if (ids != null)
            {
                string[] idArray        = ids.Result.ToArray();
                int      idArrayCounter = 0;

                MagazineIssueDate issueDate = new MagazineIssueDate(dateOptions.FirstDateNonInclusive);

                if (PromptForConfirmation(idArray.Count()))
                {
                    while (idArrayCounter < idArray.Count())
                    {
                        issueDate.IncrementMonth();
                        if (!issueDate.IsSkipMonth())
                        {
                            await AddCoverToRecord(retriever, idArray[idArrayCounter], issueDate);

                            idArrayCounter++;
                        }
                    }
                }
            }
        }
Exemple #2
0
        static string GenerateMagazineCoverUrl(MagazineIssueDate issueDate)
        {
            MagazineOptions magazineOptions = GetMagazineOptions();

            string urlBase        = magazineOptions.BaseUrl;
            string fileNameBase   = magazineOptions.FilenameBase;
            string fileNameSuffix = magazineOptions.FilenameSuffix;

            return($"{urlBase}{fileNameBase}{issueDate.GetYYYYMM()}{fileNameSuffix}");
        }
Exemple #3
0
        static async Task AddCoverToRecord(Retriever retriever, string recordId, MagazineIssueDate issueDate)
        {
            string coverUrl = GenerateMagazineCoverUrl(issueDate);

            Console.WriteLine($"coverUrl is {coverUrl}");
            string tableName = "Issues";

            (bool success, string errorMessage) = await retriever.PostAttachmentToRecord(coverUrl, tableName, recordId);

            if (!success)
            {
                Console.WriteLine(errorMessage);
            }
            else
            {
                Console.WriteLine("Successfully posted!");
            }
        }