Ejemplo n.º 1
0
        private void FillDetails()
        {
            authorsListBox.Items.Clear();
            foreach (var author in _booksRepository.GetAllAuthors())
            {
                authorsListBox.Items.Add($"{author.AuthorId}. {author.FirstName} {author.LastName}");
            }

            publishersListBox.Items.Clear();
            foreach (var publisher in _booksRepository.GetAllPublishers())
            {
                publishersListBox.Items.Add($"{publisher.PublisherId}. {publisher.Name}");
            }

            genresListBox.Items.Add(Genre.Drama);
            genresListBox.Items.Add(Genre.Enciklopedija);
            genresListBox.Items.Add(Genre.Ep);
            genresListBox.Items.Add(Genre.Pjesma);
            genresListBox.Items.Add(Genre.Pripovjetka);
            genresListBox.Items.Add(Genre.Roman);
        }
Ejemplo n.º 2
0
        private void FillDetails()
        {
            bookTitleTextBox.Text     = _book.Name;
            numberOfPagesTextBox.Text = _book.NumberOfPages.ToString();
            totalBooksTextBox.Text    = _book.TotalNumberOfBooks.ToString();

            authorsListBox.Items.Clear();
            authorsListBox.Items.Add($"{_book.BookAuthor.AuthorId}. {_book.BookAuthor.FirstName} {_book.BookAuthor.LastName}");
            authorsListBox.SetSelected(0, true);
            foreach (var author in _booksRepository.GetAllAuthors())
            {
                if (author.AuthorId != _book.BookAuthor.AuthorId)
                {
                    authorsListBox.Items.Add($"{author.AuthorId}. {author.FirstName} {author.LastName}");
                }
            }

            publishersListBox.Items.Clear();
            publishersListBox.Items.Add($"{_book.BookPublisher.PublisherId}. {_book.BookPublisher.Name}");
            publishersListBox.SetSelected(0, true);
            foreach (var publisher in _booksRepository.GetAllPublishers())
            {
                if (publisher.PublisherId != _book.BookPublisher.PublisherId)
                {
                    publishersListBox.Items.Add($"{publisher.PublisherId}. {publisher.Name}");
                }
            }

            genresListBox.Items.Add(Genre.Drama);
            genresListBox.Items.Add(Genre.Enciklopedija);
            genresListBox.Items.Add(Genre.Ep);
            genresListBox.Items.Add(Genre.Pjesma);
            genresListBox.Items.Add(Genre.Pripovjetka);
            genresListBox.Items.Add(Genre.Roman);

            switch (_book.Genre)
            {
            case Genre.Drama:
                genresListBox.SetSelected(0, true);
                break;

            case Genre.Enciklopedija:
                genresListBox.SetSelected(1, true);
                break;

            case Genre.Ep:
                genresListBox.SetSelected(2, true);
                break;

            case Genre.Pjesma:
                genresListBox.SetSelected(3, true);
                break;

            case Genre.Pripovjetka:
                genresListBox.SetSelected(4, true);
                break;

            case Genre.Roman:
                genresListBox.SetSelected(5, true);
                break;
            }
        }