예제 #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;
                }
            }
        }
예제 #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();
        }
예제 #3
0
파일: UnitTest1.cs 프로젝트: Sillimon/Seven
        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");
            }
        }
예제 #4
0
 public void refreshAuthors()
 {
     refreshRepository();
     authors = ra.GetAuthors().ToList <Author>();
 }