示例#1
0
        private async Task <string> CreateBookSourceAsync(IBaseSource source, string userEmail = null)
        {
            var bookSource = source as BookSource;

            var workName           = string.IsNullOrEmpty(bookSource.WorkName) ? string.Empty : $" {bookSource.WorkName} /";
            var placeOfPublication = string.IsNullOrEmpty(bookSource.PlaceOfPublication) ? string.Empty : $" - {bookSource.PlaceOfPublication}";
            var publishingHouse    = string.IsNullOrEmpty(bookSource.PublishingHouse) ? string.Empty : $": {bookSource.PublishingHouse}";
            var yearOfPublication  = bookSource.YearOfPublication == null ? string.Empty : $", {bookSource.YearOfPublication}.";
            var numberOfPages      = string.IsNullOrEmpty(bookSource.NumberOfPages) ? string.Empty : $" – {bookSource.NumberOfPages} c.";
            var publishingName     = string.IsNullOrEmpty(bookSource.PublishingName) ? string.Empty : $" – ({bookSource.PublishingName}).";

            var content = $"{bookSource.ParseAuthor()}{workName}" +
                          $"{bookSource.ParseAllAuthors()}{placeOfPublication}" +
                          $"{publishingHouse}{yearOfPublication}" +
                          $"{numberOfPages}{publishingName} – " +
                          $"({bookSource.Series}; {shortPublicationTypes[bookSource.PublicationNumberType]} {bookSource.PeriodicSelectionNumber})";

            var newSource = new SourceRecord {
                Content = content, Type = bookSource.Type
            };

            if (!string.IsNullOrEmpty(userEmail))
            {
                await SaveSourceAsync(newSource, userEmail);
            }

            return(content);
        }
示例#2
0
        private async Task <string> CreateElectronicSourceAsync(IBaseSource source, string userEmail = null)
        {
            var electronicSource = source as ElectronicSource;
            var publication      = string.IsNullOrEmpty(electronicSource.Publication) ? string.Empty : $" // {electronicSource.Publication}";
            var yearOfPulication = electronicSource.YearOfPublication == null ? string.Empty : $". – {electronicSource.YearOfPublication}.";

            var content = $"{electronicSource.ParseAuthor()}{electronicSource.WorkName} [Електронний ресурс]{electronicSource.ParseAllAuthors()}{publication}{yearOfPulication}" +
                          $" – Режим доступу до ресурсу: {electronicSource.LinkToSource}";

            var newSource = new SourceRecord {
                Content = content, Type = electronicSource.Type
            };

            if (!string.IsNullOrEmpty(userEmail))
            {
                await SaveSourceAsync(newSource, userEmail);
            }

            return(content);
        }
示例#3
0
        private async Task <string> CreatePeriodicalSourceAsync(IBaseSource source, string userEmail = null)
        {
            var periodicalSource = source as PeriodicalSource;

            var publication             = string.IsNullOrEmpty(periodicalSource.Publication) ? string.Empty : $" // {periodicalSource.Publication}";
            var yearOfPulication        = periodicalSource.YearOfPublication == null ? string.Empty : $". – {periodicalSource.YearOfPublication}.";
            var periodicSelectionNumber = periodicalSource.PeriodicSelectionNumber == null ? string.Empty : $" – №{periodicalSource.PeriodicSelectionNumber}.";
            var pages = string.IsNullOrEmpty(periodicalSource.Pages) ? string.Empty : $" – C. {periodicalSource.Pages}.";

            var content = $"{periodicalSource.ParseAuthor()}{periodicalSource.WorkName}{periodicalSource.ParseAllAuthors()}{publication}{yearOfPulication}" +
                          $"{periodicSelectionNumber}{pages}";

            var newSource = new SourceRecord {
                Content = content, Type = periodicalSource.Type
            };

            if (!string.IsNullOrEmpty(userEmail))
            {
                await SaveSourceAsync(newSource, userEmail);
            }

            return(content);
        }
示例#4
0
 public async Task <string> CreateSourceAsync(IBaseSource source, string userEmail = null)
 {
     return(await sourceFormaters[source.Type](source, userEmail));
 }