Exemple #1
0
        public AddEditBook(Book bookToEdit)
        {
            selectedBook = new Book(bookToEdit);

            ra = new RepositoryAuthor();
            CheckRepository();

            InitializeComponent();

            this.Title        = "Edit a book";
            this.BtOk.Content = "Edit";

            this.CbGenre.ItemsSource  = Enum.GetNames(typeof(SevenLib.Helpers.Genre));
            this.CbAuthor.ItemsSource = ra.GetAuthors();

            this.TbTitle.Text         = selectedBook.Title;
            this.DpDate.Text          = selectedBook.Date.ToLongDateString();
            this.CbGenre.SelectedItem = this.CbGenre.Items.GetItemAt(CbGenre.Items.IndexOf(selectedBook.Genre.ToString()));
            this.TbSummary.Text       = selectedBook.Summary;

            foreach (var a in CbAuthor.ItemsSource)
            {
                if (a.ToString() == selectedBook.Author.ToString())
                {
                    this.CbAuthor.SelectedItem = a;
                }
            }
        }
Exemple #2
0
        public AddEditBook()
        {
            selectedBook = new Book();

            ra = new RepositoryAuthor();
            CheckRepository();

            InitializeComponent();

            this.Title        = "Add a book";
            this.BtOk.Content = "Add";

            this.CbGenre.ItemsSource  = Enum.GetNames(typeof(SevenLib.Helpers.Genre));
            this.CbAuthor.ItemsSource = ra.GetAuthors();
        }
Exemple #3
0
        public void GetData()
        {
            authors = ra.GetAuthors().ToList <Author>();
            members = rm.GetMembers().ToList <Member>();

            foreach (Author a in authors)
            {
                Assert.IsNotNull(a, "Assert on authors");
            }

            foreach (Member m in members)
            {
                Assert.IsNotNull(m, "Assert on members");
            }
        }
Exemple #4
0
 public void refreshAuthors()
 {
     refreshRepository();
     authors = ra.GetAuthors().ToList <Author>();
 }